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

ToSchema instance of NominalDiffTime doesn't match the description in Data.Time.Clock #99

Closed
fierce-katie opened this issue Apr 21, 2017 · 3 comments

Comments

@fierce-katie
Copy link
Contributor

There's the following instance:

instance ToSchema NominalDiffTime where
  declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy Integer)

Meanwhile time documentation says :

This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s.

It leads to unexpected errors when I try to validate ToJSON matches ToSchema:

>>> validateToJSON (10::NominalDiffTime)
[]
>>> validateToJSON (10.1::NominalDiffTime)
["not an integer"]
@fizruk
Copy link
Member

fizruk commented Apr 21, 2017

Indeed. We need to add ToSchema and ToParamSchema instances for Fixed.
Then we can redefine ToSchema instance for NominalDiffTime in terms of Pico (which is a type synonym for Fixed E12).

@fierce-katie
Copy link
Contributor Author

Isn't it fixed already (see #121)?

@fierce-katie
Copy link
Contributor Author

Fixed in swagger2-2.1.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants