def _resolve_definitions(self, schema, definitions):
        """Interpolates definitions from the top-level definitions key into the
        schema. This is performed in a cut-down way similar to JSON schema.
        """
        if not definitions:
            return schema

        if not isinstance(schema, dict):
            return schema

        ref = schema.pop('$ref', None)
        if ref:
            path = ref.split('/')[2:]
            definition = definitions
            for component in path:
                definition = definitions[component]

            if definition:
                # Only update specified fields
                for (key, val) in six.iteritems(definition):
                    if key not in schema:
                        schema[key] = val

        for key in six.iterkeys(schema):
            schema[key] = self._resolve_definitions(schema[key], definitions)

        return schema
def _resolve_definitions ( self , schema , definitions ) : if not definitions : return schema if not isinstance ( schema , dict ) : return schema ref = schema . pop ( '$ref' , None ) if ref : path = ref . split ( '/' ) [ 2 : ] definition = definitions for component in path : definition = definitions [ component ] if definition : for ( key , val ) in six . iteritems ( definition ) : if key not in schema : schema [ key ] = val for key in six . iterkeys ( schema ) : schema [ key ] = self . _resolve_definitions ( schema [ key ] , definitions ) return schema
Interpolates definitions from the top-level definitions key into the
        schema. This is performed in a cut-down way similar to JSON schema.