Esempio n. 1
0
    def reconstruct(cls, resource, description):
        description['schema'] = Field.reconstruct(description['schema'])
        for status, response in description['responses'].items():
            response['schema'] = Field.reconstruct(response['schema'])
            description['responses'][status] = Response(**response)

        return cls(resource, **description)
Esempio n. 2
0
    def reconstruct(cls, resource, description):
        description['schema'] = Field.reconstruct(description['schema'])
        for status, response in description['responses'].items():
            response['schema'] = Field.reconstruct(response['schema'])
            description['responses'][status] = Response(**response)

        return cls(resource, **description)
Esempio n. 3
0
    def _parse_resource(self, resource):
        schema = resource.get('schema')
        if isinstance(schema, dict):
            for name, field in schema.items():
                schema[name] = Field.reconstruct(field)

        requests = resource.get('requests')
        if isinstance(requests, dict):
            for request in requests.itervalues():
                request['schema'] = Field.reconstruct(request['schema'])
                for response in request['responses'].itervalues():
                    response['schema'] = Field.reconstruct(response['schema'])
Esempio n. 4
0
    def _parse_resource(self, resource):
        schema = resource.get('schema')
        if isinstance(schema, dict):
            for name, field in schema.items():
                schema[name] = Field.reconstruct(field)

        requests = resource.get('requests')
        if isinstance(requests, dict):
            for request in requests.itervalues():
                request['schema'] = Field.reconstruct(request['schema'])
                for response in request['responses'].itervalues():
                    response['schema'] = Field.reconstruct(response['schema'])