Exemple #1
0
            plugins.ValueTypedDictMarshmallowPlugin(),
            apispec_oneofschema.MarshmallowPlugin(),
        ],
        **options,
    )


SPEC = make_spec(options=OPTIONS)
for sec_scheme_name, sec_scheme_spec in SECURITY_SCHEMES.items():
    SPEC.components.security_scheme(sec_scheme_name, sec_scheme_spec)

# All the supported response headers by the spec.

# response_headers = {
#     'Allow',
#     'Cache-Control',
#     'Last-Modified',
#     'Warning',
#     'Content-Type',
# }
for header_name, field in ACCEPT_HEADER.items():
    SPEC.components.parameter(
        header_name,
        'header',
        to_openapi([{
            header_name: field
        }], 'header')[0],
    )

ErrorType = Literal['ignore', 'raise']
Exemple #2
0
        'The format of the header-value is "Bearer $automation_user '
        '$automation_user_password"\n\nExample: `Bearer hansdampf miezekatze123`',
        'bearerFormat':
        'username password',
        'x-bearerInfoFunc':
        'cmk.gui.wsgi.auth.bearer_auth',
    },
)

# All the supported response headers by the spec.

# response_headers = {
#     'Allow',
#     'Cache-Control',
#     'Last-Modified',
#     'Warning',
#     'Content-Type',
# }
SPEC.components.parameter(*ACCEPT_HEADER.spec_tuple())
SPEC.components.parameter(*IDENT.spec_tuple())
SPEC.components.parameter(*HOSTNAME.spec_tuple())
SPEC.components.parameter(*NAME.spec_tuple())


def add_operation(path, method, operation_spec):
    """Add an operation spec to the SPEC object.

    """
    # TODO: check if path method combination already there, if not raise exception
    SPEC.path(path=path, operations={method.lower(): operation_spec})