How to use the apispec.utils.OpenAPIVersion function in apispec

To help you get started, we’ve selected a few apispec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marshmallow-code / apispec / tests / test_utils.py View on Github external
def test_openapi_version_invalid_version(self, version):
        message = "Not a valid OpenAPI version number:"
        with pytest.raises(APISpecError, match=message):
            utils.OpenAPIVersion(version)
github marshmallow-code / apispec / tests / test_utils.py View on Github external
    @pytest.mark.parametrize("version", ("3.0.1", utils.OpenAPIVersion("3.0.1")))
    def test_openapi_version_string_or_openapi_version_param(self, version):
        assert utils.OpenAPIVersion(version) == utils.OpenAPIVersion("3.0.1")
github marshmallow-code / apispec / tests / test_utils.py View on Github external
def test_openapi_version_string_or_openapi_version_param(self, version):
        assert utils.OpenAPIVersion(version) == utils.OpenAPIVersion("3.0.1")
github marshmallow-code / apispec / tests / test_utils.py View on Github external
def test_openapi_version_digits(self):
        ver = utils.OpenAPIVersion("3.0.1")
        assert ver.major == 3
        assert ver.minor == 0
        assert ver.patch == 1
        assert ver.vstring == "3.0.1"
        assert str(ver) == "3.0.1"
github tribe29 / checkmk / cmk / gui / plugins / openapi / restful_objects / specification.py View on Github external
'name': 'Request Schemas',
            'tags': []
        },
    ],
    'x-ignoredHeaderParameters': [
        'User-Agent',
        'X-Test-Header',
    ],
    'security': [{
        'BearerAuth': []
    }]
}

SPEC = apispec.APISpec("Checkmk REST API",
                       "0.3.2",
                       apispec.utils.OpenAPIVersion("3.0.2"),
                       plugins=[
                           plugins.ValueTypedDictMarshmallowPlugin(),
                           apispec_oneofschema.MarshmallowPlugin(),
                       ],
                       **OPTIONS)
SPEC.components.security_scheme(
    'BearerAuth',
    {
        'type': 'http',
        'scheme': 'bearer',
        'in': 'header',
        'description': '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',
    },
github marshmallow-code / apispec / src / apispec / ext / marshmallow / openapi.py View on Github external
def __init__(self, openapi_version, schema_name_resolver, spec):
        self.openapi_version = OpenAPIVersion(openapi_version)
        self.schema_name_resolver = schema_name_resolver
        self.spec = spec
        self.init_attribute_functions()
        # Schema references
        self.refs = {}