[Python] Flasgger schema definition doesn't show in swagger-ui when using openapi 3.0.2

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

  1. Stack

    Stack Membro Participativo

    I have an endpoint defined as such:

    def process_document():
    """
    Process document
    ---
    definitions:
    JobSubmissionResponse:
    type: object
    properties:
    job_id:
    type: string
    description: Job ID
    responses:
    500:
    description: Fatal Error Occurred
    200:
    description: Job submitted successfully
    schema:
    type: object
    properties:
    job_id:
    type: string
    description: Job ID
    """
    job_id = uuid.uuid4()
    return jsonify({
    "job_id": job_id,
    })


    When I use Open API 3.0.2, as such:


    app.config['SWAGGER'] = {
    'title': 'MyApp',
    'openapi': '3.0.2'
    }


    The Swagger-UI does not display the schema within the return type:

    [​IMG]

    If I do not specify OpenAPI 3.0.2, it works fine:

    [​IMG]

    Was that method of referencing a schema deprecated in OpenAPI 3.0.2?

    thank you

    Continue reading...

Compartilhe esta Página