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

Schema naming and whole swagger spec #13

Closed
fizruk opened this issue Nov 27, 2015 · 0 comments
Closed

Schema naming and whole swagger spec #13

fizruk opened this issue Nov 27, 2015 · 0 comments

Comments

@fizruk
Copy link
Member

fizruk commented Nov 27, 2015

As discussed previously in #10 (comment).

When building the entire Swagger spec we can't know for sure all needed schema definitions for a spec to be complete. Here's an example:

data Color = White | Black deriving (Generic, ToSchema)
data Dog = Dog { nick :: String, color :: Color } deriving (Generic, ToSchema)
data Person = Person { name :: String, dog :: Dog } deriving (Generic, ToSchema)

type PersonAPI
  = "person" :> ReqBody Person :> Post ()

How would we know to add Dog and Color to auto-generated swagger spec?

The solution I think should be for ToSchema to generate also a list of used definitions.

fizruk referenced this issue Dec 12, 2015
Annotate NamedSchema with used Definitions
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

No branches or pull requests

1 participant