original_docstring: Builds the csdl file from the annotated json database
docstring: Builds the csdl file from the annotated json database
docstring_tokens: Builds the csdl file from the annotated json database
code: def build_csdl_node(self, entry, key, descriptors):
          """Builds the csdl file from the annotated json database"""
          kwargs = {}
          if "description" in descriptors:
              kwargs["description"] = descriptors["description"]
          if "longDescription" in descriptors:
              kwargs["longDescription"] = descriptors["longDescription"]
          if key in RESOURCE_TYPES:
              entry.append(create_property(key, "Resource.{}".format(key)))
              return
          if "required" in descriptors:
              kwargs["required"] = True
          if "readonly" in descriptors:
              kwargs["readonly"] = False
          if "type" in descriptors:
              # JSON schema file
              kwargs["type"] = descriptors["type"]
          if "items" in descriptors:
              # JSON schema file
              kwargs["items"] = descriptors["items"]
          value = descriptors.get("value", None)
          if isinstance(value, dict) or "properties" in descriptors:
                  # kwargs["base_name"] = "Resource.%s" % key
              if "$ref" in descriptors:
                  # for jsonschema
                  pass
              if "link" in descriptors:
                  kwargs = {}
                  kwargs['schema_name'] = descriptors['link']
                  if not any([descriptors['link'] in x.attrib.get('Uri', '').split('/')[-1] for x in self.main_csdl]):
                      my_node = xml_convenience.add_reference(None, None, descriptors['link'])
                      self.main_csdl.insert(3, my_node)
                  if descriptors.get("type") == "array":
                      kwargs['collection'] = True
                  entry.append(create_navigation(key, **kwargs))
              else:
                  complex_prop = create_complex_property(key, **kwargs)
                  if descriptors.get("type") == "array":
                      entry.append(create_property(key, "Collection(%s.%s)" % (self.name, key), **kwargs))
                  else:
                      entry.append(create_property(key, "%s.%s" % (self.name, key), **kwargs))
                  for key, descriptors in descriptors["properties"].items():
                      self.build_csdl_node(complex_prop, key, descriptors)
                  self.csdl.append(complex_prop)
          elif "enum" in descriptors:
              if descriptors.get("type") == "array":
                  entry.append(create_property(key, "Collection(%s.%s)" % (self.name, key), **kwargs))
              else:
                  entry.append(create_property(key, "%s.%s" % (self.name, key), **kwargs))
              self.csdl.append(create_enum_property(key, descriptors.get("enum"), descriptors.get("enumDescriptions", None), descriptors.get("enumLongDescriptions", None)))
          else:
              entry.append(create_property_w_type(key, value, **kwargs))
code_tokens: def build_csdl_node ( self , entry , key , descriptors ) : kwargs = { } if "description" in descriptors : kwargs [ "description" ] = descriptors [ "description" ] if "longDescription" in descriptors : kwargs [ "longDescription" ] = descriptors [ "longDescription" ] if key in RESOURCE_TYPES : entry . append ( create_property ( key , "Resource.{}" . format ( key ) ) ) return if "required" in descriptors : kwargs [ "required" ] = True if "readonly" in descriptors : kwargs [ "readonly" ] = False if "type" in descriptors : kwargs [ "type" ] = descriptors [ "type" ] if "items" in descriptors : kwargs [ "items" ] = descriptors [ "items" ] value = descriptors . get ( "value" , None ) if isinstance ( value , dict ) or "properties" in descriptors : if "$ref" in descriptors : pass if "link" in descriptors : kwargs = { } kwargs [ 'schema_name' ] = descriptors [ 'link' ] if not any ( [ descriptors [ 'link' ] in x . attrib . get ( 'Uri' , '' ) . split ( '/' ) [ - 1 ] for x in self . main_csdl ] ) : my_node = xml_convenience . add_reference ( None , None , descriptors [ 'link' ] ) self . main_csdl . insert ( 3 , my_node ) if descriptors . get ( "type" ) == "array" : kwargs [ 'collection' ] = True entry . append ( create_navigation ( key , ** kwargs ) ) else : complex_prop = create_complex_property ( key , ** kwargs ) if descriptors . get ( "type" ) == "array" : entry . append ( create_property ( key , "Collection(%s.%s)" % ( self . name , key ) , ** kwargs ) ) else : entry . append ( create_property ( key , "%s.%s" % ( self . name , key ) , ** kwargs ) ) for key , descriptors in descriptors [ "properties" ] . items ( ) : self . build_csdl_node ( complex_prop , key , descriptors ) self . csdl . append ( complex_prop ) elif "enum" in descriptors : if descriptors . get ( "type" ) == "array" : entry . append ( create_property ( key , "Collection(%s.%s)" % ( self . name , key ) , ** kwargs ) ) else : entry . append ( create_property ( key , "%s.%s" % ( self . name , key ) , ** kwargs ) ) self . csdl . append ( create_enum_property ( key , descriptors . get ( "enum" ) , descriptors . get ( "enumDescriptions" , None ) , descriptors . get ( "enumLongDescriptions" , None ) ) ) else : entry . append ( create_property_w_type ( key , value , ** kwargs ) )
short_docstring: Builds the csdl file from the annotated json database
short_docstring_tokens: Builds the csdl file from the annotated json database
comment: """Builds the csdl file from the annotated json database"""$SEP$# JSON schema file$SEP$# JSON schema file$SEP$# kwargs["base_name"] = "Resource.%s" % key$SEP$# for jsonschema