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

one more allOf and additionalProperties question #137

Open
Ognian opened this issue Mar 27, 2014 · 4 comments
Open

one more allOf and additionalProperties question #137

Ognian opened this issue Mar 27, 2014 · 4 comments

Comments

@Ognian
Copy link
Contributor

Ognian commented Mar 27, 2014

I want to to have a resulting schema like:

properties:{
   "a":{...}
   "b":{...}
   "c":{...}
   "d":{...}
},
additionalProperties": false

but "a"and "b" shall be defined via a "$ref"

among many other things I tried was:

"allOf": [
                {
                    "$ref": "/aAndBDef"
                }
],
 "properties": {
    "c":{...}
    "d":{...}
   },

 "additionalProperties": false

but without success, because the last "additionalProperties":false conflicts with the allOf. But the only way to "join" properties is via allOf. Keep in mind that omitting "additionalProperties":false leads to the appearance of the + new button in jsonary...

Please help...

@geraintluff
Copy link
Contributor

"additionalProperties":false is evaluated against the property definitions in properties/patternProperties.

In your second example, only "c" and "d" are defined, so according to the schema, "a" and "b" are not allowed. You'll need stub entries (e.g. "a":{}, "b":{}) to keep them permitted.

@geraintluff
Copy link
Contributor

Perhaps there should be some kind of flag you could set, that removed the + new option from all objects unless additionalProperties was explicitly set to true...

@Ognian
Copy link
Contributor Author

Ognian commented Mar 27, 2014

are you planning something new in v5? I've seen that someone was suggesting a patch possibility?
Stub entries are no solution for me, maybe the flag (Jsonary property) solution ...

@Ognian
Copy link
Contributor Author

Ognian commented Mar 27, 2014

Actually the flag would mean that additionalProperties: has 3 values true, false,null where the default value is null

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