Esempio n. 1
0
    def parse(self, super_type, plugins, resource_base, data_types,
              namespaces_mapping):
        relationship_type = self.build_dict_result()
        if not relationship_type.get('derived_from'):
            relationship_type.pop('derived_from', None)
        relationship_type_name = self.name

        if super_type:
            relationship_type[constants.PROPERTIES] = utils.merge_schemas(
                overridden_schema=super_type.get('properties', {}),
                overriding_schema=relationship_type.get('properties', {}),
                data_types=data_types)
            for interfaces in [
                    constants.SOURCE_INTERFACES, constants.TARGET_INTERFACES
            ]:
                relationship_type[interfaces] = interfaces_parser. \
                    merge_relationship_type_interfaces(
                        overriding_interfaces=relationship_type[interfaces],
                        overridden_interfaces=super_type[interfaces])

        _validate_relationship_fields(
            rel_obj=relationship_type,
            plugins=plugins,
            rel_name=relationship_type_name,
            resource_base=resource_base,
            remote_resources_namespaces=namespaces_mapping)
        relationship_type['name'] = relationship_type_name
        relationship_type[
            constants.TYPE_HIERARCHY] = self.create_type_hierarchy(super_type)
        self.fix_properties(relationship_type)
        return relationship_type
    def parse(self, super_type, plugins, resource_base, data_types):
        relationship_type = self.build_dict_result()
        if not relationship_type.get('derived_from'):
            relationship_type.pop('derived_from', None)
        relationship_type_name = self.name

        if super_type:
            relationship_type[constants.PROPERTIES] = utils.merge_schemas(
                overridden_schema=super_type.get('properties', {}),
                overriding_schema=relationship_type.get('properties', {}),
                data_types=data_types)
            for interfaces in [constants.SOURCE_INTERFACES,
                               constants.TARGET_INTERFACES]:
                relationship_type[interfaces] = interfaces_parser. \
                    merge_relationship_type_interfaces(
                        overriding_interfaces=relationship_type[interfaces],
                        overridden_interfaces=super_type[interfaces])

        _validate_relationship_fields(
            rel_obj=relationship_type,
            plugins=plugins,
            rel_name=relationship_type_name,
            resource_base=resource_base)
        relationship_type['name'] = relationship_type_name
        relationship_type[
            constants.TYPE_HIERARCHY] = self.create_type_hierarchy(super_type)
        self.fix_properties(relationship_type)
        return relationship_type
Esempio n. 3
0
 def parse(self, super_type, component_types):
     merged_component_types = {}
     for component in component_types:
         merged_component_types.update(component)
     self.component_types.update(merged_component_types)
     result = self.build_dict_result()
     if constants.PROPERTIES not in result:
         result[constants.PROPERTIES] = {}
     if super_type:
         result[constants.PROPERTIES] = utils.merge_schemas(
             overridden_schema=super_type.get('properties', {}),
             overriding_schema=result.get('properties', {}),
             data_types=merged_component_types)
     self.fix_properties(result)
     self.component_types[self.name] = result
     return result
Esempio n. 4
0
 def parse(self, super_type, component_types):
     merged_component_types = {}
     for component in component_types:
         merged_component_types.update(component)
     self.component_types.update(merged_component_types)
     result = self.build_dict_result()
     if constants.PROPERTIES not in result:
         result[constants.PROPERTIES] = {}
     if super_type:
         result[constants.PROPERTIES] = utils.merge_schemas(
             overridden_schema=super_type.get('properties', {}),
             overriding_schema=result.get('properties', {}),
             data_types=merged_component_types)
     self.fix_properties(result)
     self.component_types[self.name] = result
     return result
Esempio n. 5
0
 def parse(self, super_type, data_types):
     node_type = self.build_dict_result()
     if not node_type.get('derived_from'):
         node_type.pop('derived_from', None)
     if super_type:
         node_type[constants.PROPERTIES] = utils.merge_schemas(
             overridden_schema=super_type.get('properties', {}),
             overriding_schema=node_type.get('properties', {}),
             data_types=data_types)
         node_type[constants.INTERFACES] = interfaces_parser. \
             merge_node_type_interfaces(
                 overridden_interfaces=super_type[constants.INTERFACES],
                 overriding_interfaces=node_type[constants.INTERFACES])
     node_type[constants.TYPE_HIERARCHY] = self.create_type_hierarchy(
         super_type)
     self.fix_properties(node_type)
     return node_type
 def parse(self, super_type, data_types):
     node_type = self.build_dict_result()
     if not node_type.get('derived_from'):
         node_type.pop('derived_from', None)
     if super_type:
         node_type[constants.PROPERTIES] = utils.merge_schemas(
             overridden_schema=super_type.get('properties', {}),
             overriding_schema=node_type.get('properties', {}),
             data_types=data_types)
         node_type[constants.INTERFACES] = interfaces_parser. \
             merge_node_type_interfaces(
                 overridden_interfaces=super_type[constants.INTERFACES],
                 overriding_interfaces=node_type[constants.INTERFACES])
     node_type[constants.TYPE_HIERARCHY] = self.create_type_hierarchy(
         super_type)
     self.fix_properties(node_type)
     return node_type