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

missing properties are not set to default when unmarshalled #153

Closed
dpopowich opened this issue Feb 23, 2017 · 0 comments
Closed

missing properties are not set to default when unmarshalled #153

dpopowich opened this issue Feb 23, 2017 · 0 comments

Comments

@dpopowich
Copy link

If I have an object which I specify as a "in": "body" parameter for a PUT or POST with properties that have default set, e.g:

"parameters": [
   {
      "required": true,
      "in": "body",
      "name": "body",
      "schema": {
         "type": "object",
         "properties": {
            "name": {
               "type": "string",
            },
            "count": {
               "type": "integer",
               "default": 0
            }
         }
      }
   }, ...
]

The default is ignored for missing parameters, e.g, with the following JSON body request:

{
   "name": "Phred"
}

The output is:

{
   "name": "Phred",
   "count": None
}

I'd expect it to be:

{
   "name": "Phred",
   "count": 0
}

Note: x-nullable has no effect here: default is ignored regardless of the x-nullable setting when the property is missing and the value is set to None.

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

1 participant