Skip to content

Parsing IOpenApiAny should respect format and type #343

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

Merged

Conversation

PerthCharern
Copy link
Contributor

@PerthCharern PerthCharern commented Oct 31, 2018

Fix #306

  • Parse IOpenApiAny with respect to type and format This handles parsing default, enum, example, and examples in both V2 and V3.

  • Validation rules added to validate whether there is a mismatch between the given type and the data itself.

  • The code is quite involved given that the schema type/format information may not reside at the same level as the Any itself (e.g. the Any deep down in examples field in media type needs information form schema field).

…e'll try to convert.

- If type exists, then respect the type. If data conflicts with the type, throw an error.

- If type doesn't exist, use best effort.
- add handling for compelx type
PerthCharern and others added 9 commits October 31, 2018 16:01
- Fix culture.
- Move Field Map parameters out to their own files.
- Don't throw inside the convertor
Handle Example in MediaType and Parameter in V3
fix the response deserializer
@PerthCharern
Copy link
Contributor Author

This changeset turned out to be much larger than I originally expected, as I kept going down the rabbit hole after discovering more and more nuances from the spec and the V2/V3 discrepancies.

@darrelmiller It's ready for review now. Apologies for the PR size - on the upside, half of the files are tests and the remaining, except a few files, contain straightforward changes, so hopefully this is not too bad to review.

new AnyListFieldMap<OpenApiParameter>
{
{
"enum",
Copy link
Member

@darrelmiller darrelmiller Nov 7, 2018

Choose a reason for hiding this comment

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

Probably would be good to have these as constants #Resolved

Copy link
Member

@darrelmiller darrelmiller left a comment

Choose a reason for hiding this comment

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

I think my only comment here is... WOW. I did not expect this to turn out to be so much work. It is awesome though that you are walking OpenApiAny structures and making sure all the values are the right type.

@PerthCharern PerthCharern merged commit 366b8c6 into master Nov 7, 2018
@PerthCharern
Copy link
Contributor Author

Thanks for the review @darrelmiller!

@PerthCharern PerthCharern mentioned this pull request Dec 12, 2018
@PerthCharern PerthCharern deleted the perthcharern/ParsingAnyShouldRespectFormatAndType branch April 19, 2019 01:24
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.

2 participants