Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

additionalProperties is not respected unless it is an object #34

Open
saml opened this issue Oct 8, 2014 · 1 comment
Open

additionalProperties is not respected unless it is an object #34

saml opened this issue Oct 8, 2014 · 1 comment

Comments

@saml
Copy link
Contributor

saml commented Oct 8, 2014

If my schema specifies:

{
  "properties": {
    "any-object": {
         "type": "object",
         "properties": {},
         "required": true,
         "additionalProperties": true
     }
   }
}

The following data is considered invalid:

{"any-object": {"a":1}}

Probably due to the following line (current master):

additionalProperties: if _.isObject(model.additionalProperties) then model.additionalProperties else false

convertModel = (models, model, _stack) ->
  result = {
    properties: {}
    additionalProperties: if _.isObject(model.additionalProperties) then model.additionalProperties else false
  }

Not sure why model.additionalProperties is checked if it's an object or not.

@saml
Copy link
Contributor Author

saml commented Oct 8, 2014

As a short term solution, I can specify my schema as:

{
  "properties": {
    "any-object": {
         "type": "object",
         "properties": {},
         "required": true,
         "additionalProperties": {"foobar": true}
     }
   }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant