Model class for an API Declaration.
See https://github.com/wordnik/swagger-core/wiki/API-Declaration
Definition at line 596 of file swagger_model.py.
def load |
( |
|
self, |
|
|
|
api_decl_json, |
|
|
|
processor, |
|
|
|
context |
|
) |
| |
Loads a resource from a single Swagger resource.json file.
Definition at line 643 of file swagger_model.py.
References ApiDeclaration.api_version, ApiDeclaration.apis, ApiDeclaration.author, ApiDeclaration.base_path, ApiDeclaration.copyright, Api.has_websocket, ApiDeclaration.has_websocket, ApiDeclaration.models, Parameter.required_fields, ErrorResponse.required_fields, Operation.required_fields, Api.required_fields, Property.required_fields, Model.required_fields, ApiDeclaration.required_fields, ApiDeclaration.requires_modules, ApiDeclaration.resource_path, ParsingContext.swagger_version, and ApiDeclaration.swagger_version.
643 def load(self, api_decl_json, processor, context):
644 """Loads a resource from a single Swagger resource.json file.
655 self.
author = api_decl_json.get(
'_author')
656 self.
copyright = api_decl_json.get(
'_copyright')
658 self.
base_path = api_decl_json.get(
'basePath')
661 api_json = api_decl_json.get(
'apis')
or []
663 Api().
load(j, processor, context)
for j
in api_json]
665 for api
in self.
apis:
666 if api.path
in paths:
667 raise SwaggerError(
"API with duplicated path: %s" % api.path, context)
670 models = api_decl_json.get(
'models').items()
or []
672 for (id, json)
in models]
675 model_dict = dict((m.id, m)
for m
in self.
models)
677 def link_subtype(name):
678 res = model_dict.get(name)
682 res.set_extends_type(m)
685 m.set_subtype_types([
686 link_subtype(subtype)
for subtype
in m.subtypes])
def load(self, api_decl_json, processor, context)