1from apispec.utils import build_reference 2 3 4# Getter functions are copied from apispec tests 5 6def get_schemas(spec): 7 if spec.openapi_version.major < 3: 8 return spec.to_dict()["definitions"] 9 return spec.to_dict()["components"]["schemas"] 10 11 12def get_responses(spec): 13 if spec.openapi_version.major < 3: 14 return spec.to_dict()["responses"] 15 return spec.to_dict()["components"]["responses"] 16 17 18def build_ref(spec, component_type, obj): 19 return build_reference(component_type, spec.openapi_version.major, obj) 20