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

Swagger paths are permutted. #54

Closed
phadej opened this issue Mar 3, 2016 · 3 comments
Closed

Swagger paths are permutted. #54

phadej opened this issue Mar 3, 2016 · 3 comments

Comments

@phadej
Copy link
Collaborator

phadej commented Mar 3, 2016

as _swaggerPaths is a HashMap, not only the order is different from what is declared (e.g. in servant API type), it's arbitrary. For machine reading, it's ok; but swagger-ui suffer from this:

screen shot 2016-03-03 at 10 54 07

I could work on this, if we agree on solution. Either we could change HashMap FilePath PathItem to Vector (FilePath, PathItem), maybe wrapped in newtype.

EDIT; That won't be easy to fix, as the paths is an object in JSON representation, yet that could be worked around in >=aeson-0.10 by using toEncoding (so one can specify an order of output!)

@fizruk
Copy link
Member

fizruk commented Mar 3, 2016

Maybe something like this?

-- | A @'HashMap'@ with an explicit ordering of the keys.
data OrdHashMap k v = OrdHashMap
  { ordHashMapKeys :: Vector k     -- ^ Explicit ordering of the keys.
  , ordHashMapMap  :: HashMap k v  -- ^ The mapping.
  }

Also, we can replace all/most of the HashMaps used in the data model.
For instance, this ordering might also be useful for Schema's properties.

@phadej
Copy link
Collaborator Author

phadej commented Mar 3, 2016

I'll take on this tomorrow/on the weekend.

@fizruk
Copy link
Member

fizruk commented Mar 29, 2016

Closed by #56.

@fizruk fizruk closed this as completed Mar 29, 2016
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

2 participants