Asterisk - The Open Source Telephony Project GIT-master-f36a736
Public Member Functions | Data Fields | Static Public Attributes
ResourceListing Class Reference
Inheritance diagram for ResourceListing:
Inheritance graph
[legend]
Collaboration diagram for ResourceListing:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self)
 
def load (self, resources_json, processor, context)
 
def load_file (self, resource_file, processor)
 
- Public Member Functions inherited from Stringify
def __repr__ (self)
 

Data Fields

 api_version
 
 apis
 
 base_path
 
 swagger_version
 

Static Public Attributes

list required_fields = ['apiVersion', 'basePath', 'apis']
 

Detailed Description

Model of Swagger's resources.json file.

Definition at line 718 of file swagger_model.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Definition at line 724 of file swagger_model.py.

724 def __init__(self):
725 self.swagger_version = None
726 self.api_version = None
727 self.base_path = None
728 self.apis = None
729

Member Function Documentation

◆ load()

def load (   self,
  resources_json,
  processor,
  context 
)

Definition at line 745 of file swagger_model.py.

745 def load(self, resources_json, processor, context):
746 # If the version doesn't match, all bets are off.
747 self.swagger_version = resources_json.get('swaggerVersion')
748 if not self.swagger_version in SWAGGER_VERSIONS:
749 raise SwaggerError(
750 "Unsupported Swagger version %s" % self.swagger_version, context)
751
752 validate_required_fields(resources_json, self.required_fields, context)
753 self.api_version = resources_json['apiVersion']
754 self.base_path = resources_json['basePath']
755 apis_json = resources_json['apis']
756 self.apis = [
757 ResourceApi().load(j, processor, context) for j in apis_json]
758 processor.process_resource_listing(self, context)
759 return self
760
761
def validate_required_fields(json, required_fields, context)

References ApiDeclaration.api_version, ResourceListing.api_version, ApiDeclaration.apis, ResourceListing.apis, ApiDeclaration.base_path, ResourceListing.base_path, ResourceListing.load(), Parameter.required_fields, ErrorResponse.required_fields, Operation.required_fields, Api.required_fields, Property.required_fields, Model.required_fields, ApiDeclaration.required_fields, ResourceApi.required_fields, ResourceListing.required_fields, ParsingContext.swagger_version, ApiDeclaration.swagger_version, ResourceListing.swagger_version, and swagger_model.validate_required_fields().

Referenced by ResourceListing.load(), ApiDeclaration.load_file(), and ResourceListing.load_file().

◆ load_file()

def load_file (   self,
  resource_file,
  processor 
)

Definition at line 730 of file swagger_model.py.

730 def load_file(self, resource_file, processor):
731 context = ParsingContext(None, [resource_file])
732 try:
733 return self.__load_file(resource_file, processor, context)
734 except SwaggerError:
735 raise
736 except Exception as e:
737 print("Error: ", traceback.format_exc(), file=sys.stderr)
738 raise SwaggerError(
739 "Error loading %s" % resource_file, context, e)
740
static int load_file(const char *filename, char **ret)
Read a TEXT file into a string and return the length.

References ApiDeclaration.__load_file(), ResourceListing.__load_file(), ApiDeclaration.load(), Api.load(), ResourceApi.load(), ErrorResponse.load(), Model.load(), Operation.load(), Parameter.load(), Property.load(), ResourceListing.load(), SwaggerType.load(), ast_speech_engine.load, ast_sorcery_wizard.load, and ast_module_info.load.

Field Documentation

◆ api_version

api_version

Definition at line 726 of file swagger_model.py.

Referenced by ApiDeclaration.load(), and ResourceListing.load().

◆ apis

apis

Definition at line 728 of file swagger_model.py.

Referenced by ResourceListing.load().

◆ base_path

base_path

Definition at line 727 of file swagger_model.py.

Referenced by ApiDeclaration.load(), and ResourceListing.load().

◆ required_fields

list required_fields = ['apiVersion', 'basePath', 'apis']
static

◆ swagger_version

swagger_version

The documentation for this class was generated from the following file: