-
Notifications
You must be signed in to change notification settings - Fork 38
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
Incorrect JSON generated from in 3.0 alpha 4 #256
Comments
Just looked in more detail and it appears that it's being serialised this way in both alpha 1 and 4, but alpha 4 is failing when attempting to read it again with:
|
What it looks like is happening here is actually that Swift is quietly picking the variadic version of the The following should get you what you want: JSONSchema.string(required: false, allowedValues: "ONE", "TWO") Alternatively, defining the allowed values as a variable ahead of time should give the type system enough information to pick the correct function, but it's possible it still confuses it, which would mean the variadic version is more dangerous than helpful. This confusing situation is also partly because
It's not on hold per-se, but development is happening sporadically (by me) at infrequent intervals. I've been meaning to tackle a few more of the remaining issues recently but I keep getting distracted or pulled away from it when I get the time! I still fully plan to eventually release version 3.0, but admittedly I am resting on the laurels that OpenAPIKit is relatively complete at version v2 and relatively stable at v3 alpha 4. I'm always interested in new contributors, too! |
Ah that makes sense, thank you for the very swift investigation and explanation. I wish I had time to contribute to the project more directly, but sadly life has other plans! |
Hello! I recently resurrected a project from last year on 3.0. alpha 1 (which included a fix I needed for handling optionals) and moved to 3.0 alpha 4.
On alpha 4 the following appears to be nesting the allowed values an additional level when serialised:
JSONSchema.string(required: false, allowedValues: ["ONE", "TWO"])
i.e.
As an aside, I guess 3.0 development is on hold for now? (I appreciate this is open source and have no expectations, I'm just curious!)
The text was updated successfully, but these errors were encountered: