Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cast_and_validate/5 to properly handle required readOnly fields #513

Closed

Conversation

kehitt
Copy link

@kehitt kehitt commented Nov 17, 2022

This PR attempts to fix a bug described in #499. The bug leads to OpenApiSpex.cast_and_validate/5 considering readOnly fields to be required in the request body. A fix is achieved by adding an ability to pass read_write_scope from Operation2/CastParameters to object casting code.

lib/open_api_spex/cast.ex Outdated Show resolved Hide resolved
defp get_property_schema(ctx, property_name) do
case ctx.schema.properties[property_name] do
schema = %_{} -> OpenApiSpex.resolve_schema(schema, ctx.schemas)
_ -> nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does execution reach this line? When there's a value in the required list that doesn't correspond to a key in the properties map?

@lucacorti
Copy link
Contributor

Anything needed to move this on?

@mbuhot
Copy link
Collaborator

mbuhot commented May 24, 2024

Resolved by #572

@mbuhot mbuhot closed this May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants