How to use the apispec.ext.marshmallow.common.resolve_schema_instance 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_ext_marshmallow.py View on Github external
def resolver(schema):
            schema_instance = common.resolve_schema_instance(schema)
            prefix = "Partial-" if schema_instance.partial else ""
            schema_cls = common.resolve_schema_cls(schema)
            name = prefix + schema_cls.__name__
            if name.endswith("Schema"):
                return name[:-6] or name
            return name
github tribe29 / checkmk / cmk / gui / plugins / openapi / plugins.py View on Github external
def load(self, data, many=None, partial=None):
        if not isinstance(data, dict):
            return UnmarshalResult({}, {'_schema': 'Invalid data type: %s' % data})

        schema = common.resolve_schema_instance(self.value_type)
        res = []
        for key, value in data.items():
            payload = value.copy()
            payload[self.key_name] = key
            result = schema.load(payload)
            res.append(result.data)

        return UnmarshalResult(res, [])