[Python] How to make a payload optional for a PUT request in Swagger Dcoumentation

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    Hi I have a model here I created that I want to make optional in swagger doc for my PUT request

    test_model = api.model('test', {
    'test_field': fields.List(
    fields.Integer,
    required=False,
    description='general description',
    default=[]
    )
    })


    I have then use the 2 API functions for my PUT Request

    @api.expect(test_model, validate=True)
    @api.doc(description="general desc")


    If someone could point out what I'm doing wrong here or how to make it optional I would be very appreciative.

    Continue reading...

Compartilhe esta Página