-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add OrdHashMap #56
Add OrdHashMap #56
Conversation
@phadej are the keys permuted in the produced |
a04078a
to
0b521f5
Compare
@fizruk they seem to be permuted in in JSON file already. I actually checked with I added few tests for I'll check this later today still, comment if you might now the issue from top of your head. EDIT there is few |
@phadej you did not change You have only changed |
808f2ea
to
fe27a30
Compare
Seems that keys are inserted from last to first in generics: EDIT1 instance (GToSchema f, GToSchema g) => GToSchema (f :*: g) where
gdeclareNamedSchema opts _ schema = do
NamedSchema _ gschema <- gdeclareNamedSchema opts (Proxy :: Proxy g) schema
gdeclareNamedSchema opts (Proxy :: Proxy f) gschema what is the reason that EDIT2, if i change the order, then |
I think the main reason is to produce a correct order of fields for non-record product types. Feel free to change the |
@fizruk I cleaned up the implementation, and tests are green now. Now the schema building is not-so-performant looking, but is less-quirky, which I think is more important in this domain. To remember: This is breaking change. Could we merge this but not yet release
EDIT: |
& enum_ ?~ map toJSON (schema ^.. properties.ifolded.asIndex) | ||
& enum_ ?~ map toJSON' (schema ^.. properties.ifolded.asIndex) | ||
|
||
-- TODO: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this TODO about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remember to remove toJSON'
- had to add explicit type it to get better error message. It's done now.
@phadej can you rebase so I can make a clean merge? Performance is indeed not a big concern for this project. Yes, I can wait with the release.
You should then see a nice diff. |
6375a78
to
3b277e7
Compare
The properties are now sorted, but I don't know why paths are still unsorted in ui. |
@phadej are paths sorted in JSON? |
They are, but unsorted. The issue might be in |
Sorry, can't parse :) |
Ah sorry. paths are unsorted in json, haven't checked the |
@phadej paths in |
Hmm, looks like the |
Found an issue why But to fix that, one would need to do a bit (or maybe quite al lot) of generics work. I'll see if I have the time during the week to try to do it. |
@fizruk https://github.com/phadej/insert-ordered-containers Would be nice if you could review the package, before I release it to Hackage |
4a19aaa
to
b94cc13
Compare
@@ -482,7 +555,7 @@ data Schema = Schema | |||
, _schemaRequired :: [ParamName] | |||
|
|||
, _schemaAllOf :: Maybe [Schema] | |||
, _schemaProperties :: HashMap Text (Referenced Schema) | |||
, _schemaProperties :: Definitions (Referenced Schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitions
is for definitions that are then used with $ref
.
Properties are hence not Definitions
, but InsOrdHashMap Text
.
Changed properties. |
- make checkDefs stricter (tests) - add multiple-fields tests
ping @fizruk. Rebased the branch. |
@phadej sorry, I didn't have enough time to go through this PR in detail. I am going to merge this now and apply fixes later if at all. |
I'm not in hurry, just checking this isn't forgotten :) |
@phadej it's not forgotten, I had a glance over it before and was going to look more closely later, but got buried in work :) |
I tried with our up,
servant-swagger
compiled fine; yet the keys seems to be still permuted in UI. Have to investigate still.