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

additionalProperties would be nice #7

Open
davek2 opened this issue Feb 20, 2016 · 4 comments
Open

additionalProperties would be nice #7

davek2 opened this issue Feb 20, 2016 · 4 comments

Comments

@davek2
Copy link
Contributor

davek2 commented Feb 20, 2016

The project description says:
3. The generated schema should be as strict as possible given the first 2 rules.

In order to meet that goal, schemas of type "object" should include an "additionalProperties" property. If the user generates a schema exclusively from json instances then this would always be false. If the user imports a schema with it true (by default or explicitly), then the true would take precedence over an instance-derived false without generating a conflict. Two schemas with opposite values would generate a conflct.

@wolverdude
Copy link
Owner

true in this case would always trump false because the generator is intentionally designed to be permissive. Even so, there is a note in the next section about the subset of json-schema this library is intended to deal with. If I have time soon, I'll update the readme to make this a little more clear.

@davek2
Copy link
Contributor Author

davek2 commented Mar 13, 2016

The readme is already quite clear that the package deals with only 4 keywords. The question is whether the number could be 5, 6, or 7 without violating the design tenets "uses a small subset of JSON Schema's capabilities", "does not try to guess user's data model", and "installs without dependencies". jsonschema.net supports user options to control generation without doing any guessing.

I can submit a pull that adds support for additional properties, additional items, and merge properties, all controlled by user options as with the current merge arrays option. It also fixes a bug in merge arrays. But I won't bother if you consider "4 keywords" to be one of the design tenets.

@wolverdude
Copy link
Owner

If it would be helpful to users, I'm all for it. TBH, I haven't had an occasion to work with JSON Schema in a while, so I feel a little out of touch with the pulse, but I'd love to get an updated version out there. I'll try to get to your PR soon, though it's not as high priority as the bug fixes.

@YehudaCorsia
Copy link
Contributor

Hey, i try to find the way to enter this.
if you can help me to find the best way its will be helpfull :-)

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

3 participants