Skip to content

Open API

validate_swagger(context)

Check that generated open_api spec is valid.

It creates spec file in ./tmp folder and then validates it.

Source code in saritasa_invocations/open_api.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
@invoke.task
def validate_swagger(context: invoke.Context) -> None:
    """Check that generated open_api spec is valid.

    It creates spec file in ./tmp folder and then validates it.

    """
    printing.print_success("Validating OpenAPI spec")
    system.create_tmp_folder(context)
    django.manage(
        context,
        "spectacular --file .tmp/schema.yaml --validate --fail-on-warn",
    )