Skip to content

dump_only is ignored in nested schemas for parameters #82

@incognick

Description

@incognick

Given the following:

class ParentSchema(Schema):
    id = fields.Int(dump_only=True)
    name = fields.String()
    child = fields.Nested('ChildSchema')

class ChildSchema(Schema):
    id = fields.Int(dump_only=True)
    name = fields.String()

The parameter spec is generated:

"parameters": [
  {
    "in": "body", 
    "name": "body", 
    "required": false, 
    "schema": {
      "properties": {
        "child": {
          "properties": {
            "id": {
              "format": "int32", 
              "type": "integer"
            }, 
            "name": {
              "type": "string"
            }
          }, 
          "type": "object"
        }, 
        "name": {
          "type": "string"
        }
      }, 
      "type": "object"
    }
  }
]

The Parent "id" is omitted but the Child "id" remains.

Will submit a PR on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions