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

Make nullary schemas valid #168

Merged
merged 1 commit into from
Nov 24, 2018
Merged

Conversation

michalrus
Copy link
Contributor

Resolves #167

Because of toJSON · fromJSON ≠ ±id for SwaggerItems, I had to modify instance ToJSON Schema to make tests pass… (+ we don’t have lens here yet).

Ugly…

/cc @phadej @fizruk

@@ -1050,6 +1050,10 @@ instance ToJSON (ParamSchema t) => ToJSON (SwaggerItems t) where
[ "collectionFormat" .= fmt
, "items" .= schema ]
toJSON (SwaggerItemsObject x) = object [ "items" .= x ]
toJSON (SwaggerItemsArray []) = object -- Nullary schema, cf. <https://github.com/GetShopTV/swagger2/issues/167>.
Copy link
Member

Choose a reason for hiding this comment

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

Can you make that comment into a haddock documentation for this instance and add a doctest?

@phadej
Copy link
Collaborator

phadej commented Nov 16, 2018

ping @michalrus

@michalrus
Copy link
Contributor Author

Hey, updated with @fizruk’s suggestions. I hope this passes… Sorry for the delay. =)

@phadej phadej self-assigned this Nov 23, 2018
@phadej phadej merged commit 6fc1496 into GetShopTV:master Nov 24, 2018
@michalrus michalrus deleted the nullary-schema-valid branch December 22, 2018 10:56
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.

None yet

3 participants