Skip to content

Parsing IOpenApiAny should respect format and type - #343

Merged
PerthCharern merged 14 commits into
masterfrom
perthcharern/ParsingAnyShouldRespectFormatAndType
Nov 7, 2018
Merged

PerthCharern merged 14 commits into
masterfrom
perthcharern/ParsingAnyShouldRespectFormatAndType

Conversation

@PerthCharern

@PerthCharern PerthCharern commented Oct 31, 2018 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

Darrel (@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",

@darrelmiller Darrel (darrelmiller) Nov 7, 2018 •

Copy link
Copy Markdown
Member

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

@darrelmiller Darrel (darrelmiller) left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

Thanks for the review Darrel (@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