diff --git a/.github/workflows/schematic-api-ci.yml b/.github/workflows/schematic-api-ci.yml index a961ab7fb6..7cdc33f8cf 100644 --- a/.github/workflows/schematic-api-ci.yml +++ b/.github/workflows/schematic-api-ci.yml @@ -125,4 +125,4 @@ jobs: && nx affected --target=test-all" - name: Remove the dev container - run: docker rm -f sage_devcontainer + run: docker rm -f sage_devcontainer \ No newline at end of file diff --git a/apps/schematic/api/.openapi-generator/FILES b/apps/schematic/api/.openapi-generator/FILES index 42b7ef516d..f1a97c4aa9 100644 --- a/apps/schematic/api/.openapi-generator/FILES +++ b/apps/schematic/api/.openapi-generator/FILES @@ -12,32 +12,35 @@ schematic_api/models/__init__.py schematic_api/models/asset_type.py schematic_api/models/base_model_.py schematic_api/models/basic_error.py -schematic_api/models/connected_nodes.py -schematic_api/models/connected_nodes_page.py -schematic_api/models/connected_nodes_page_all_of.py -schematic_api/models/dataset.py -schematic_api/models/datasets_page.py -schematic_api/models/datasets_page_all_of.py -schematic_api/models/file.py -schematic_api/models/files_page.py -schematic_api/models/files_page_all_of.py -schematic_api/models/manifest.py +schematic_api/models/connected_node_pair.py +schematic_api/models/connected_node_pair_array.py +schematic_api/models/connected_node_pair_page.py +schematic_api/models/connected_node_pair_page_all_of.py +schematic_api/models/dataset_metadata.py +schematic_api/models/dataset_metadata_array.py +schematic_api/models/dataset_metadata_page.py +schematic_api/models/dataset_metadata_page_all_of.py +schematic_api/models/file_metadata.py +schematic_api/models/file_metadata_array.py +schematic_api/models/file_metadata_page.py +schematic_api/models/file_metadata_page_all_of.py +schematic_api/models/manifest_metadata.py +schematic_api/models/manifest_metadata_array.py +schematic_api/models/manifest_metadata_page.py +schematic_api/models/manifest_metadata_page_all_of.py schematic_api/models/manifest_validation_result.py -schematic_api/models/manifests_page.py -schematic_api/models/manifests_page_all_of.py schematic_api/models/node.py -schematic_api/models/node_properties_page.py -schematic_api/models/node_properties_page_all_of.py -schematic_api/models/node_property.py -schematic_api/models/nodes_page.py -schematic_api/models/nodes_page_all_of.py +schematic_api/models/node_array.py +schematic_api/models/node_page.py +schematic_api/models/node_page_all_of.py +schematic_api/models/node_property_array.py schematic_api/models/page_metadata.py -schematic_api/models/project.py -schematic_api/models/projects_page.py -schematic_api/models/projects_page_all_of.py +schematic_api/models/project_metadata.py +schematic_api/models/project_metadata_array.py +schematic_api/models/project_metadata_page.py +schematic_api/models/project_metadata_page_all_of.py schematic_api/models/validation_rule.py -schematic_api/models/validation_rules_page.py -schematic_api/models/validation_rules_page_all_of.py +schematic_api/models/validation_rule_array.py schematic_api/openapi/openapi.yaml schematic_api/test/__init__.py schematic_api/typing_utils.py diff --git a/apps/schematic/api/schematic_api/controllers/paging.py b/apps/schematic/api/schematic_api/controllers/paging.py new file mode 100644 index 0000000000..9e87502a82 --- /dev/null +++ b/apps/schematic/api/schematic_api/controllers/paging.py @@ -0,0 +1,97 @@ +"""Functionality to handle paginated endpoints""" + +import math +from typing import TypeVar + +ITEM_TYPE = TypeVar("ITEM_TYPE") +TOTAL_ITEMS_MSG = "total_items must be 0 or greater: " +PAGE_MAX_ITEMS_MSG = "page_max_items must be 1 or greater: " +PAGE_NUMBER_MSG = "page_number must be 1 or greater: " + + +class Page: + """This represents a page for a generic list of items for a paginated endpoint""" + + def __init__( + self, items: list[ITEM_TYPE], page_number: int = 1, page_max_items: int = 100000 + ) -> None: + """ + Args: + items (list[ITEM_TYPE]): A list of all items in the query + page_number (int, optional): The page number the current request is for. Defaults to 1. + page_max_items (int, optional): The maximum number of items per page. Defaults to 100000. + """ + self.page_number = page_number + self.page_max_items = page_max_items + self.total_items = len(items) + self.total_pages = get_page_amount(self.total_items, page_max_items) + self.has_next = page_number < self.total_pages + self.has_previous = page_number > 1 + self.items: list[ITEM_TYPE] = get_item_slice(items, page_max_items, page_number) + + +def get_page_amount(total_items: int, page_max_items: int) -> int: + """Getes the amount of pages total based on the number of items and page size + + Args: + total_items (int): The total number of items in the query + page_max_items (int): The maximum number of items per page + + Raises: + ValueError: total_items is less than 0 + ValueError: page_max_items is less than + + Returns: + int: The amount of pages + """ + if total_items < 0: + raise ValueError(TOTAL_ITEMS_MSG, total_items) + if page_max_items < 1: + raise ValueError(PAGE_MAX_ITEMS_MSG, page_max_items) + return math.ceil(total_items / page_max_items) + + +def get_item_slice( + items: list[ITEM_TYPE], page_max_items: int, page_number: int +) -> list[ITEM_TYPE]: + """Gets a list slice based on the paging parameters + + Args: + items (list[ITEM_TYPE]): A list of items to be sliced + page_max_items (int): The maximum number of items per page + page_number (int): The page number the current request is for + + Returns: + list[ITEM_TYPE]: The slice of items + """ + page_indeces = get_page_indeces(len(items), page_max_items, page_number) + return items[page_indeces[0] : page_indeces[1]] + + +def get_page_indeces( + total_items: int, page_max_items: int, page_number: int +) -> tuple[int, int]: + """Gets the indces used to slice the list of items + + Args: + total_items (int): The total number of items in the query + page_max_items (int): The maximum number of items per page + page_number (int): The page number the current request is for + + Raises: + ValueError: total_items is less than 0 + ValueError: page_max_items is less than 1 + ValueError: page_number is less than 1 + + Returns: + tuple[int, int]: The two indeces to slice the list of items with + """ + if total_items < 0: + raise ValueError(TOTAL_ITEMS_MSG, total_items) + if page_max_items < 1: + raise ValueError(PAGE_MAX_ITEMS_MSG, page_max_items) + if page_number < 1: + raise ValueError(PAGE_NUMBER_MSG, page_number) + index1 = (page_number - 1) * page_max_items + index2 = min(index1 + page_max_items, total_items) + return (index1, index2) diff --git a/apps/schematic/api/schematic_api/controllers/schema_controller.py b/apps/schematic/api/schematic_api/controllers/schema_controller.py index 925b51fb0a..7f90a321a4 100644 --- a/apps/schematic/api/schematic_api/controllers/schema_controller.py +++ b/apps/schematic/api/schematic_api/controllers/schema_controller.py @@ -5,10 +5,16 @@ from typing import Union from schematic_api.models.basic_error import BasicError # noqa: E501 -from schematic_api.models.connected_nodes_page import ConnectedNodesPage # noqa: E501 -from schematic_api.models.node_properties_page import NodePropertiesPage # noqa: E501 -from schematic_api.models.nodes_page import NodesPage # noqa: E501 -from schematic_api.models.validation_rules_page import ValidationRulesPage # noqa: E501 +from schematic_api.models.connected_node_pair_array import ( + ConnectedNodePairArray, +) # noqa: E501 +from schematic_api.models.connected_node_pair_page import ( + ConnectedNodePairPage, +) # noqa: E501 +from schematic_api.models.node_array import NodeArray # noqa: E501 +from schematic_api.models.node_page import NodePage # noqa: E501 +from schematic_api.models.node_property_array import NodePropertyArray # noqa: E501 +from schematic_api.models.validation_rule_array import ValidationRuleArray # noqa: E501 from schematic_api import util from schematic_api.controllers import schema_controller_impl @@ -32,19 +38,104 @@ def get_component(component_label, schema_url, include_index=None): # noqa: E50 ) -def get_connected_nodes(schema_url, relationship_type): # noqa: E501 - """Gets a list of connected node pairs +def get_connected_node_pair_array(schema_url, relationship_type): # noqa: E501 + """Gets an array of connected node pairs - Gets a list of connected node pairs # noqa: E501 + Gets a array of connected node pairs # noqa: E501 :param schema_url: The URL of a schema in jsonld form :type schema_url: str :param relationship_type: Type of relationship in a schema, such as requiresDependency :type relationship_type: str - :rtype: Union[ConnectedNodesPage, Tuple[ConnectedNodesPage, int], Tuple[ConnectedNodesPage, int, Dict[str, str]] + :rtype: Union[ConnectedNodePairArray, Tuple[ConnectedNodePairArray, int], Tuple[ConnectedNodePairArray, int, Dict[str, str]] """ - return schema_controller_impl.get_connected_nodes(schema_url, relationship_type) + return schema_controller_impl.get_connected_node_pair_array( + schema_url, relationship_type + ) + + +def get_connected_node_pair_page( + schema_url, relationship_type, page_number=None, page_max_items=None +): # noqa: E501 + """Gets a page of connected node pairs + + Gets a page of connected node pairs # noqa: E501 + + :param schema_url: The URL of a schema in jsonld form + :type schema_url: str + :param relationship_type: Type of relationship in a schema, such as requiresDependency + :type relationship_type: str + :param page_number: The page number to get for a paginated query + :type page_number: int + :param page_max_items: The maximum number of items per page (up to 100,000) for paginated endpoints + :type page_max_items: int + + :rtype: Union[ConnectedNodePairPage, Tuple[ConnectedNodePairPage, int], Tuple[ConnectedNodePairPage, int, Dict[str, str]] + """ + return schema_controller_impl.get_connected_node_pair_page( + schema_url, relationship_type, page_number, page_max_items + ) + + +def get_node_dependency_array( + node_label, schema_url, return_display_names=None, return_ordered_by_schema=None +): # noqa: E501 + """Gets the immediate dependencies that are related to the given source node + + Gets the immediate dependencies that are related to the given source node # noqa: E501 + + :param node_label: The label of the source node in a schema to get the dependencies of + :type node_label: str + :param schema_url: The URL of a schema in jsonld form + :type schema_url: str + :param return_display_names: Whether or not to return the display names of the component, otherwise the label + :type return_display_names: bool + :param return_ordered_by_schema: Whether or not to order the components by their order in the schema, otherwise random + :type return_ordered_by_schema: bool + + :rtype: Union[NodeArray, Tuple[NodeArray, int], Tuple[NodeArray, int, Dict[str, str]] + """ + return schema_controller_impl.get_node_dependency_array( + node_label, schema_url, return_display_names, return_ordered_by_schema + ) + + +def get_node_dependency_page( + node_label, + schema_url, + return_display_names=None, + return_ordered_by_schema=None, + page_number=None, + page_max_items=None, +): # noqa: E501 + """Gets the immediate dependencies that are related to the given source node + + Gets the immediate dependencies that are related to the given source node # noqa: E501 + + :param node_label: The label of the source node in a schema to get the dependencies of + :type node_label: str + :param schema_url: The URL of a schema in jsonld form + :type schema_url: str + :param return_display_names: Whether or not to return the display names of the component, otherwise the label + :type return_display_names: bool + :param return_ordered_by_schema: Whether or not to order the components by their order in the schema, otherwise random + :type return_ordered_by_schema: bool + :param page_number: The page number to get for a paginated query + :type page_number: int + :param page_max_items: The maximum number of items per page (up to 100,000) for paginated endpoints + :type page_max_items: int + + :rtype: Union[NodePage, Tuple[NodePage, int], Tuple[NodePage, int, Dict[str, str]] + """ + return schema_controller_impl.get_node_dependency_page( + node_label, + schema_url, + return_display_names, + return_ordered_by_schema, + page_number, + page_max_items, + ) def get_node_is_required(node_display, schema_url): # noqa: E501 @@ -72,11 +163,26 @@ def get_node_properties(node_label, schema_url): # noqa: E501 :param schema_url: The URL of a schema in jsonld form :type schema_url: str - :rtype: Union[NodePropertiesPage, Tuple[NodePropertiesPage, int], Tuple[NodePropertiesPage, int, Dict[str, str]] + :rtype: Union[NodePropertyArray, Tuple[NodePropertyArray, int], Tuple[NodePropertyArray, int, Dict[str, str]] """ return schema_controller_impl.get_node_properties(node_label, schema_url) +def get_node_validation_rules(node_display, schema_url): # noqa: E501 + """Gets the validation rules, along with the arguments for each given rule associated with a given node + + Gets the validation rules, along with the arguments for each given rule associated with a given node # noqa: E501 + + :param node_display: The display name of the node in a schema + :type node_display: str + :param schema_url: The URL of a schema in jsonld form + :type schema_url: str + + :rtype: Union[ValidationRuleArray, Tuple[ValidationRuleArray, int], Tuple[ValidationRuleArray, int, Dict[str, str]] + """ + return schema_controller_impl.get_node_validation_rules(node_display, schema_url) + + def get_property_label( node_display, schema_url, use_strict_camel_case=None ): # noqa: E501 @@ -109,41 +215,3 @@ def get_schema_attributes(schema_url): # noqa: E501 :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] """ return schema_controller_impl.get_schema_attributes(schema_url) - - -def list_node_dependencies( - node_label, schema_url, return_display_names=None, return_ordered_by_schema=None -): # noqa: E501 - """Gets the immediate dependencies that are related to the given source node - - Gets the immediate dependencies that are related to the given source node # noqa: E501 - - :param node_label: The label of the source node in a schema to get the dependencies of - :type node_label: str - :param schema_url: The URL of a schema in jsonld form - :type schema_url: str - :param return_display_names: Whether or not to return the display names of the component, otherwise the label - :type return_display_names: bool - :param return_ordered_by_schema: Whether or not to order the components by their order in the schema, otherwise random - :type return_ordered_by_schema: bool - - :rtype: Union[NodesPage, Tuple[NodesPage, int], Tuple[NodesPage, int, Dict[str, str]] - """ - return schema_controller_impl.list_node_dependencies( - node_label, schema_url, return_display_names, return_ordered_by_schema - ) - - -def list_node_validation_rules(node_display, schema_url): # noqa: E501 - """Gets the validation rules, along with the arguments for each given rule associated with a given node - - Gets the validation rules, along with the arguments for each given rule associated with a given node # noqa: E501 - - :param node_display: The display name of the node in a schema - :type node_display: str - :param schema_url: The URL of a schema in jsonld form - :type schema_url: str - - :rtype: Union[ValidationRulesPage, Tuple[ValidationRulesPage, int], Tuple[ValidationRulesPage, int, Dict[str, str]] - """ - return schema_controller_impl.list_node_validation_rules(node_display, schema_url) diff --git a/apps/schematic/api/schematic_api/controllers/schema_controller_impl.py b/apps/schematic/api/schematic_api/controllers/schema_controller_impl.py index 415ee5acc8..2b6e3ead46 100644 --- a/apps/schematic/api/schematic_api/controllers/schema_controller_impl.py +++ b/apps/schematic/api/schematic_api/controllers/schema_controller_impl.py @@ -1,22 +1,24 @@ """Implementation of all endpoints""" -from typing import Union, Any +from typing import Union from schematic.schemas.generator import SchemaGenerator, SchemaExplorer # type: ignore from schematic.visualization.attributes_explorer import AttributesExplorer # type: ignore from schematic_api.models.basic_error import BasicError -from schematic_api.models.node_properties_page import NodePropertiesPage -from schematic_api.models.node_property import NodeProperty -from schematic_api.models.validation_rules_page import ValidationRulesPage +from schematic_api.models.node_property_array import NodePropertyArray from schematic_api.models.validation_rule import ValidationRule -from schematic_api.models.nodes_page import NodesPage +from schematic_api.models.validation_rule_array import ValidationRuleArray from schematic_api.models.node import Node -from schematic_api.models.connected_nodes_page import ConnectedNodesPage -from schematic_api.models.connected_nodes import ConnectedNodes +from schematic_api.models.node_array import NodeArray +from schematic_api.models.node_page import NodePage +from schematic_api.models.connected_node_pair_array import ConnectedNodePairArray +from schematic_api.models.connected_node_pair_page import ConnectedNodePairPage +from schematic_api.models.connected_node_pair import ConnectedNodePair from schematic_api.controllers.utils import ( handle_exceptions, download_schema_file_as_jsonld, ) +from schematic_api.controllers.paging import Page @handle_exceptions @@ -46,18 +48,18 @@ def get_component( return result, status -def get_connected_nodes_from_schematic( +def get_connected_node_pairs_from_schematic( relationship_type: str, schema_url: str, -) -> list[list[Any]]: - """Gets a list of connected node pairs via the provide relationship +) -> list[ConnectedNodePair]: + """Gets a list of connected node pairs via the provided relationship Args: relationship_type (str): the type of relationship in the schema to get schema_url (str): The URL of the schema in jsonld form Returns: - list[list[Any]]: A list of relationships + list[ConnectedNodePair]: A list of connected node pairs """ schema_explorer = SchemaExplorer() schema_explorer.load_schema(schema_url) @@ -68,42 +70,70 @@ def get_connected_nodes_from_schematic( schema_graph, relationship_type ) - return [list(edge) for edge in relationship_subgraph.edges] + lst = [list(edge) for edge in relationship_subgraph.edges] + + return [ + ConnectedNodePair(connected_nodes[0], connected_nodes[1]) + for connected_nodes in lst + ] + + +@handle_exceptions +def get_connected_node_pair_array( + schema_url: str, relationship_type: str +) -> tuple[Union[ConnectedNodePairArray, BasicError], int]: + """Gets a list of connected node pairs via the provided relationship + + Args: + relationship_type (str): the type of relationship in the schema to get + schema_url (str): The URL of the schema in jsonld form + + Returns: + tuple[Union[ConnectedNodePairArray, BasicError], int]: A list of connected node pairs + """ + nodes = get_connected_node_pairs_from_schematic(relationship_type, schema_url) + result: Union[ConnectedNodePairArray, BasicError] = ConnectedNodePairArray(nodes) + status = 200 + return result, status @handle_exceptions -def get_connected_nodes( +def get_connected_node_pair_page( schema_url: str, relationship_type: str, -) -> tuple[Union[ConnectedNodesPage, BasicError], int]: - """Gets a list of connected node pairs via the provide relationship + page_number: int = 1, + page_max_items: int = 100000, +) -> tuple[Union[ConnectedNodePairPage, BasicError], int]: + """Gets a page of connected node pairs via the provided relationship Args: relationship_type (str): the type of relationship in the schema to get schema_url (str): The URL of the schema in json form + page_number (int): The page number the current request is for + page_max_items (int): The maximum number of items per page Returns: - tuple[Union[ConnectedNodesPage, BasicError], int: A tuple + tuple[Union[ConnectedNodePairPage, BasicError], int: A tuple The first item is either the connected nodes or an error object The second item is the response status """ - connected_nodes = [ - ConnectedNodes(connected_nodes[0], connected_nodes[1]) - for connected_nodes in get_connected_nodes_from_schematic( - relationship_type, schema_url - ) - ] + # pylint: disable=duplicate-code - page = ConnectedNodesPage( - number=0, - size=100, - total_elements=len(connected_nodes), - total_pages=1, - has_next=False, - has_previous=False, - connected_nodes=connected_nodes, + connected_nodes = get_connected_node_pairs_from_schematic( + relationship_type, schema_url + ) + page = Page(connected_nodes, page_number, page_max_items) + + cn_page = ConnectedNodePairPage( + number=page.page_number, + size=page.page_max_items, + total_elements=page.total_items, + total_pages=page.total_pages, + has_next=page.has_next, + has_previous=page.has_previous, + connected_nodes=page.items, ) - result: Union[ConnectedNodesPage, BasicError] = page + result: Union[ConnectedNodePairPage, BasicError] = cn_page status = 200 return result, status @@ -236,7 +266,7 @@ def get_node_properties_from_schematic( def get_node_properties( node_label: str, schema_url: str, -) -> tuple[Union[NodePropertiesPage, BasicError], int]: +) -> tuple[Union[NodePropertyArray, BasicError], int]: """Gets the properties associated with the node Args: @@ -244,35 +274,21 @@ def get_node_properties( node_label (str): The label of the node Returns: - tuple[Union[NodePropertiesPage, BasicError], int]: A tuple + tuple[Union[NodePropertyArray, BasicError], int]: A tuple The first item is either the node properties or an error object The second item is the response status """ - properties = [ - NodeProperty(property) - for property in get_node_properties_from_schematic(node_label, schema_url) - ] - - page = NodePropertiesPage( - number=0, - size=100, - total_elements=len(properties), - total_pages=1, - has_next=False, - has_previous=False, - node_properties=properties, - ) - result: Union[NodePropertiesPage, BasicError] = page + properties = get_node_properties_from_schematic(node_label, schema_url) + result: Union[NodePropertyArray, BasicError] = NodePropertyArray(properties) status = 200 - return result, status -def get_node_validation_rules( +def get_node_validation_rules_from_schematic( node_display: str, schema_url: str, -) -> list[str]: +) -> list[ValidationRule]: """Gets the validation_rules associated with the node Args: @@ -280,55 +296,45 @@ def get_node_validation_rules( node_display (str): The display name of the node Returns: - list[str]: A list of validation_rules of the node + list[ValidationRule]: A list of validation_rules of the node """ schema_generator = SchemaGenerator(path_to_json_ld=schema_url) - return schema_generator.get_node_validation_rules(node_display) # type: ignore + rules = schema_generator.get_node_validation_rules(node_display) # type: ignore + return [ValidationRule(rule) for rule in rules] @handle_exceptions -def list_node_validation_rules( +def get_node_validation_rules( node_display: str, schema_url: str, -) -> tuple[Union[ValidationRulesPage, BasicError], int]: - """Lists the validation rules associated with the node +) -> tuple[Union[ValidationRuleArray, BasicError], int]: + """Gets the validation rules associated with the node Args: schema_url (str): The URL of the schema in jsonld form node_display(str): The display name of the node Returns: - tuple[Union[AttributesPage, BasicError], int]: A tuple + tuple[Union[ValidationRuleArray, BasicError], int]: A tuple The first item is either the validation rules or an error object The second item is the response status """ - - validation_rules = [ - ValidationRule(attribute) - for attribute in get_node_validation_rules(node_display, schema_url) - ] - - page = ValidationRulesPage( - number=0, - size=100, - total_elements=len(validation_rules), - total_pages=1, - has_next=False, - has_previous=False, - validation_rules=validation_rules, + validation_rules = get_node_validation_rules_from_schematic( + node_display, schema_url + ) + result: Union[ValidationRuleArray, BasicError] = ValidationRuleArray( + validation_rules ) - result: Union[ValidationRulesPage, BasicError] = page status = 200 - return result, status -def get_node_dependencies( +def get_node_dependencies_from_schematic( node_label: str, schema_url: str, return_display_names: bool = True, return_ordered_by_schema: bool = True, -) -> list[str]: +) -> list[Node]: """Gets the nodes that the input node is dependent on Args: @@ -340,25 +346,26 @@ def get_node_dependencies( the schema, otherwise random Returns: - list[str]: A list of node labels or display names + list[Node]: A list of nodes """ schema_generator = SchemaGenerator(path_to_json_ld=schema_url) - return schema_generator.get_node_dependencies( + nodes = schema_generator.get_node_dependencies( source_node=node_label, display_names=return_display_names, schema_ordered=return_ordered_by_schema, ) + return [Node(node) for node in nodes] @handle_exceptions -def list_node_dependencies( +def get_node_dependency_array( node_label: str, schema_url: str, return_display_names: bool = True, return_ordered_by_schema: bool = True, -) -> tuple[Union[NodesPage, BasicError], int]: - """Lists the attributes that the input attribute is dependent on +) -> tuple[Union[NodeArray, BasicError], int]: + """Gets the nodes that the input node is dependent on Args: node_label (str): The label of the node to get dependencies for @@ -369,28 +376,61 @@ def list_node_dependencies( the schema, otherwise random Returns: - tuple[Union[NodesPage, BasicError], int]: A tuple - The first item is either the attributes or an error object + tuple[Union[NodeArray, BasicError], int]: A tuple + The first item is either the nodes or an error object The second item is the response status """ - nodes = [ - Node(node) - for node in get_node_dependencies( - node_label, schema_url, return_display_names, return_ordered_by_schema - ) - ] + nodes = get_node_dependencies_from_schematic( + node_label, schema_url, return_display_names, return_ordered_by_schema + ) + result: Union[NodeArray, BasicError] = NodeArray(nodes) + status = 200 + return result, status - page = NodesPage( - number=0, - size=100, - total_elements=len(nodes), - total_pages=1, - has_next=False, - has_previous=False, - nodes=nodes, + +@handle_exceptions +def get_node_dependency_page( # pylint: disable=too-many-arguments + node_label: str, + schema_url: str, + return_display_names: bool = True, + return_ordered_by_schema: bool = True, + page_number: int = 1, + page_max_items: int = 100000, +) -> tuple[Union[NodePage, BasicError], int]: + """Gets the nodes that the input node is dependent on + + Args: + node_label (str): The label of the node to get dependencies for + schema_url (str): The URL of the schema in json form + return_display_names (bool): Whether or not to return the display names of the dependencies, + otherwise the label + return_ordered_by_schema (bool):Whether or not to order the dependencies by their order in + the schema, otherwise random + page_number (int): The page number the current request is for + page_max_items (int): The maximum number of items per page + + Returns: + tuple[Union[NodePage, BasicError], int]: A tuple + The first item is either the nodes or an error object + The second item is the response status + """ + # pylint: disable=duplicate-code + nodes = get_node_dependencies_from_schematic( + node_label, schema_url, return_display_names, return_ordered_by_schema + ) + page = Page(nodes, page_number, page_max_items) + + node_page = NodePage( + number=page.page_number, + size=page.page_max_items, + total_elements=page.total_items, + total_pages=page.total_pages, + has_next=page.has_next, + has_previous=page.has_previous, + nodes=page.items, ) - result: Union[NodesPage, BasicError] = page + result: Union[NodePage, BasicError] = node_page status = 200 return result, status diff --git a/apps/schematic/api/schematic_api/controllers/storage_controller.py b/apps/schematic/api/schematic_api/controllers/storage_controller.py index 3398efc611..0e1c75b3c1 100644 --- a/apps/schematic/api/schematic_api/controllers/storage_controller.py +++ b/apps/schematic/api/schematic_api/controllers/storage_controller.py @@ -6,10 +6,22 @@ from schematic_api.models.asset_type import AssetType # noqa: E501 from schematic_api.models.basic_error import BasicError # noqa: E501 -from schematic_api.models.datasets_page import DatasetsPage # noqa: E501 -from schematic_api.models.files_page import FilesPage # noqa: E501 -from schematic_api.models.manifests_page import ManifestsPage # noqa: E501 -from schematic_api.models.projects_page import ProjectsPage # noqa: E501 +from schematic_api.models.dataset_metadata_array import ( + DatasetMetadataArray, +) # noqa: E501 +from schematic_api.models.dataset_metadata_page import DatasetMetadataPage # noqa: E501 +from schematic_api.models.file_metadata_array import FileMetadataArray # noqa: E501 +from schematic_api.models.file_metadata_page import FileMetadataPage # noqa: E501 +from schematic_api.models.manifest_metadata_array import ( + ManifestMetadataArray, +) # noqa: E501 +from schematic_api.models.manifest_metadata_page import ( + ManifestMetadataPage, +) # noqa: E501 +from schematic_api.models.project_metadata_array import ( + ProjectMetadataArray, +) # noqa: E501 +from schematic_api.models.project_metadata_page import ProjectMetadataPage # noqa: E501 from schematic_api import util from schematic_api.controllers import storage_controller_impl @@ -31,7 +43,7 @@ def get_asset_view_json(asset_view_id, asset_type): # noqa: E501 return storage_controller_impl.get_asset_view_json(asset_view_id, asset_type) -def get_dataset_files( +def get_dataset_file_metadata_array( dataset_id, asset_type, asset_view_id, file_names=None, use_full_file_path=None ): # noqa: E501 """Gets all files associated with a dataset. @@ -49,15 +61,58 @@ def get_dataset_files( :param use_full_file_path: Whether or not to return the full path of output, or just the basename. :type use_full_file_path: bool - :rtype: Union[FilesPage, Tuple[FilesPage, int], Tuple[FilesPage, int, Dict[str, str]] + :rtype: Union[FileMetadataArray, Tuple[FileMetadataArray, int], Tuple[FileMetadataArray, int, Dict[str, str]] """ if connexion.request.is_json: asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 - return storage_controller_impl.get_dataset_files( + return storage_controller_impl.get_dataset_file_metadata_array( dataset_id, asset_type, asset_view_id, file_names, use_full_file_path ) +def get_dataset_file_metadata_page( + dataset_id, + asset_type, + asset_view_id, + file_names=None, + use_full_file_path=None, + page_number=None, + page_max_items=None, +): # noqa: E501 + """Gets all files associated with a dataset. + + Gets all files associated with a dataset. # noqa: E501 + + :param dataset_id: The ID of a dataset. + :type dataset_id: str + :param asset_type: Type of asset, such as Synapse + :type asset_type: dict | bytes + :param asset_view_id: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project + :type asset_view_id: str + :param file_names: A list of file names used to filter the output. + :type file_names: List[str] + :param use_full_file_path: Whether or not to return the full path of output, or just the basename. + :type use_full_file_path: bool + :param page_number: The page number to get for a paginated query + :type page_number: int + :param page_max_items: The maximum number of items per page (up to 100,000) for paginated endpoints + :type page_max_items: int + + :rtype: Union[FileMetadataPage, Tuple[FileMetadataPage, int], Tuple[FileMetadataPage, int, Dict[str, str]] + """ + if connexion.request.is_json: + asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 + return storage_controller_impl.get_dataset_file_metadata_page( + dataset_id, + asset_type, + asset_view_id, + file_names, + use_full_file_path, + page_number, + page_max_items, + ) + + def get_dataset_manifest_json(asset_type, dataset_id, asset_view_id): # noqa: E501 """Gets the manifest in json form @@ -96,10 +151,12 @@ def get_manifest_json(asset_type, manifest_id): # noqa: E501 return storage_controller_impl.get_manifest_json(asset_type, manifest_id) -def get_project_datasets(project_id, asset_type, asset_view_id): # noqa: E501 - """Gets all datasets in folder under a given storage project that the current user has access to. +def get_project_dataset_metadata_array( + project_id, asset_type, asset_view_id +): # noqa: E501 + """Gets all dataset metadata in folder under a given storage project that the current user has access to. - Gets all datasets in folder under a given storage project that the current user has access to. # noqa: E501 + Gets all dataset meatdata in folder under a given storage project that the current user has access to. # noqa: E501 :param project_id: The Synapse ID of a storage project. :type project_id: str @@ -108,16 +165,45 @@ def get_project_datasets(project_id, asset_type, asset_view_id): # noqa: E501 :param asset_view_id: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project :type asset_view_id: str - :rtype: Union[DatasetsPage, Tuple[DatasetsPage, int], Tuple[DatasetsPage, int, Dict[str, str]] + :rtype: Union[DatasetMetadataArray, Tuple[DatasetMetadataArray, int], Tuple[DatasetMetadataArray, int, Dict[str, str]] """ if connexion.request.is_json: asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 - return storage_controller_impl.get_project_datasets( + return storage_controller_impl.get_project_dataset_metadata_array( project_id, asset_type, asset_view_id ) -def get_project_manifests(project_id, asset_type, asset_view_id): # noqa: E501 +def get_project_dataset_metadata_page( + project_id, asset_type, asset_view_id, page_number=None, page_max_items=None +): # noqa: E501 + """Gets a page of dataset metadata in folder under a given storage project that the current user has access to. + + Gets a page of dataset meatdata in folder under a given storage project that the current user has access to. # noqa: E501 + + :param project_id: The Synapse ID of a storage project. + :type project_id: str + :param asset_type: Type of asset, such as Synapse + :type asset_type: dict | bytes + :param asset_view_id: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project + :type asset_view_id: str + :param page_number: The page number to get for a paginated query + :type page_number: int + :param page_max_items: The maximum number of items per page (up to 100,000) for paginated endpoints + :type page_max_items: int + + :rtype: Union[DatasetMetadataPage, Tuple[DatasetMetadataPage, int], Tuple[DatasetMetadataPage, int, Dict[str, str]] + """ + if connexion.request.is_json: + asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 + return storage_controller_impl.get_project_dataset_metadata_page( + project_id, asset_type, asset_view_id, page_number, page_max_items + ) + + +def get_project_manifest_metadata_array( + project_id, asset_type, asset_view_id +): # noqa: E501 """Gets all manifests in a project folder that users have access to Gets all manifests in a project folder that the current user has access to. # noqa: E501 @@ -129,16 +215,62 @@ def get_project_manifests(project_id, asset_type, asset_view_id): # noqa: E501 :param asset_view_id: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project :type asset_view_id: str - :rtype: Union[ManifestsPage, Tuple[ManifestsPage, int], Tuple[ManifestsPage, int, Dict[str, str]] + :rtype: Union[ManifestMetadataArray, Tuple[ManifestMetadataArray, int], Tuple[ManifestMetadataArray, int, Dict[str, str]] """ if connexion.request.is_json: asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 - return storage_controller_impl.get_project_manifests( + return storage_controller_impl.get_project_manifest_metadata_array( project_id, asset_type, asset_view_id ) -def get_projects(asset_view_id, asset_type): # noqa: E501 +def get_project_manifest_metadata_page( + project_id, asset_type, asset_view_id, page_number=None, page_max_items=None +): # noqa: E501 + """Gets all manifests in a project folder that users have access to + + Gets all manifests in a project folder that the current user has access to. # noqa: E501 + + :param project_id: The Synapse ID of a storage project. + :type project_id: str + :param asset_type: Type of asset, such as Synapse + :type asset_type: dict | bytes + :param asset_view_id: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project + :type asset_view_id: str + :param page_number: The page number to get for a paginated query + :type page_number: int + :param page_max_items: The maximum number of items per page (up to 100,000) for paginated endpoints + :type page_max_items: int + + :rtype: Union[ManifestMetadataPage, Tuple[ManifestMetadataPage, int], Tuple[ManifestMetadataPage, int, Dict[str, str]] + """ + if connexion.request.is_json: + asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 + return storage_controller_impl.get_project_manifest_metadata_page( + project_id, asset_type, asset_view_id, page_number, page_max_items + ) + + +def get_project_metadata_array(asset_view_id, asset_type): # noqa: E501 + """Gets all storage projects the current user has access to. + + Gets all storage projects the current user has access to. # noqa: E501 + + :param asset_view_id: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given project + :type asset_view_id: str + :param asset_type: Type of asset, such as Synapse + :type asset_type: dict | bytes + + :rtype: Union[ProjectMetadataArray, Tuple[ProjectMetadataArray, int], Tuple[ProjectMetadataArray, int, Dict[str, str]] + """ + if connexion.request.is_json: + asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 + return storage_controller_impl.get_project_metadata_array(asset_view_id, asset_type) + + +def get_project_metadata_page( + asset_view_id, asset_type, page_number=None, page_max_items=None +): # noqa: E501 """Gets all storage projects the current user has access to. Gets all storage projects the current user has access to. # noqa: E501 @@ -147,9 +279,15 @@ def get_projects(asset_view_id, asset_type): # noqa: E501 :type asset_view_id: str :param asset_type: Type of asset, such as Synapse :type asset_type: dict | bytes + :param page_number: The page number to get for a paginated query + :type page_number: int + :param page_max_items: The maximum number of items per page (up to 100,000) for paginated endpoints + :type page_max_items: int - :rtype: Union[ProjectsPage, Tuple[ProjectsPage, int], Tuple[ProjectsPage, int, Dict[str, str]] + :rtype: Union[ProjectMetadataPage, Tuple[ProjectMetadataPage, int], Tuple[ProjectMetadataPage, int, Dict[str, str]] """ if connexion.request.is_json: asset_type = AssetType.from_dict(connexion.request.get_json()) # noqa: E501 - return storage_controller_impl.get_projects(asset_view_id, asset_type) + return storage_controller_impl.get_project_metadata_page( + asset_view_id, asset_type, page_number, page_max_items + ) diff --git a/apps/schematic/api/schematic_api/controllers/storage_controller_impl.py b/apps/schematic/api/schematic_api/controllers/storage_controller_impl.py index 32fa9fad9d..462d5f6676 100644 --- a/apps/schematic/api/schematic_api/controllers/storage_controller_impl.py +++ b/apps/schematic/api/schematic_api/controllers/storage_controller_impl.py @@ -8,15 +8,20 @@ from schematic import CONFIG # type: ignore from schematic_api.models.basic_error import BasicError -from schematic_api.models.dataset import Dataset -from schematic_api.models.datasets_page import DatasetsPage -from schematic_api.models.manifests_page import ManifestsPage -from schematic_api.models.manifest import Manifest -from schematic_api.models.project import Project -from schematic_api.models.projects_page import ProjectsPage -from schematic_api.models.file import File -from schematic_api.models.files_page import FilesPage +from schematic_api.models.dataset_metadata import DatasetMetadata +from schematic_api.models.dataset_metadata_array import DatasetMetadataArray +from schematic_api.models.dataset_metadata_page import DatasetMetadataPage +from schematic_api.models.manifest_metadata import ManifestMetadata +from schematic_api.models.manifest_metadata_array import ManifestMetadataArray +from schematic_api.models.manifest_metadata_page import ManifestMetadataPage +from schematic_api.models.project_metadata import ProjectMetadata +from schematic_api.models.project_metadata_array import ProjectMetadataArray +from schematic_api.models.project_metadata_page import ProjectMetadataPage +from schematic_api.models.file_metadata import FileMetadata +from schematic_api.models.file_metadata_array import FileMetadataArray +from schematic_api.models.file_metadata_page import FileMetadataPage from schematic_api.controllers.utils import handle_exceptions, get_access_token +from schematic_api.controllers.paging import Page def get_asset_storage_class(asset_type: str) -> Callable: @@ -81,12 +86,12 @@ def get_asset_view_json( return result, status -def get_dataset_files_from_schematic( +def get_dataset_file_metadata_from_schematic( dataset_id: str, asset_type: str, # pylint: disable=unused-argument file_names: Optional[list[str]], use_full_file_path: bool, -) -> list[tuple[str, str]]: +) -> list[FileMetadata]: """Gets a list of datasets from the project Args: @@ -94,26 +99,27 @@ def get_dataset_files_from_schematic( asset_type (str): The type of asset, ie "synapse" Returns: - list[tuple(str, str)]: A list of files in tuple form + list[FileMetadata]: A list of file metadata """ access_token = get_access_token() store = SynapseStorage(access_token=access_token) # type: ignore - return store.getFilesInStorageDataset( + file_tuple_list = store.getFilesInStorageDataset( datasetId=dataset_id, fileNames=file_names, # type: ignore fullpath=use_full_file_path, ) + return [FileMetadata(id=item[0], name=item[1]) for item in file_tuple_list] @handle_exceptions -def get_dataset_files( +def get_dataset_file_metadata_array( dataset_id: str, asset_type: str, asset_view_id: str, file_names: Optional[list[str]] = None, use_full_file_path: bool = False, -) -> tuple[Union[FilesPage, BasicError], int]: - """Attempts to get a list of files associated with a dataset +) -> tuple[Union[FileMetadataArray, BasicError], int]: + """Gets file metadata associated with a dataset Args: dataset_id (str): The Id for the dataset to get the files from @@ -123,26 +129,65 @@ def get_dataset_files( use_full_file_path: Whether or not to return the full file path of each file Returns: - tuple[Union[FilesPage, BasicError], int]: A tuple - The first item is either the datasets or an error object + tuple[Union[FileMetadataArray, BasicError], int]: A tuple + The first item is either the file metadata or an error object The second item is the response status """ CONFIG.synapse_master_fileview_id = asset_view_id - file_tuples = get_dataset_files_from_schematic( + file_metadata_list = get_dataset_file_metadata_from_schematic( dataset_id, asset_type, file_names, use_full_file_path ) - files = [File(id=item[0], name=item[1]) for item in file_tuples] - - page = FilesPage( - number=0, - size=100, - total_elements=len(files), - total_pages=1, - has_next=False, - has_previous=False, - files=files, + + result: Union[FileMetadataArray, BasicError] = FileMetadataArray(file_metadata_list) + status = 200 + + return result, status + + +@handle_exceptions +def get_dataset_file_metadata_page( # pylint: disable=too-many-arguments + dataset_id: str, + asset_type: str, + asset_view_id: str, + file_names: Optional[list[str]] = None, + use_full_file_path: bool = False, + page_number: int = 1, + page_max_items: int = 100_000, +) -> tuple[Union[FileMetadataPage, BasicError], int]: + """Gets file metadata associated with a dataset + + Args: + dataset_id (str): The Id for the dataset to get the files from + asset_view_id (str): The id for the asset view of the project + asset_type (str): The type of asset, ie "synapse" + file_names (Optional[list[str]]): An optional list of file names to filter the output by + use_full_file_path: Whether or not to return the full file path of each file + page_number (int): The page number the current request is for + page_max_items (int): The maximum number of items per page + + Returns: + tuple[Union[FileMetadataPage, BasicError], int]: A tuple + The first item is either the file metadata or an error object + The second item is the response status + """ + CONFIG.synapse_master_fileview_id = asset_view_id + file_metadata_list = get_dataset_file_metadata_from_schematic( + dataset_id, asset_type, file_names, use_full_file_path ) - result: Union[FilesPage, BasicError] = page + + page = Page(file_metadata_list, page_number, page_max_items) + + file_page = FileMetadataPage( + number=page.page_number, + size=page.page_max_items, + total_elements=page.total_items, + total_pages=page.total_pages, + has_next=page.has_next, + has_previous=page.has_previous, + files=page.items, + ) + + result: Union[FileMetadataPage, BasicError] = file_page status = 200 return result, status @@ -254,168 +299,277 @@ def get_manifest_json( return result, status -def get_project_datasets_from_schematic( +def get_project_dataset_metadata_from_schematic( project_id: str, asset_type: str # pylint: disable=unused-argument -) -> list[tuple[str, str]]: - """Gets a list of datasets from the project +) -> list[DatasetMetadata]: + """Gets a list of dataset metadata from the project Args: project_id (str): The id for the project asset_type (str): The type of asset, ie "synapse" Returns: - list[tuple(str, str)]: A list of datasets in tuple form + list[DatasetMetadata]: A list of dataset metadata """ access_token = get_access_token() store = SynapseStorage(access_token=access_token) # type: ignore - return store.getStorageDatasetsInProject(projectId=project_id) # type: ignore + tuples = store.getStorageDatasetsInProject(projectId=project_id) # type: ignore + return [DatasetMetadata(id=item[0], name=item[1]) for item in tuples] @handle_exceptions -def get_project_datasets( +def get_project_dataset_metadata_array( project_id: str, asset_type: str, asset_view_id: str -) -> tuple[Union[DatasetsPage, BasicError], int]: - """Attempts to get a list of datasets from a Synapse project +) -> tuple[Union[DatasetMetadataArray, BasicError], int]: + """Creates a list of dataset metadata from the project + + Args: + project_id (str): The Id for the project to get datasets from + asset_view_id (str): The id for the asset view of the project + asset_type (str): The type of asset, ie "synapse" + + Returns: + tuple[Union[DatasetMetadataArray, BasicError], int]: A tuple + The first item is either the dataset metadata or an error object + The second item is the response status + """ + + CONFIG.synapse_master_fileview_id = asset_view_id + dataset_metadata_list = get_project_dataset_metadata_from_schematic( + project_id, asset_type + ) + result: Union[DatasetMetadataArray, BasicError] = DatasetMetadataArray( + dataset_metadata_list + ) + status = 200 + return result, status + + +@handle_exceptions +def get_project_dataset_metadata_page( + project_id: str, + asset_type: str, + asset_view_id: str, + page_number: int = 1, + page_max_items: int = 100_000, +) -> tuple[Union[DatasetMetadataPage, BasicError], int]: + """Creates a page of dataset metadata from the project Args: project_id (str): The Id for the project to get datasets from asset_view_id (str): The id for the asset view of the project asset_type (str): The type of asset, ie "synapse" + page_number (int): The page number the current request is for + page_max_items (int): The maximum number of items per page Returns: - tuple[Union[DatasetsPage, BasicError], int]: A tuple - The first item is either the datasets or an error object + tuple[Union[DatasetMetadataPage, BasicError], int]: A tuple + The first item is either the dataset metadata or an error object The second item is the response status """ + # pylint: disable=duplicate-code CONFIG.synapse_master_fileview_id = asset_view_id - dataset_tuples = get_project_datasets_from_schematic(project_id, asset_type) - datasets = [Dataset(id=item[0], name=item[1]) for item in dataset_tuples] - - page = DatasetsPage( - number=0, - size=100, - total_elements=len(datasets), - total_pages=1, - has_next=False, - has_previous=False, - datasets=datasets, + dataset_metadata_list = get_project_dataset_metadata_from_schematic( + project_id, asset_type + ) + page = Page(dataset_metadata_list, page_number, page_max_items) + + dataset_page = DatasetMetadataPage( + number=page.page_number, + size=page.page_max_items, + total_elements=page.total_items, + total_pages=page.total_pages, + has_next=page.has_next, + has_previous=page.has_previous, + datasets=page.items, ) - result: Union[DatasetsPage, BasicError] = page + + result: Union[DatasetMetadataPage, BasicError] = dataset_page status = 200 return result, status -def get_project_manifests_from_schematic( +def get_project_manifest_metadata_from_schematic( project_id: str, asset_type: str, # pylint: disable=unused-argument -) -> list[tuple[tuple[str, str], tuple[str, str], tuple[str, str]]]: - """Gets a list of manifests from the project +) -> list[ManifestMetadata]: + """Gets manifest metadata from the project Args: project_id (str): The id for the project asset_type (str): The type of asset, ie "synapse" Returns: - list[tuple[tuple[str, str], tuple[str, str], tuple[str, str]]]: A list of manifests + list[ManifestMetadata]: A list of manifest metadata """ access_token = get_access_token() store = SynapseStorage(access_token=access_token) # type: ignore - return store.getProjectManifests(projectId=project_id) # type: ignore + manifest_tuple_list = store.getProjectManifests(projectId=project_id) # type: ignore + return [ + ManifestMetadata( + name=item[1][1], + id=item[1][0], + dataset_name=item[0][1], + dataset_id=item[0][0], + component_name=item[2][0], + ) + for item in manifest_tuple_list + ] @handle_exceptions -def get_project_manifests( - project_id: str, asset_type: str, asset_view_id: str -) -> tuple[Union[ManifestsPage, BasicError], int]: - """Attempts to get a list of manifests from a Synapse project +def get_project_manifest_metadata_array( + project_id: str, + asset_type: str, + asset_view_id: str, +) -> tuple[Union[ManifestMetadataArray, BasicError], int]: + """Gets a list of manifest metadata from a project Args: - project_id (str): A Synapse id - asset_view_id (str): A Synapse id + project_id (str): The id of the project + asset_view_id (str): The id of the asset view asset_type (str): The type of asset, ie "synapse" Returns: - tuple[Union[ManifestsPage, BasicError], int]: A tuple + [Union[tuple[ManifestMetadataArray, BasicError], int]: A tuple + The first item is either the manifests or an error object + The second item is the response status + """ + CONFIG.synapse_master_fileview_id = asset_view_id + manifest_metadata = get_project_manifest_metadata_from_schematic( + project_id, asset_type + ) + result: Union[ManifestMetadataArray, BasicError] = ManifestMetadataArray( + manifest_metadata + ) + status = 200 + return result, status + + +@handle_exceptions +def get_project_manifest_metadata_page( + project_id: str, + asset_type: str, + asset_view_id: str, + page_number: int = 1, + page_max_items: int = 100_000, +) -> tuple[Union[ManifestMetadataPage, BasicError], int]: + """Gets a page of manifest metadata from a project + + Args: + project_id (str): The id of the project + asset_view_id (str): The id of the asset view + asset_type (str): The type of asset, ie "synapse" + page_number (int): The page number the current request is for + page_max_items (int): The maximum number of items per page + + Returns: + [Union[tuple[ManifestMetadataPage, BasicError], int]: A tuple The first item is either the manifests or an error object The second item is the response status """ # load config CONFIG.synapse_master_fileview_id = asset_view_id - project_manifests = get_project_manifests_from_schematic(project_id, asset_type) - manifests = [ - Manifest( - name=item[1][1], - id=item[1][0], - dataset_name=item[0][1], - dataset_id=item[0][0], - component_name=item[2][0], - ) - for item in project_manifests - ] + manifest_metadata = get_project_manifest_metadata_from_schematic( + project_id, asset_type + ) + + page = Page(manifest_metadata, page_number, page_max_items) - page = ManifestsPage( - number=0, - size=100, - total_elements=len(manifests), - total_pages=1, - has_next=False, - has_previous=False, - manifests=manifests, + manifest_page = ManifestMetadataPage( + number=page.page_number, + size=page.page_max_items, + total_elements=page.total_items, + total_pages=page.total_pages, + has_next=page.has_next, + has_previous=page.has_previous, + manifests=page.items, ) - result: Union[ManifestsPage, BasicError] = page + + result: Union[ManifestMetadataPage, BasicError] = manifest_page status = 200 return result, status -def get_projects_from_schematic( +def get_project_metadata_from_schematic( asset_type: str, # pylint: disable=unused-argument -) -> list[tuple[str, str]]: +) -> list[ProjectMetadata]: """Gets a list of projects Args: asset_type (str): The type of asset, ie "synapse" Returns: - list[tuple(str, str)]: A list of projects in tuple form + list[ProjectMetadata]: A list of project metadata """ access_token = get_access_token() store = SynapseStorage(access_token=access_token) # type: ignore - return store.getStorageProjects() # type: ignore + metadata_tuple_list = store.getStorageProjects() # type: ignore + return [ProjectMetadata(id=item[0], name=item[1]) for item in metadata_tuple_list] @handle_exceptions -def get_projects( - asset_view_id: str, asset_type: str -) -> tuple[Union[ProjectsPage, BasicError], int]: - """Attempts to get a list of projects the user has access to +def get_project_metadata_array( + asset_view_id: str, + asset_type: str, +) -> tuple[Union[ProjectMetadataArray, BasicError], int]: + """Gets a list of project metadata the user has access to Args: asset_view_id (str): The id for the asset view of the project asset_type (str): The type of asset, ie "synapse" Returns: - tuple[Union[ProjectsPage, BasicError], int]: A tuple + tuple[Union[ProjectMetadataArray, BasicError], int]: A tuple The first item is either the projects or an error object The second item is the response status """ CONFIG.synapse_master_fileview_id = asset_view_id - project_tuples = get_projects_from_schematic(asset_type) - projects = [Project(id=item[0], name=item[1]) for item in project_tuples] - - page = ProjectsPage( - number=0, - size=100, - total_elements=len(projects), - total_pages=1, - has_next=False, - has_previous=False, - projects=projects, + project_metadata = get_project_metadata_from_schematic(asset_type) + result: Union[ProjectMetadataArray, BasicError] = ProjectMetadataArray( + project_metadata ) - result: Union[ProjectsPage, BasicError] = page status = 200 + return result, status + + +@handle_exceptions +def get_project_metadata_page( + asset_view_id: str, + asset_type: str, + page_number: int = 1, + page_max_items: int = 100_000, +) -> tuple[Union[ProjectMetadataPage, BasicError], int]: + """Gets a list of project metadata the user has access to + + Args: + asset_view_id (str): The id for the asset view of the project + asset_type (str): The type of asset, ie "synapse" + page_number (int): The page number the current request is for + page_max_items (int): The maximum number of items per page + + Returns: + tuple[Union[ProjectMetadataPage, BasicError], int]: A tuple + The first item is either the projects or an error object + The second item is the response status + """ + CONFIG.synapse_master_fileview_id = asset_view_id + project_metadata = get_project_metadata_from_schematic(asset_type) + page = Page(project_metadata, page_number, page_max_items) + manifest_page = ProjectMetadataPage( + number=page.page_number, + size=page.page_max_items, + total_elements=page.total_items, + total_pages=page.total_pages, + has_next=page.has_next, + has_previous=page.has_previous, + projects=page.items, + ) + result: Union[ProjectMetadataPage, BasicError] = manifest_page + status = 200 return result, status diff --git a/apps/schematic/api/schematic_api/models/__init__.py b/apps/schematic/api/schematic_api/models/__init__.py index fd4520ac4a..628905a817 100644 --- a/apps/schematic/api/schematic_api/models/__init__.py +++ b/apps/schematic/api/schematic_api/models/__init__.py @@ -5,29 +5,32 @@ # import models into model package from schematic_api.models.asset_type import AssetType from schematic_api.models.basic_error import BasicError -from schematic_api.models.connected_nodes import ConnectedNodes -from schematic_api.models.connected_nodes_page import ConnectedNodesPage -from schematic_api.models.connected_nodes_page_all_of import ConnectedNodesPageAllOf -from schematic_api.models.dataset import Dataset -from schematic_api.models.datasets_page import DatasetsPage -from schematic_api.models.datasets_page_all_of import DatasetsPageAllOf -from schematic_api.models.file import File -from schematic_api.models.files_page import FilesPage -from schematic_api.models.files_page_all_of import FilesPageAllOf -from schematic_api.models.manifest import Manifest +from schematic_api.models.connected_node_pair import ConnectedNodePair +from schematic_api.models.connected_node_pair_array import ConnectedNodePairArray +from schematic_api.models.connected_node_pair_page import ConnectedNodePairPage +from schematic_api.models.connected_node_pair_page_all_of import ConnectedNodePairPageAllOf +from schematic_api.models.dataset_metadata import DatasetMetadata +from schematic_api.models.dataset_metadata_array import DatasetMetadataArray +from schematic_api.models.dataset_metadata_page import DatasetMetadataPage +from schematic_api.models.dataset_metadata_page_all_of import DatasetMetadataPageAllOf +from schematic_api.models.file_metadata import FileMetadata +from schematic_api.models.file_metadata_array import FileMetadataArray +from schematic_api.models.file_metadata_page import FileMetadataPage +from schematic_api.models.file_metadata_page_all_of import FileMetadataPageAllOf +from schematic_api.models.manifest_metadata import ManifestMetadata +from schematic_api.models.manifest_metadata_array import ManifestMetadataArray +from schematic_api.models.manifest_metadata_page import ManifestMetadataPage +from schematic_api.models.manifest_metadata_page_all_of import ManifestMetadataPageAllOf from schematic_api.models.manifest_validation_result import ManifestValidationResult -from schematic_api.models.manifests_page import ManifestsPage -from schematic_api.models.manifests_page_all_of import ManifestsPageAllOf from schematic_api.models.node import Node -from schematic_api.models.node_properties_page import NodePropertiesPage -from schematic_api.models.node_properties_page_all_of import NodePropertiesPageAllOf -from schematic_api.models.node_property import NodeProperty -from schematic_api.models.nodes_page import NodesPage -from schematic_api.models.nodes_page_all_of import NodesPageAllOf +from schematic_api.models.node_array import NodeArray +from schematic_api.models.node_page import NodePage +from schematic_api.models.node_page_all_of import NodePageAllOf +from schematic_api.models.node_property_array import NodePropertyArray from schematic_api.models.page_metadata import PageMetadata -from schematic_api.models.project import Project -from schematic_api.models.projects_page import ProjectsPage -from schematic_api.models.projects_page_all_of import ProjectsPageAllOf +from schematic_api.models.project_metadata import ProjectMetadata +from schematic_api.models.project_metadata_array import ProjectMetadataArray +from schematic_api.models.project_metadata_page import ProjectMetadataPage +from schematic_api.models.project_metadata_page_all_of import ProjectMetadataPageAllOf from schematic_api.models.validation_rule import ValidationRule -from schematic_api.models.validation_rules_page import ValidationRulesPage -from schematic_api.models.validation_rules_page_all_of import ValidationRulesPageAllOf +from schematic_api.models.validation_rule_array import ValidationRuleArray diff --git a/apps/schematic/api/schematic_api/models/connected_nodes.py b/apps/schematic/api/schematic_api/models/connected_node_pair.py similarity index 68% rename from apps/schematic/api/schematic_api/models/connected_nodes.py rename to apps/schematic/api/schematic_api/models/connected_node_pair.py index 13759dbc34..3aa4de9a6d 100644 --- a/apps/schematic/api/schematic_api/models/connected_nodes.py +++ b/apps/schematic/api/schematic_api/models/connected_node_pair.py @@ -9,18 +9,18 @@ from schematic_api import util -class ConnectedNodes(Model): +class ConnectedNodePair(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, node1=None, node2=None): # noqa: E501 - """ConnectedNodes - a model defined in OpenAPI + """ConnectedNodePair - a model defined in OpenAPI - :param node1: The node1 of this ConnectedNodes. # noqa: E501 + :param node1: The node1 of this ConnectedNodePair. # noqa: E501 :type node1: str - :param node2: The node2 of this ConnectedNodes. # noqa: E501 + :param node2: The node2 of this ConnectedNodePair. # noqa: E501 :type node2: str """ self.openapi_types = { @@ -37,34 +37,34 @@ def __init__(self, node1=None, node2=None): # noqa: E501 self._node2 = node2 @classmethod - def from_dict(cls, dikt) -> 'ConnectedNodes': + def from_dict(cls, dikt) -> 'ConnectedNodePair': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ConnectedNodes of this ConnectedNodes. # noqa: E501 - :rtype: ConnectedNodes + :return: The ConnectedNodePair of this ConnectedNodePair. # noqa: E501 + :rtype: ConnectedNodePair """ return util.deserialize_model(dikt, cls) @property def node1(self): - """Gets the node1 of this ConnectedNodes. + """Gets the node1 of this ConnectedNodePair. The disaplay name of the first node. # noqa: E501 - :return: The node1 of this ConnectedNodes. + :return: The node1 of this ConnectedNodePair. :rtype: str """ return self._node1 @node1.setter def node1(self, node1): - """Sets the node1 of this ConnectedNodes. + """Sets the node1 of this ConnectedNodePair. The disaplay name of the first node. # noqa: E501 - :param node1: The node1 of this ConnectedNodes. + :param node1: The node1 of this ConnectedNodePair. :type node1: str """ if node1 is None: @@ -74,22 +74,22 @@ def node1(self, node1): @property def node2(self): - """Gets the node2 of this ConnectedNodes. + """Gets the node2 of this ConnectedNodePair. The display name of the second node. # noqa: E501 - :return: The node2 of this ConnectedNodes. + :return: The node2 of this ConnectedNodePair. :rtype: str """ return self._node2 @node2.setter def node2(self, node2): - """Sets the node2 of this ConnectedNodes. + """Sets the node2 of this ConnectedNodePair. The display name of the second node. # noqa: E501 - :param node2: The node2 of this ConnectedNodes. + :param node2: The node2 of this ConnectedNodePair. :type node2: str """ if node2 is None: diff --git a/apps/schematic/api/schematic_api/models/connected_node_pair_array.py b/apps/schematic/api/schematic_api/models/connected_node_pair_array.py new file mode 100644 index 0000000000..da630f9679 --- /dev/null +++ b/apps/schematic/api/schematic_api/models/connected_node_pair_array.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.connected_node_pair import ConnectedNodePair +from schematic_api import util + +from schematic_api.models.connected_node_pair import ConnectedNodePair # noqa: E501 + +class ConnectedNodePairArray(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, connected_nodes=None): # noqa: E501 + """ConnectedNodePairArray - a model defined in OpenAPI + + :param connected_nodes: The connected_nodes of this ConnectedNodePairArray. # noqa: E501 + :type connected_nodes: List[ConnectedNodePair] + """ + self.openapi_types = { + 'connected_nodes': List[ConnectedNodePair] + } + + self.attribute_map = { + 'connected_nodes': 'connectedNodes' + } + + self._connected_nodes = connected_nodes + + @classmethod + def from_dict(cls, dikt) -> 'ConnectedNodePairArray': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ConnectedNodePairArray of this ConnectedNodePairArray. # noqa: E501 + :rtype: ConnectedNodePairArray + """ + return util.deserialize_model(dikt, cls) + + @property + def connected_nodes(self): + """Gets the connected_nodes of this ConnectedNodePairArray. + + An array of conncted node pairs. # noqa: E501 + + :return: The connected_nodes of this ConnectedNodePairArray. + :rtype: List[ConnectedNodePair] + """ + return self._connected_nodes + + @connected_nodes.setter + def connected_nodes(self, connected_nodes): + """Sets the connected_nodes of this ConnectedNodePairArray. + + An array of conncted node pairs. # noqa: E501 + + :param connected_nodes: The connected_nodes of this ConnectedNodePairArray. + :type connected_nodes: List[ConnectedNodePair] + """ + + self._connected_nodes = connected_nodes diff --git a/apps/schematic/api/schematic_api/models/connected_nodes_page.py b/apps/schematic/api/schematic_api/models/connected_node_pair_page.py similarity index 66% rename from apps/schematic/api/schematic_api/models/connected_nodes_page.py rename to apps/schematic/api/schematic_api/models/connected_node_pair_page.py index 955284d5b6..2927cbea99 100644 --- a/apps/schematic/api/schematic_api/models/connected_nodes_page.py +++ b/apps/schematic/api/schematic_api/models/connected_node_pair_page.py @@ -6,34 +6,34 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.connected_nodes import ConnectedNodes +from schematic_api.models.connected_node_pair import ConnectedNodePair from schematic_api import util -from schematic_api.models.connected_nodes import ConnectedNodes # noqa: E501 +from schematic_api.models.connected_node_pair import ConnectedNodePair # noqa: E501 -class ConnectedNodesPage(Model): +class ConnectedNodePairPage(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, connected_nodes=None): # noqa: E501 - """ConnectedNodesPage - a model defined in OpenAPI + """ConnectedNodePairPage - a model defined in OpenAPI - :param number: The number of this ConnectedNodesPage. # noqa: E501 + :param number: The number of this ConnectedNodePairPage. # noqa: E501 :type number: int - :param size: The size of this ConnectedNodesPage. # noqa: E501 + :param size: The size of this ConnectedNodePairPage. # noqa: E501 :type size: int - :param total_elements: The total_elements of this ConnectedNodesPage. # noqa: E501 + :param total_elements: The total_elements of this ConnectedNodePairPage. # noqa: E501 :type total_elements: int - :param total_pages: The total_pages of this ConnectedNodesPage. # noqa: E501 + :param total_pages: The total_pages of this ConnectedNodePairPage. # noqa: E501 :type total_pages: int - :param has_next: The has_next of this ConnectedNodesPage. # noqa: E501 + :param has_next: The has_next of this ConnectedNodePairPage. # noqa: E501 :type has_next: bool - :param has_previous: The has_previous of this ConnectedNodesPage. # noqa: E501 + :param has_previous: The has_previous of this ConnectedNodePairPage. # noqa: E501 :type has_previous: bool - :param connected_nodes: The connected_nodes of this ConnectedNodesPage. # noqa: E501 - :type connected_nodes: List[ConnectedNodes] + :param connected_nodes: The connected_nodes of this ConnectedNodePairPage. # noqa: E501 + :type connected_nodes: List[ConnectedNodePair] """ self.openapi_types = { 'number': int, @@ -42,7 +42,7 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None 'total_pages': int, 'has_next': bool, 'has_previous': bool, - 'connected_nodes': List[ConnectedNodes] + 'connected_nodes': List[ConnectedNodePair] } self.attribute_map = { @@ -52,7 +52,7 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None 'total_pages': 'totalPages', 'has_next': 'hasNext', 'has_previous': 'hasPrevious', - 'connected_nodes': 'connected_nodes' + 'connected_nodes': 'connectedNodes' } self._number = number @@ -64,34 +64,34 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None self._connected_nodes = connected_nodes @classmethod - def from_dict(cls, dikt) -> 'ConnectedNodesPage': + def from_dict(cls, dikt) -> 'ConnectedNodePairPage': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ConnectedNodesPage of this ConnectedNodesPage. # noqa: E501 - :rtype: ConnectedNodesPage + :return: The ConnectedNodePairPage of this ConnectedNodePairPage. # noqa: E501 + :rtype: ConnectedNodePairPage """ return util.deserialize_model(dikt, cls) @property def number(self): - """Gets the number of this ConnectedNodesPage. + """Gets the number of this ConnectedNodePairPage. The page number. # noqa: E501 - :return: The number of this ConnectedNodesPage. + :return: The number of this ConnectedNodePairPage. :rtype: int """ return self._number @number.setter def number(self, number): - """Sets the number of this ConnectedNodesPage. + """Sets the number of this ConnectedNodePairPage. The page number. # noqa: E501 - :param number: The number of this ConnectedNodesPage. + :param number: The number of this ConnectedNodePairPage. :type number: int """ if number is None: @@ -101,22 +101,22 @@ def number(self, number): @property def size(self): - """Gets the size of this ConnectedNodesPage. + """Gets the size of this ConnectedNodePairPage. The number of items in a single page. # noqa: E501 - :return: The size of this ConnectedNodesPage. + :return: The size of this ConnectedNodePairPage. :rtype: int """ return self._size @size.setter def size(self, size): - """Sets the size of this ConnectedNodesPage. + """Sets the size of this ConnectedNodePairPage. The number of items in a single page. # noqa: E501 - :param size: The size of this ConnectedNodesPage. + :param size: The size of this ConnectedNodePairPage. :type size: int """ if size is None: @@ -126,22 +126,22 @@ def size(self, size): @property def total_elements(self): - """Gets the total_elements of this ConnectedNodesPage. + """Gets the total_elements of this ConnectedNodePairPage. Total number of elements in the result set. # noqa: E501 - :return: The total_elements of this ConnectedNodesPage. + :return: The total_elements of this ConnectedNodePairPage. :rtype: int """ return self._total_elements @total_elements.setter def total_elements(self, total_elements): - """Sets the total_elements of this ConnectedNodesPage. + """Sets the total_elements of this ConnectedNodePairPage. Total number of elements in the result set. # noqa: E501 - :param total_elements: The total_elements of this ConnectedNodesPage. + :param total_elements: The total_elements of this ConnectedNodePairPage. :type total_elements: int """ if total_elements is None: @@ -151,22 +151,22 @@ def total_elements(self, total_elements): @property def total_pages(self): - """Gets the total_pages of this ConnectedNodesPage. + """Gets the total_pages of this ConnectedNodePairPage. Total number of pages in the result set. # noqa: E501 - :return: The total_pages of this ConnectedNodesPage. + :return: The total_pages of this ConnectedNodePairPage. :rtype: int """ return self._total_pages @total_pages.setter def total_pages(self, total_pages): - """Sets the total_pages of this ConnectedNodesPage. + """Sets the total_pages of this ConnectedNodePairPage. Total number of pages in the result set. # noqa: E501 - :param total_pages: The total_pages of this ConnectedNodesPage. + :param total_pages: The total_pages of this ConnectedNodePairPage. :type total_pages: int """ if total_pages is None: @@ -176,22 +176,22 @@ def total_pages(self, total_pages): @property def has_next(self): - """Gets the has_next of this ConnectedNodesPage. + """Gets the has_next of this ConnectedNodePairPage. Returns if there is a next page. # noqa: E501 - :return: The has_next of this ConnectedNodesPage. + :return: The has_next of this ConnectedNodePairPage. :rtype: bool """ return self._has_next @has_next.setter def has_next(self, has_next): - """Sets the has_next of this ConnectedNodesPage. + """Sets the has_next of this ConnectedNodePairPage. Returns if there is a next page. # noqa: E501 - :param has_next: The has_next of this ConnectedNodesPage. + :param has_next: The has_next of this ConnectedNodePairPage. :type has_next: bool """ if has_next is None: @@ -201,22 +201,22 @@ def has_next(self, has_next): @property def has_previous(self): - """Gets the has_previous of this ConnectedNodesPage. + """Gets the has_previous of this ConnectedNodePairPage. Returns if there is a previous page. # noqa: E501 - :return: The has_previous of this ConnectedNodesPage. + :return: The has_previous of this ConnectedNodePairPage. :rtype: bool """ return self._has_previous @has_previous.setter def has_previous(self, has_previous): - """Sets the has_previous of this ConnectedNodesPage. + """Sets the has_previous of this ConnectedNodePairPage. Returns if there is a previous page. # noqa: E501 - :param has_previous: The has_previous of this ConnectedNodesPage. + :param has_previous: The has_previous of this ConnectedNodePairPage. :type has_previous: bool """ if has_previous is None: @@ -226,23 +226,23 @@ def has_previous(self, has_previous): @property def connected_nodes(self): - """Gets the connected_nodes of this ConnectedNodesPage. + """Gets the connected_nodes of this ConnectedNodePairPage. - A list of conncted node pairs. # noqa: E501 + An array of conncted node pairs. # noqa: E501 - :return: The connected_nodes of this ConnectedNodesPage. - :rtype: List[ConnectedNodes] + :return: The connected_nodes of this ConnectedNodePairPage. + :rtype: List[ConnectedNodePair] """ return self._connected_nodes @connected_nodes.setter def connected_nodes(self, connected_nodes): - """Sets the connected_nodes of this ConnectedNodesPage. + """Sets the connected_nodes of this ConnectedNodePairPage. - A list of conncted node pairs. # noqa: E501 + An array of conncted node pairs. # noqa: E501 - :param connected_nodes: The connected_nodes of this ConnectedNodesPage. - :type connected_nodes: List[ConnectedNodes] + :param connected_nodes: The connected_nodes of this ConnectedNodePairPage. + :type connected_nodes: List[ConnectedNodePair] """ if connected_nodes is None: raise ValueError("Invalid value for `connected_nodes`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/connected_nodes_page_all_of.py b/apps/schematic/api/schematic_api/models/connected_node_pair_page_all_of.py similarity index 53% rename from apps/schematic/api/schematic_api/models/connected_nodes_page_all_of.py rename to apps/schematic/api/schematic_api/models/connected_node_pair_page_all_of.py index ec87c2b6f2..7d8dffd25c 100644 --- a/apps/schematic/api/schematic_api/models/connected_nodes_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/connected_node_pair_page_all_of.py @@ -6,63 +6,63 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.connected_nodes import ConnectedNodes +from schematic_api.models.connected_node_pair import ConnectedNodePair from schematic_api import util -from schematic_api.models.connected_nodes import ConnectedNodes # noqa: E501 +from schematic_api.models.connected_node_pair import ConnectedNodePair # noqa: E501 -class ConnectedNodesPageAllOf(Model): +class ConnectedNodePairPageAllOf(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, connected_nodes=None): # noqa: E501 - """ConnectedNodesPageAllOf - a model defined in OpenAPI + """ConnectedNodePairPageAllOf - a model defined in OpenAPI - :param connected_nodes: The connected_nodes of this ConnectedNodesPageAllOf. # noqa: E501 - :type connected_nodes: List[ConnectedNodes] + :param connected_nodes: The connected_nodes of this ConnectedNodePairPageAllOf. # noqa: E501 + :type connected_nodes: List[ConnectedNodePair] """ self.openapi_types = { - 'connected_nodes': List[ConnectedNodes] + 'connected_nodes': List[ConnectedNodePair] } self.attribute_map = { - 'connected_nodes': 'connected_nodes' + 'connected_nodes': 'connectedNodes' } self._connected_nodes = connected_nodes @classmethod - def from_dict(cls, dikt) -> 'ConnectedNodesPageAllOf': + def from_dict(cls, dikt) -> 'ConnectedNodePairPageAllOf': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ConnectedNodesPage_allOf of this ConnectedNodesPageAllOf. # noqa: E501 - :rtype: ConnectedNodesPageAllOf + :return: The ConnectedNodePairPage_allOf of this ConnectedNodePairPageAllOf. # noqa: E501 + :rtype: ConnectedNodePairPageAllOf """ return util.deserialize_model(dikt, cls) @property def connected_nodes(self): - """Gets the connected_nodes of this ConnectedNodesPageAllOf. + """Gets the connected_nodes of this ConnectedNodePairPageAllOf. - A list of conncted node pairs. # noqa: E501 + An array of conncted node pairs. # noqa: E501 - :return: The connected_nodes of this ConnectedNodesPageAllOf. - :rtype: List[ConnectedNodes] + :return: The connected_nodes of this ConnectedNodePairPageAllOf. + :rtype: List[ConnectedNodePair] """ return self._connected_nodes @connected_nodes.setter def connected_nodes(self, connected_nodes): - """Sets the connected_nodes of this ConnectedNodesPageAllOf. + """Sets the connected_nodes of this ConnectedNodePairPageAllOf. - A list of conncted node pairs. # noqa: E501 + An array of conncted node pairs. # noqa: E501 - :param connected_nodes: The connected_nodes of this ConnectedNodesPageAllOf. - :type connected_nodes: List[ConnectedNodes] + :param connected_nodes: The connected_nodes of this ConnectedNodePairPageAllOf. + :type connected_nodes: List[ConnectedNodePair] """ if connected_nodes is None: raise ValueError("Invalid value for `connected_nodes`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/dataset.py b/apps/schematic/api/schematic_api/models/dataset_metadata.py similarity index 68% rename from apps/schematic/api/schematic_api/models/dataset.py rename to apps/schematic/api/schematic_api/models/dataset_metadata.py index 817f6245c7..ce06f6c1a1 100644 --- a/apps/schematic/api/schematic_api/models/dataset.py +++ b/apps/schematic/api/schematic_api/models/dataset_metadata.py @@ -9,18 +9,18 @@ from schematic_api import util -class Dataset(Model): +class DatasetMetadata(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, name=None, id=None): # noqa: E501 - """Dataset - a model defined in OpenAPI + """DatasetMetadata - a model defined in OpenAPI - :param name: The name of this Dataset. # noqa: E501 + :param name: The name of this DatasetMetadata. # noqa: E501 :type name: str - :param id: The id of this Dataset. # noqa: E501 + :param id: The id of this DatasetMetadata. # noqa: E501 :type id: str """ self.openapi_types = { @@ -37,34 +37,34 @@ def __init__(self, name=None, id=None): # noqa: E501 self._id = id @classmethod - def from_dict(cls, dikt) -> 'Dataset': + def from_dict(cls, dikt) -> 'DatasetMetadata': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The Dataset of this Dataset. # noqa: E501 - :rtype: Dataset + :return: The DatasetMetadata of this DatasetMetadata. # noqa: E501 + :rtype: DatasetMetadata """ return util.deserialize_model(dikt, cls) @property def name(self): - """Gets the name of this Dataset. + """Gets the name of this DatasetMetadata. The name of the dataset. # noqa: E501 - :return: The name of this Dataset. + :return: The name of this DatasetMetadata. :rtype: str """ return self._name @name.setter def name(self, name): - """Sets the name of this Dataset. + """Sets the name of this DatasetMetadata. The name of the dataset. # noqa: E501 - :param name: The name of this Dataset. + :param name: The name of this DatasetMetadata. :type name: str """ if name is None: @@ -74,22 +74,22 @@ def name(self, name): @property def id(self): - """Gets the id of this Dataset. + """Gets the id of this DatasetMetadata. The ID of the dataset. # noqa: E501 - :return: The id of this Dataset. + :return: The id of this DatasetMetadata. :rtype: str """ return self._id @id.setter def id(self, id): - """Sets the id of this Dataset. + """Sets the id of this DatasetMetadata. The ID of the dataset. # noqa: E501 - :param id: The id of this Dataset. + :param id: The id of this DatasetMetadata. :type id: str """ if id is None: diff --git a/apps/schematic/api/schematic_api/models/dataset_metadata_array.py b/apps/schematic/api/schematic_api/models/dataset_metadata_array.py new file mode 100644 index 0000000000..3aed1099b5 --- /dev/null +++ b/apps/schematic/api/schematic_api/models/dataset_metadata_array.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.dataset_metadata import DatasetMetadata +from schematic_api import util + +from schematic_api.models.dataset_metadata import DatasetMetadata # noqa: E501 + +class DatasetMetadataArray(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, datasets=None): # noqa: E501 + """DatasetMetadataArray - a model defined in OpenAPI + + :param datasets: The datasets of this DatasetMetadataArray. # noqa: E501 + :type datasets: List[DatasetMetadata] + """ + self.openapi_types = { + 'datasets': List[DatasetMetadata] + } + + self.attribute_map = { + 'datasets': 'datasets' + } + + self._datasets = datasets + + @classmethod + def from_dict(cls, dikt) -> 'DatasetMetadataArray': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The DatasetMetadataArray of this DatasetMetadataArray. # noqa: E501 + :rtype: DatasetMetadataArray + """ + return util.deserialize_model(dikt, cls) + + @property + def datasets(self): + """Gets the datasets of this DatasetMetadataArray. + + An array of dataset meatdata. # noqa: E501 + + :return: The datasets of this DatasetMetadataArray. + :rtype: List[DatasetMetadata] + """ + return self._datasets + + @datasets.setter + def datasets(self, datasets): + """Sets the datasets of this DatasetMetadataArray. + + An array of dataset meatdata. # noqa: E501 + + :param datasets: The datasets of this DatasetMetadataArray. + :type datasets: List[DatasetMetadata] + """ + + self._datasets = datasets diff --git a/apps/schematic/api/schematic_api/models/datasets_page.py b/apps/schematic/api/schematic_api/models/dataset_metadata_page.py similarity index 64% rename from apps/schematic/api/schematic_api/models/datasets_page.py rename to apps/schematic/api/schematic_api/models/dataset_metadata_page.py index a217f8f771..6b35d2b6d6 100644 --- a/apps/schematic/api/schematic_api/models/datasets_page.py +++ b/apps/schematic/api/schematic_api/models/dataset_metadata_page.py @@ -6,34 +6,34 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.dataset import Dataset +from schematic_api.models.dataset_metadata import DatasetMetadata from schematic_api import util -from schematic_api.models.dataset import Dataset # noqa: E501 +from schematic_api.models.dataset_metadata import DatasetMetadata # noqa: E501 -class DatasetsPage(Model): +class DatasetMetadataPage(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, datasets=None): # noqa: E501 - """DatasetsPage - a model defined in OpenAPI + """DatasetMetadataPage - a model defined in OpenAPI - :param number: The number of this DatasetsPage. # noqa: E501 + :param number: The number of this DatasetMetadataPage. # noqa: E501 :type number: int - :param size: The size of this DatasetsPage. # noqa: E501 + :param size: The size of this DatasetMetadataPage. # noqa: E501 :type size: int - :param total_elements: The total_elements of this DatasetsPage. # noqa: E501 + :param total_elements: The total_elements of this DatasetMetadataPage. # noqa: E501 :type total_elements: int - :param total_pages: The total_pages of this DatasetsPage. # noqa: E501 + :param total_pages: The total_pages of this DatasetMetadataPage. # noqa: E501 :type total_pages: int - :param has_next: The has_next of this DatasetsPage. # noqa: E501 + :param has_next: The has_next of this DatasetMetadataPage. # noqa: E501 :type has_next: bool - :param has_previous: The has_previous of this DatasetsPage. # noqa: E501 + :param has_previous: The has_previous of this DatasetMetadataPage. # noqa: E501 :type has_previous: bool - :param datasets: The datasets of this DatasetsPage. # noqa: E501 - :type datasets: List[Dataset] + :param datasets: The datasets of this DatasetMetadataPage. # noqa: E501 + :type datasets: List[DatasetMetadata] """ self.openapi_types = { 'number': int, @@ -42,7 +42,7 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None 'total_pages': int, 'has_next': bool, 'has_previous': bool, - 'datasets': List[Dataset] + 'datasets': List[DatasetMetadata] } self.attribute_map = { @@ -64,34 +64,34 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None self._datasets = datasets @classmethod - def from_dict(cls, dikt) -> 'DatasetsPage': + def from_dict(cls, dikt) -> 'DatasetMetadataPage': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The DatasetsPage of this DatasetsPage. # noqa: E501 - :rtype: DatasetsPage + :return: The DatasetMetadataPage of this DatasetMetadataPage. # noqa: E501 + :rtype: DatasetMetadataPage """ return util.deserialize_model(dikt, cls) @property def number(self): - """Gets the number of this DatasetsPage. + """Gets the number of this DatasetMetadataPage. The page number. # noqa: E501 - :return: The number of this DatasetsPage. + :return: The number of this DatasetMetadataPage. :rtype: int """ return self._number @number.setter def number(self, number): - """Sets the number of this DatasetsPage. + """Sets the number of this DatasetMetadataPage. The page number. # noqa: E501 - :param number: The number of this DatasetsPage. + :param number: The number of this DatasetMetadataPage. :type number: int """ if number is None: @@ -101,22 +101,22 @@ def number(self, number): @property def size(self): - """Gets the size of this DatasetsPage. + """Gets the size of this DatasetMetadataPage. The number of items in a single page. # noqa: E501 - :return: The size of this DatasetsPage. + :return: The size of this DatasetMetadataPage. :rtype: int """ return self._size @size.setter def size(self, size): - """Sets the size of this DatasetsPage. + """Sets the size of this DatasetMetadataPage. The number of items in a single page. # noqa: E501 - :param size: The size of this DatasetsPage. + :param size: The size of this DatasetMetadataPage. :type size: int """ if size is None: @@ -126,22 +126,22 @@ def size(self, size): @property def total_elements(self): - """Gets the total_elements of this DatasetsPage. + """Gets the total_elements of this DatasetMetadataPage. Total number of elements in the result set. # noqa: E501 - :return: The total_elements of this DatasetsPage. + :return: The total_elements of this DatasetMetadataPage. :rtype: int """ return self._total_elements @total_elements.setter def total_elements(self, total_elements): - """Sets the total_elements of this DatasetsPage. + """Sets the total_elements of this DatasetMetadataPage. Total number of elements in the result set. # noqa: E501 - :param total_elements: The total_elements of this DatasetsPage. + :param total_elements: The total_elements of this DatasetMetadataPage. :type total_elements: int """ if total_elements is None: @@ -151,22 +151,22 @@ def total_elements(self, total_elements): @property def total_pages(self): - """Gets the total_pages of this DatasetsPage. + """Gets the total_pages of this DatasetMetadataPage. Total number of pages in the result set. # noqa: E501 - :return: The total_pages of this DatasetsPage. + :return: The total_pages of this DatasetMetadataPage. :rtype: int """ return self._total_pages @total_pages.setter def total_pages(self, total_pages): - """Sets the total_pages of this DatasetsPage. + """Sets the total_pages of this DatasetMetadataPage. Total number of pages in the result set. # noqa: E501 - :param total_pages: The total_pages of this DatasetsPage. + :param total_pages: The total_pages of this DatasetMetadataPage. :type total_pages: int """ if total_pages is None: @@ -176,22 +176,22 @@ def total_pages(self, total_pages): @property def has_next(self): - """Gets the has_next of this DatasetsPage. + """Gets the has_next of this DatasetMetadataPage. Returns if there is a next page. # noqa: E501 - :return: The has_next of this DatasetsPage. + :return: The has_next of this DatasetMetadataPage. :rtype: bool """ return self._has_next @has_next.setter def has_next(self, has_next): - """Sets the has_next of this DatasetsPage. + """Sets the has_next of this DatasetMetadataPage. Returns if there is a next page. # noqa: E501 - :param has_next: The has_next of this DatasetsPage. + :param has_next: The has_next of this DatasetMetadataPage. :type has_next: bool """ if has_next is None: @@ -201,22 +201,22 @@ def has_next(self, has_next): @property def has_previous(self): - """Gets the has_previous of this DatasetsPage. + """Gets the has_previous of this DatasetMetadataPage. Returns if there is a previous page. # noqa: E501 - :return: The has_previous of this DatasetsPage. + :return: The has_previous of this DatasetMetadataPage. :rtype: bool """ return self._has_previous @has_previous.setter def has_previous(self, has_previous): - """Sets the has_previous of this DatasetsPage. + """Sets the has_previous of this DatasetMetadataPage. Returns if there is a previous page. # noqa: E501 - :param has_previous: The has_previous of this DatasetsPage. + :param has_previous: The has_previous of this DatasetMetadataPage. :type has_previous: bool """ if has_previous is None: @@ -226,23 +226,23 @@ def has_previous(self, has_previous): @property def datasets(self): - """Gets the datasets of this DatasetsPage. + """Gets the datasets of this DatasetMetadataPage. - A list of datasets. # noqa: E501 + An array of dataset meatdata. # noqa: E501 - :return: The datasets of this DatasetsPage. - :rtype: List[Dataset] + :return: The datasets of this DatasetMetadataPage. + :rtype: List[DatasetMetadata] """ return self._datasets @datasets.setter def datasets(self, datasets): - """Sets the datasets of this DatasetsPage. + """Sets the datasets of this DatasetMetadataPage. - A list of datasets. # noqa: E501 + An array of dataset meatdata. # noqa: E501 - :param datasets: The datasets of this DatasetsPage. - :type datasets: List[Dataset] + :param datasets: The datasets of this DatasetMetadataPage. + :type datasets: List[DatasetMetadata] """ if datasets is None: raise ValueError("Invalid value for `datasets`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/datasets_page_all_of.py b/apps/schematic/api/schematic_api/models/dataset_metadata_page_all_of.py similarity index 50% rename from apps/schematic/api/schematic_api/models/datasets_page_all_of.py rename to apps/schematic/api/schematic_api/models/dataset_metadata_page_all_of.py index 6d6d5a4292..c41f504aad 100644 --- a/apps/schematic/api/schematic_api/models/datasets_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/dataset_metadata_page_all_of.py @@ -6,25 +6,25 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.dataset import Dataset +from schematic_api.models.dataset_metadata import DatasetMetadata from schematic_api import util -from schematic_api.models.dataset import Dataset # noqa: E501 +from schematic_api.models.dataset_metadata import DatasetMetadata # noqa: E501 -class DatasetsPageAllOf(Model): +class DatasetMetadataPageAllOf(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, datasets=None): # noqa: E501 - """DatasetsPageAllOf - a model defined in OpenAPI + """DatasetMetadataPageAllOf - a model defined in OpenAPI - :param datasets: The datasets of this DatasetsPageAllOf. # noqa: E501 - :type datasets: List[Dataset] + :param datasets: The datasets of this DatasetMetadataPageAllOf. # noqa: E501 + :type datasets: List[DatasetMetadata] """ self.openapi_types = { - 'datasets': List[Dataset] + 'datasets': List[DatasetMetadata] } self.attribute_map = { @@ -34,35 +34,35 @@ def __init__(self, datasets=None): # noqa: E501 self._datasets = datasets @classmethod - def from_dict(cls, dikt) -> 'DatasetsPageAllOf': + def from_dict(cls, dikt) -> 'DatasetMetadataPageAllOf': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The DatasetsPage_allOf of this DatasetsPageAllOf. # noqa: E501 - :rtype: DatasetsPageAllOf + :return: The DatasetMetadataPage_allOf of this DatasetMetadataPageAllOf. # noqa: E501 + :rtype: DatasetMetadataPageAllOf """ return util.deserialize_model(dikt, cls) @property def datasets(self): - """Gets the datasets of this DatasetsPageAllOf. + """Gets the datasets of this DatasetMetadataPageAllOf. - A list of datasets. # noqa: E501 + An array of dataset meatdata. # noqa: E501 - :return: The datasets of this DatasetsPageAllOf. - :rtype: List[Dataset] + :return: The datasets of this DatasetMetadataPageAllOf. + :rtype: List[DatasetMetadata] """ return self._datasets @datasets.setter def datasets(self, datasets): - """Sets the datasets of this DatasetsPageAllOf. + """Sets the datasets of this DatasetMetadataPageAllOf. - A list of datasets. # noqa: E501 + An array of dataset meatdata. # noqa: E501 - :param datasets: The datasets of this DatasetsPageAllOf. - :type datasets: List[Dataset] + :param datasets: The datasets of this DatasetMetadataPageAllOf. + :type datasets: List[DatasetMetadata] """ if datasets is None: raise ValueError("Invalid value for `datasets`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/file.py b/apps/schematic/api/schematic_api/models/file_metadata.py similarity index 69% rename from apps/schematic/api/schematic_api/models/file.py rename to apps/schematic/api/schematic_api/models/file_metadata.py index 23b2476846..6613715516 100644 --- a/apps/schematic/api/schematic_api/models/file.py +++ b/apps/schematic/api/schematic_api/models/file_metadata.py @@ -9,18 +9,18 @@ from schematic_api import util -class File(Model): +class FileMetadata(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, name=None, id=None): # noqa: E501 - """File - a model defined in OpenAPI + """FileMetadata - a model defined in OpenAPI - :param name: The name of this File. # noqa: E501 + :param name: The name of this FileMetadata. # noqa: E501 :type name: str - :param id: The id of this File. # noqa: E501 + :param id: The id of this FileMetadata. # noqa: E501 :type id: str """ self.openapi_types = { @@ -37,34 +37,34 @@ def __init__(self, name=None, id=None): # noqa: E501 self._id = id @classmethod - def from_dict(cls, dikt) -> 'File': + def from_dict(cls, dikt) -> 'FileMetadata': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The File of this File. # noqa: E501 - :rtype: File + :return: The FileMetadata of this FileMetadata. # noqa: E501 + :rtype: FileMetadata """ return util.deserialize_model(dikt, cls) @property def name(self): - """Gets the name of this File. + """Gets the name of this FileMetadata. The name of the file. # noqa: E501 - :return: The name of this File. + :return: The name of this FileMetadata. :rtype: str """ return self._name @name.setter def name(self, name): - """Sets the name of this File. + """Sets the name of this FileMetadata. The name of the file. # noqa: E501 - :param name: The name of this File. + :param name: The name of this FileMetadata. :type name: str """ if name is None: @@ -74,22 +74,22 @@ def name(self, name): @property def id(self): - """Gets the id of this File. + """Gets the id of this FileMetadata. The ID of the file. # noqa: E501 - :return: The id of this File. + :return: The id of this FileMetadata. :rtype: str """ return self._id @id.setter def id(self, id): - """Sets the id of this File. + """Sets the id of this FileMetadata. The ID of the file. # noqa: E501 - :param id: The id of this File. + :param id: The id of this FileMetadata. :type id: str """ if id is None: diff --git a/apps/schematic/api/schematic_api/models/file_metadata_array.py b/apps/schematic/api/schematic_api/models/file_metadata_array.py new file mode 100644 index 0000000000..bf81db2019 --- /dev/null +++ b/apps/schematic/api/schematic_api/models/file_metadata_array.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.file_metadata import FileMetadata +from schematic_api import util + +from schematic_api.models.file_metadata import FileMetadata # noqa: E501 + +class FileMetadataArray(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, files=None): # noqa: E501 + """FileMetadataArray - a model defined in OpenAPI + + :param files: The files of this FileMetadataArray. # noqa: E501 + :type files: List[FileMetadata] + """ + self.openapi_types = { + 'files': List[FileMetadata] + } + + self.attribute_map = { + 'files': 'files' + } + + self._files = files + + @classmethod + def from_dict(cls, dikt) -> 'FileMetadataArray': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The FileMetadataArray of this FileMetadataArray. # noqa: E501 + :rtype: FileMetadataArray + """ + return util.deserialize_model(dikt, cls) + + @property + def files(self): + """Gets the files of this FileMetadataArray. + + A list of file metadata. # noqa: E501 + + :return: The files of this FileMetadataArray. + :rtype: List[FileMetadata] + """ + return self._files + + @files.setter + def files(self, files): + """Sets the files of this FileMetadataArray. + + A list of file metadata. # noqa: E501 + + :param files: The files of this FileMetadataArray. + :type files: List[FileMetadata] + """ + + self._files = files diff --git a/apps/schematic/api/schematic_api/models/files_page.py b/apps/schematic/api/schematic_api/models/file_metadata_page.py similarity index 63% rename from apps/schematic/api/schematic_api/models/files_page.py rename to apps/schematic/api/schematic_api/models/file_metadata_page.py index ff980fd56f..0156a706c7 100644 --- a/apps/schematic/api/schematic_api/models/files_page.py +++ b/apps/schematic/api/schematic_api/models/file_metadata_page.py @@ -6,34 +6,34 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.file import File +from schematic_api.models.file_metadata import FileMetadata from schematic_api import util -from schematic_api.models.file import File # noqa: E501 +from schematic_api.models.file_metadata import FileMetadata # noqa: E501 -class FilesPage(Model): +class FileMetadataPage(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, files=None): # noqa: E501 - """FilesPage - a model defined in OpenAPI + """FileMetadataPage - a model defined in OpenAPI - :param number: The number of this FilesPage. # noqa: E501 + :param number: The number of this FileMetadataPage. # noqa: E501 :type number: int - :param size: The size of this FilesPage. # noqa: E501 + :param size: The size of this FileMetadataPage. # noqa: E501 :type size: int - :param total_elements: The total_elements of this FilesPage. # noqa: E501 + :param total_elements: The total_elements of this FileMetadataPage. # noqa: E501 :type total_elements: int - :param total_pages: The total_pages of this FilesPage. # noqa: E501 + :param total_pages: The total_pages of this FileMetadataPage. # noqa: E501 :type total_pages: int - :param has_next: The has_next of this FilesPage. # noqa: E501 + :param has_next: The has_next of this FileMetadataPage. # noqa: E501 :type has_next: bool - :param has_previous: The has_previous of this FilesPage. # noqa: E501 + :param has_previous: The has_previous of this FileMetadataPage. # noqa: E501 :type has_previous: bool - :param files: The files of this FilesPage. # noqa: E501 - :type files: List[File] + :param files: The files of this FileMetadataPage. # noqa: E501 + :type files: List[FileMetadata] """ self.openapi_types = { 'number': int, @@ -42,7 +42,7 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None 'total_pages': int, 'has_next': bool, 'has_previous': bool, - 'files': List[File] + 'files': List[FileMetadata] } self.attribute_map = { @@ -64,34 +64,34 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None self._files = files @classmethod - def from_dict(cls, dikt) -> 'FilesPage': + def from_dict(cls, dikt) -> 'FileMetadataPage': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The FilesPage of this FilesPage. # noqa: E501 - :rtype: FilesPage + :return: The FileMetadataPage of this FileMetadataPage. # noqa: E501 + :rtype: FileMetadataPage """ return util.deserialize_model(dikt, cls) @property def number(self): - """Gets the number of this FilesPage. + """Gets the number of this FileMetadataPage. The page number. # noqa: E501 - :return: The number of this FilesPage. + :return: The number of this FileMetadataPage. :rtype: int """ return self._number @number.setter def number(self, number): - """Sets the number of this FilesPage. + """Sets the number of this FileMetadataPage. The page number. # noqa: E501 - :param number: The number of this FilesPage. + :param number: The number of this FileMetadataPage. :type number: int """ if number is None: @@ -101,22 +101,22 @@ def number(self, number): @property def size(self): - """Gets the size of this FilesPage. + """Gets the size of this FileMetadataPage. The number of items in a single page. # noqa: E501 - :return: The size of this FilesPage. + :return: The size of this FileMetadataPage. :rtype: int """ return self._size @size.setter def size(self, size): - """Sets the size of this FilesPage. + """Sets the size of this FileMetadataPage. The number of items in a single page. # noqa: E501 - :param size: The size of this FilesPage. + :param size: The size of this FileMetadataPage. :type size: int """ if size is None: @@ -126,22 +126,22 @@ def size(self, size): @property def total_elements(self): - """Gets the total_elements of this FilesPage. + """Gets the total_elements of this FileMetadataPage. Total number of elements in the result set. # noqa: E501 - :return: The total_elements of this FilesPage. + :return: The total_elements of this FileMetadataPage. :rtype: int """ return self._total_elements @total_elements.setter def total_elements(self, total_elements): - """Sets the total_elements of this FilesPage. + """Sets the total_elements of this FileMetadataPage. Total number of elements in the result set. # noqa: E501 - :param total_elements: The total_elements of this FilesPage. + :param total_elements: The total_elements of this FileMetadataPage. :type total_elements: int """ if total_elements is None: @@ -151,22 +151,22 @@ def total_elements(self, total_elements): @property def total_pages(self): - """Gets the total_pages of this FilesPage. + """Gets the total_pages of this FileMetadataPage. Total number of pages in the result set. # noqa: E501 - :return: The total_pages of this FilesPage. + :return: The total_pages of this FileMetadataPage. :rtype: int """ return self._total_pages @total_pages.setter def total_pages(self, total_pages): - """Sets the total_pages of this FilesPage. + """Sets the total_pages of this FileMetadataPage. Total number of pages in the result set. # noqa: E501 - :param total_pages: The total_pages of this FilesPage. + :param total_pages: The total_pages of this FileMetadataPage. :type total_pages: int """ if total_pages is None: @@ -176,22 +176,22 @@ def total_pages(self, total_pages): @property def has_next(self): - """Gets the has_next of this FilesPage. + """Gets the has_next of this FileMetadataPage. Returns if there is a next page. # noqa: E501 - :return: The has_next of this FilesPage. + :return: The has_next of this FileMetadataPage. :rtype: bool """ return self._has_next @has_next.setter def has_next(self, has_next): - """Sets the has_next of this FilesPage. + """Sets the has_next of this FileMetadataPage. Returns if there is a next page. # noqa: E501 - :param has_next: The has_next of this FilesPage. + :param has_next: The has_next of this FileMetadataPage. :type has_next: bool """ if has_next is None: @@ -201,22 +201,22 @@ def has_next(self, has_next): @property def has_previous(self): - """Gets the has_previous of this FilesPage. + """Gets the has_previous of this FileMetadataPage. Returns if there is a previous page. # noqa: E501 - :return: The has_previous of this FilesPage. + :return: The has_previous of this FileMetadataPage. :rtype: bool """ return self._has_previous @has_previous.setter def has_previous(self, has_previous): - """Sets the has_previous of this FilesPage. + """Sets the has_previous of this FileMetadataPage. Returns if there is a previous page. # noqa: E501 - :param has_previous: The has_previous of this FilesPage. + :param has_previous: The has_previous of this FileMetadataPage. :type has_previous: bool """ if has_previous is None: @@ -226,23 +226,23 @@ def has_previous(self, has_previous): @property def files(self): - """Gets the files of this FilesPage. + """Gets the files of this FileMetadataPage. - A list of files. # noqa: E501 + A list of file metadata. # noqa: E501 - :return: The files of this FilesPage. - :rtype: List[File] + :return: The files of this FileMetadataPage. + :rtype: List[FileMetadata] """ return self._files @files.setter def files(self, files): - """Sets the files of this FilesPage. + """Sets the files of this FileMetadataPage. - A list of files. # noqa: E501 + A list of file metadata. # noqa: E501 - :param files: The files of this FilesPage. - :type files: List[File] + :param files: The files of this FileMetadataPage. + :type files: List[FileMetadata] """ if files is None: raise ValueError("Invalid value for `files`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/files_page_all_of.py b/apps/schematic/api/schematic_api/models/file_metadata_page_all_of.py similarity index 51% rename from apps/schematic/api/schematic_api/models/files_page_all_of.py rename to apps/schematic/api/schematic_api/models/file_metadata_page_all_of.py index 75f6af8454..9f58aff27d 100644 --- a/apps/schematic/api/schematic_api/models/files_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/file_metadata_page_all_of.py @@ -6,25 +6,25 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.file import File +from schematic_api.models.file_metadata import FileMetadata from schematic_api import util -from schematic_api.models.file import File # noqa: E501 +from schematic_api.models.file_metadata import FileMetadata # noqa: E501 -class FilesPageAllOf(Model): +class FileMetadataPageAllOf(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, files=None): # noqa: E501 - """FilesPageAllOf - a model defined in OpenAPI + """FileMetadataPageAllOf - a model defined in OpenAPI - :param files: The files of this FilesPageAllOf. # noqa: E501 - :type files: List[File] + :param files: The files of this FileMetadataPageAllOf. # noqa: E501 + :type files: List[FileMetadata] """ self.openapi_types = { - 'files': List[File] + 'files': List[FileMetadata] } self.attribute_map = { @@ -34,35 +34,35 @@ def __init__(self, files=None): # noqa: E501 self._files = files @classmethod - def from_dict(cls, dikt) -> 'FilesPageAllOf': + def from_dict(cls, dikt) -> 'FileMetadataPageAllOf': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The FilesPage_allOf of this FilesPageAllOf. # noqa: E501 - :rtype: FilesPageAllOf + :return: The FileMetadataPage_allOf of this FileMetadataPageAllOf. # noqa: E501 + :rtype: FileMetadataPageAllOf """ return util.deserialize_model(dikt, cls) @property def files(self): - """Gets the files of this FilesPageAllOf. + """Gets the files of this FileMetadataPageAllOf. - A list of files. # noqa: E501 + A list of file metadata. # noqa: E501 - :return: The files of this FilesPageAllOf. - :rtype: List[File] + :return: The files of this FileMetadataPageAllOf. + :rtype: List[FileMetadata] """ return self._files @files.setter def files(self, files): - """Sets the files of this FilesPageAllOf. + """Sets the files of this FileMetadataPageAllOf. - A list of files. # noqa: E501 + A list of file metadata. # noqa: E501 - :param files: The files of this FilesPageAllOf. - :type files: List[File] + :param files: The files of this FileMetadataPageAllOf. + :type files: List[FileMetadata] """ if files is None: raise ValueError("Invalid value for `files`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/manifest.py b/apps/schematic/api/schematic_api/models/manifest_metadata.py similarity index 68% rename from apps/schematic/api/schematic_api/models/manifest.py rename to apps/schematic/api/schematic_api/models/manifest_metadata.py index 59951e63d5..16ca3e4196 100644 --- a/apps/schematic/api/schematic_api/models/manifest.py +++ b/apps/schematic/api/schematic_api/models/manifest_metadata.py @@ -9,24 +9,24 @@ from schematic_api import util -class Manifest(Model): +class ManifestMetadata(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, name=None, id=None, dataset_name=None, dataset_id=None, component_name=None): # noqa: E501 - """Manifest - a model defined in OpenAPI + """ManifestMetadata - a model defined in OpenAPI - :param name: The name of this Manifest. # noqa: E501 + :param name: The name of this ManifestMetadata. # noqa: E501 :type name: str - :param id: The id of this Manifest. # noqa: E501 + :param id: The id of this ManifestMetadata. # noqa: E501 :type id: str - :param dataset_name: The dataset_name of this Manifest. # noqa: E501 + :param dataset_name: The dataset_name of this ManifestMetadata. # noqa: E501 :type dataset_name: str - :param dataset_id: The dataset_id of this Manifest. # noqa: E501 + :param dataset_id: The dataset_id of this ManifestMetadata. # noqa: E501 :type dataset_id: str - :param component_name: The component_name of this Manifest. # noqa: E501 + :param component_name: The component_name of this ManifestMetadata. # noqa: E501 :type component_name: str """ self.openapi_types = { @@ -52,34 +52,34 @@ def __init__(self, name=None, id=None, dataset_name=None, dataset_id=None, compo self._component_name = component_name @classmethod - def from_dict(cls, dikt) -> 'Manifest': + def from_dict(cls, dikt) -> 'ManifestMetadata': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The Manifest of this Manifest. # noqa: E501 - :rtype: Manifest + :return: The ManifestMetadata of this ManifestMetadata. # noqa: E501 + :rtype: ManifestMetadata """ return util.deserialize_model(dikt, cls) @property def name(self): - """Gets the name of this Manifest. + """Gets the name of this ManifestMetadata. The name of the manifest file. # noqa: E501 - :return: The name of this Manifest. + :return: The name of this ManifestMetadata. :rtype: str """ return self._name @name.setter def name(self, name): - """Sets the name of this Manifest. + """Sets the name of this ManifestMetadata. The name of the manifest file. # noqa: E501 - :param name: The name of this Manifest. + :param name: The name of this ManifestMetadata. :type name: str """ if name is None: @@ -89,22 +89,22 @@ def name(self, name): @property def id(self): - """Gets the id of this Manifest. + """Gets the id of this ManifestMetadata. The id of the manifest file. # noqa: E501 - :return: The id of this Manifest. + :return: The id of this ManifestMetadata. :rtype: str """ return self._id @id.setter def id(self, id): - """Sets the id of this Manifest. + """Sets the id of this ManifestMetadata. The id of the manifest file. # noqa: E501 - :param id: The id of this Manifest. + :param id: The id of this ManifestMetadata. :type id: str """ if id is None: @@ -114,22 +114,22 @@ def id(self, id): @property def dataset_name(self): - """Gets the dataset_name of this Manifest. + """Gets the dataset_name of this ManifestMetadata. The name of the dataset the manifest belongs to. # noqa: E501 - :return: The dataset_name of this Manifest. + :return: The dataset_name of this ManifestMetadata. :rtype: str """ return self._dataset_name @dataset_name.setter def dataset_name(self, dataset_name): - """Sets the dataset_name of this Manifest. + """Sets the dataset_name of this ManifestMetadata. The name of the dataset the manifest belongs to. # noqa: E501 - :param dataset_name: The dataset_name of this Manifest. + :param dataset_name: The dataset_name of this ManifestMetadata. :type dataset_name: str """ @@ -137,22 +137,22 @@ def dataset_name(self, dataset_name): @property def dataset_id(self): - """Gets the dataset_id of this Manifest. + """Gets the dataset_id of this ManifestMetadata. The id of the dataset the manifest belongs to. # noqa: E501 - :return: The dataset_id of this Manifest. + :return: The dataset_id of this ManifestMetadata. :rtype: str """ return self._dataset_id @dataset_id.setter def dataset_id(self, dataset_id): - """Sets the dataset_id of this Manifest. + """Sets the dataset_id of this ManifestMetadata. The id of the dataset the manifest belongs to. # noqa: E501 - :param dataset_id: The dataset_id of this Manifest. + :param dataset_id: The dataset_id of this ManifestMetadata. :type dataset_id: str """ @@ -160,22 +160,22 @@ def dataset_id(self, dataset_id): @property def component_name(self): - """Gets the component_name of this Manifest. + """Gets the component_name of this ManifestMetadata. The name of the component the manifest is of. # noqa: E501 - :return: The component_name of this Manifest. + :return: The component_name of this ManifestMetadata. :rtype: str """ return self._component_name @component_name.setter def component_name(self, component_name): - """Sets the component_name of this Manifest. + """Sets the component_name of this ManifestMetadata. The name of the component the manifest is of. # noqa: E501 - :param component_name: The component_name of this Manifest. + :param component_name: The component_name of this ManifestMetadata. :type component_name: str """ diff --git a/apps/schematic/api/schematic_api/models/manifest_metadata_array.py b/apps/schematic/api/schematic_api/models/manifest_metadata_array.py new file mode 100644 index 0000000000..4ea52b29e8 --- /dev/null +++ b/apps/schematic/api/schematic_api/models/manifest_metadata_array.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.manifest_metadata import ManifestMetadata +from schematic_api import util + +from schematic_api.models.manifest_metadata import ManifestMetadata # noqa: E501 + +class ManifestMetadataArray(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, manifests=None): # noqa: E501 + """ManifestMetadataArray - a model defined in OpenAPI + + :param manifests: The manifests of this ManifestMetadataArray. # noqa: E501 + :type manifests: List[ManifestMetadata] + """ + self.openapi_types = { + 'manifests': List[ManifestMetadata] + } + + self.attribute_map = { + 'manifests': 'manifests' + } + + self._manifests = manifests + + @classmethod + def from_dict(cls, dikt) -> 'ManifestMetadataArray': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ManifestMetadataArray of this ManifestMetadataArray. # noqa: E501 + :rtype: ManifestMetadataArray + """ + return util.deserialize_model(dikt, cls) + + @property + def manifests(self): + """Gets the manifests of this ManifestMetadataArray. + + A list of manifest metadata # noqa: E501 + + :return: The manifests of this ManifestMetadataArray. + :rtype: List[ManifestMetadata] + """ + return self._manifests + + @manifests.setter + def manifests(self, manifests): + """Sets the manifests of this ManifestMetadataArray. + + A list of manifest metadata # noqa: E501 + + :param manifests: The manifests of this ManifestMetadataArray. + :type manifests: List[ManifestMetadata] + """ + + self._manifests = manifests diff --git a/apps/schematic/api/schematic_api/models/manifests_page.py b/apps/schematic/api/schematic_api/models/manifest_metadata_page.py similarity index 63% rename from apps/schematic/api/schematic_api/models/manifests_page.py rename to apps/schematic/api/schematic_api/models/manifest_metadata_page.py index 25762d6bcf..82c46353c5 100644 --- a/apps/schematic/api/schematic_api/models/manifests_page.py +++ b/apps/schematic/api/schematic_api/models/manifest_metadata_page.py @@ -6,34 +6,34 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.manifest import Manifest +from schematic_api.models.manifest_metadata import ManifestMetadata from schematic_api import util -from schematic_api.models.manifest import Manifest # noqa: E501 +from schematic_api.models.manifest_metadata import ManifestMetadata # noqa: E501 -class ManifestsPage(Model): +class ManifestMetadataPage(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, manifests=None): # noqa: E501 - """ManifestsPage - a model defined in OpenAPI + """ManifestMetadataPage - a model defined in OpenAPI - :param number: The number of this ManifestsPage. # noqa: E501 + :param number: The number of this ManifestMetadataPage. # noqa: E501 :type number: int - :param size: The size of this ManifestsPage. # noqa: E501 + :param size: The size of this ManifestMetadataPage. # noqa: E501 :type size: int - :param total_elements: The total_elements of this ManifestsPage. # noqa: E501 + :param total_elements: The total_elements of this ManifestMetadataPage. # noqa: E501 :type total_elements: int - :param total_pages: The total_pages of this ManifestsPage. # noqa: E501 + :param total_pages: The total_pages of this ManifestMetadataPage. # noqa: E501 :type total_pages: int - :param has_next: The has_next of this ManifestsPage. # noqa: E501 + :param has_next: The has_next of this ManifestMetadataPage. # noqa: E501 :type has_next: bool - :param has_previous: The has_previous of this ManifestsPage. # noqa: E501 + :param has_previous: The has_previous of this ManifestMetadataPage. # noqa: E501 :type has_previous: bool - :param manifests: The manifests of this ManifestsPage. # noqa: E501 - :type manifests: List[Manifest] + :param manifests: The manifests of this ManifestMetadataPage. # noqa: E501 + :type manifests: List[ManifestMetadata] """ self.openapi_types = { 'number': int, @@ -42,7 +42,7 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None 'total_pages': int, 'has_next': bool, 'has_previous': bool, - 'manifests': List[Manifest] + 'manifests': List[ManifestMetadata] } self.attribute_map = { @@ -64,34 +64,34 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None self._manifests = manifests @classmethod - def from_dict(cls, dikt) -> 'ManifestsPage': + def from_dict(cls, dikt) -> 'ManifestMetadataPage': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ManifestsPage of this ManifestsPage. # noqa: E501 - :rtype: ManifestsPage + :return: The ManifestMetadataPage of this ManifestMetadataPage. # noqa: E501 + :rtype: ManifestMetadataPage """ return util.deserialize_model(dikt, cls) @property def number(self): - """Gets the number of this ManifestsPage. + """Gets the number of this ManifestMetadataPage. The page number. # noqa: E501 - :return: The number of this ManifestsPage. + :return: The number of this ManifestMetadataPage. :rtype: int """ return self._number @number.setter def number(self, number): - """Sets the number of this ManifestsPage. + """Sets the number of this ManifestMetadataPage. The page number. # noqa: E501 - :param number: The number of this ManifestsPage. + :param number: The number of this ManifestMetadataPage. :type number: int """ if number is None: @@ -101,22 +101,22 @@ def number(self, number): @property def size(self): - """Gets the size of this ManifestsPage. + """Gets the size of this ManifestMetadataPage. The number of items in a single page. # noqa: E501 - :return: The size of this ManifestsPage. + :return: The size of this ManifestMetadataPage. :rtype: int """ return self._size @size.setter def size(self, size): - """Sets the size of this ManifestsPage. + """Sets the size of this ManifestMetadataPage. The number of items in a single page. # noqa: E501 - :param size: The size of this ManifestsPage. + :param size: The size of this ManifestMetadataPage. :type size: int """ if size is None: @@ -126,22 +126,22 @@ def size(self, size): @property def total_elements(self): - """Gets the total_elements of this ManifestsPage. + """Gets the total_elements of this ManifestMetadataPage. Total number of elements in the result set. # noqa: E501 - :return: The total_elements of this ManifestsPage. + :return: The total_elements of this ManifestMetadataPage. :rtype: int """ return self._total_elements @total_elements.setter def total_elements(self, total_elements): - """Sets the total_elements of this ManifestsPage. + """Sets the total_elements of this ManifestMetadataPage. Total number of elements in the result set. # noqa: E501 - :param total_elements: The total_elements of this ManifestsPage. + :param total_elements: The total_elements of this ManifestMetadataPage. :type total_elements: int """ if total_elements is None: @@ -151,22 +151,22 @@ def total_elements(self, total_elements): @property def total_pages(self): - """Gets the total_pages of this ManifestsPage. + """Gets the total_pages of this ManifestMetadataPage. Total number of pages in the result set. # noqa: E501 - :return: The total_pages of this ManifestsPage. + :return: The total_pages of this ManifestMetadataPage. :rtype: int """ return self._total_pages @total_pages.setter def total_pages(self, total_pages): - """Sets the total_pages of this ManifestsPage. + """Sets the total_pages of this ManifestMetadataPage. Total number of pages in the result set. # noqa: E501 - :param total_pages: The total_pages of this ManifestsPage. + :param total_pages: The total_pages of this ManifestMetadataPage. :type total_pages: int """ if total_pages is None: @@ -176,22 +176,22 @@ def total_pages(self, total_pages): @property def has_next(self): - """Gets the has_next of this ManifestsPage. + """Gets the has_next of this ManifestMetadataPage. Returns if there is a next page. # noqa: E501 - :return: The has_next of this ManifestsPage. + :return: The has_next of this ManifestMetadataPage. :rtype: bool """ return self._has_next @has_next.setter def has_next(self, has_next): - """Sets the has_next of this ManifestsPage. + """Sets the has_next of this ManifestMetadataPage. Returns if there is a next page. # noqa: E501 - :param has_next: The has_next of this ManifestsPage. + :param has_next: The has_next of this ManifestMetadataPage. :type has_next: bool """ if has_next is None: @@ -201,22 +201,22 @@ def has_next(self, has_next): @property def has_previous(self): - """Gets the has_previous of this ManifestsPage. + """Gets the has_previous of this ManifestMetadataPage. Returns if there is a previous page. # noqa: E501 - :return: The has_previous of this ManifestsPage. + :return: The has_previous of this ManifestMetadataPage. :rtype: bool """ return self._has_previous @has_previous.setter def has_previous(self, has_previous): - """Sets the has_previous of this ManifestsPage. + """Sets the has_previous of this ManifestMetadataPage. Returns if there is a previous page. # noqa: E501 - :param has_previous: The has_previous of this ManifestsPage. + :param has_previous: The has_previous of this ManifestMetadataPage. :type has_previous: bool """ if has_previous is None: @@ -226,23 +226,23 @@ def has_previous(self, has_previous): @property def manifests(self): - """Gets the manifests of this ManifestsPage. + """Gets the manifests of this ManifestMetadataPage. - A list of manifests. # noqa: E501 + A list of manifest metadata # noqa: E501 - :return: The manifests of this ManifestsPage. - :rtype: List[Manifest] + :return: The manifests of this ManifestMetadataPage. + :rtype: List[ManifestMetadata] """ return self._manifests @manifests.setter def manifests(self, manifests): - """Sets the manifests of this ManifestsPage. + """Sets the manifests of this ManifestMetadataPage. - A list of manifests. # noqa: E501 + A list of manifest metadata # noqa: E501 - :param manifests: The manifests of this ManifestsPage. - :type manifests: List[Manifest] + :param manifests: The manifests of this ManifestMetadataPage. + :type manifests: List[ManifestMetadata] """ if manifests is None: raise ValueError("Invalid value for `manifests`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/manifest_metadata_page_all_of.py b/apps/schematic/api/schematic_api/models/manifest_metadata_page_all_of.py new file mode 100644 index 0000000000..92b0a59e08 --- /dev/null +++ b/apps/schematic/api/schematic_api/models/manifest_metadata_page_all_of.py @@ -0,0 +1,70 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.manifest_metadata import ManifestMetadata +from schematic_api import util + +from schematic_api.models.manifest_metadata import ManifestMetadata # noqa: E501 + +class ManifestMetadataPageAllOf(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, manifests=None): # noqa: E501 + """ManifestMetadataPageAllOf - a model defined in OpenAPI + + :param manifests: The manifests of this ManifestMetadataPageAllOf. # noqa: E501 + :type manifests: List[ManifestMetadata] + """ + self.openapi_types = { + 'manifests': List[ManifestMetadata] + } + + self.attribute_map = { + 'manifests': 'manifests' + } + + self._manifests = manifests + + @classmethod + def from_dict(cls, dikt) -> 'ManifestMetadataPageAllOf': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ManifestMetadataPage_allOf of this ManifestMetadataPageAllOf. # noqa: E501 + :rtype: ManifestMetadataPageAllOf + """ + return util.deserialize_model(dikt, cls) + + @property + def manifests(self): + """Gets the manifests of this ManifestMetadataPageAllOf. + + A list of manifest metadata # noqa: E501 + + :return: The manifests of this ManifestMetadataPageAllOf. + :rtype: List[ManifestMetadata] + """ + return self._manifests + + @manifests.setter + def manifests(self, manifests): + """Sets the manifests of this ManifestMetadataPageAllOf. + + A list of manifest metadata # noqa: E501 + + :param manifests: The manifests of this ManifestMetadataPageAllOf. + :type manifests: List[ManifestMetadata] + """ + if manifests is None: + raise ValueError("Invalid value for `manifests`, must not be `None`") # noqa: E501 + + self._manifests = manifests diff --git a/apps/schematic/api/schematic_api/models/manifests_page_all_of.py b/apps/schematic/api/schematic_api/models/manifests_page_all_of.py deleted file mode 100644 index fd11b55d3a..0000000000 --- a/apps/schematic/api/schematic_api/models/manifests_page_all_of.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from schematic_api.models.base_model_ import Model -from schematic_api.models.manifest import Manifest -from schematic_api import util - -from schematic_api.models.manifest import Manifest # noqa: E501 - -class ManifestsPageAllOf(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, manifests=None): # noqa: E501 - """ManifestsPageAllOf - a model defined in OpenAPI - - :param manifests: The manifests of this ManifestsPageAllOf. # noqa: E501 - :type manifests: List[Manifest] - """ - self.openapi_types = { - 'manifests': List[Manifest] - } - - self.attribute_map = { - 'manifests': 'manifests' - } - - self._manifests = manifests - - @classmethod - def from_dict(cls, dikt) -> 'ManifestsPageAllOf': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The ManifestsPage_allOf of this ManifestsPageAllOf. # noqa: E501 - :rtype: ManifestsPageAllOf - """ - return util.deserialize_model(dikt, cls) - - @property - def manifests(self): - """Gets the manifests of this ManifestsPageAllOf. - - A list of manifests. # noqa: E501 - - :return: The manifests of this ManifestsPageAllOf. - :rtype: List[Manifest] - """ - return self._manifests - - @manifests.setter - def manifests(self, manifests): - """Sets the manifests of this ManifestsPageAllOf. - - A list of manifests. # noqa: E501 - - :param manifests: The manifests of this ManifestsPageAllOf. - :type manifests: List[Manifest] - """ - if manifests is None: - raise ValueError("Invalid value for `manifests`, must not be `None`") # noqa: E501 - - self._manifests = manifests diff --git a/apps/schematic/api/schematic_api/models/node_array.py b/apps/schematic/api/schematic_api/models/node_array.py new file mode 100644 index 0000000000..a0bdfad35a --- /dev/null +++ b/apps/schematic/api/schematic_api/models/node_array.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.node import Node +from schematic_api import util + +from schematic_api.models.node import Node # noqa: E501 + +class NodeArray(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, nodes=None): # noqa: E501 + """NodeArray - a model defined in OpenAPI + + :param nodes: The nodes of this NodeArray. # noqa: E501 + :type nodes: List[Node] + """ + self.openapi_types = { + 'nodes': List[Node] + } + + self.attribute_map = { + 'nodes': 'nodes' + } + + self._nodes = nodes + + @classmethod + def from_dict(cls, dikt) -> 'NodeArray': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The NodeArray of this NodeArray. # noqa: E501 + :rtype: NodeArray + """ + return util.deserialize_model(dikt, cls) + + @property + def nodes(self): + """Gets the nodes of this NodeArray. + + An array of nodes. # noqa: E501 + + :return: The nodes of this NodeArray. + :rtype: List[Node] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes): + """Sets the nodes of this NodeArray. + + An array of nodes. # noqa: E501 + + :param nodes: The nodes of this NodeArray. + :type nodes: List[Node] + """ + + self._nodes = nodes diff --git a/apps/schematic/api/schematic_api/models/nodes_page.py b/apps/schematic/api/schematic_api/models/node_page.py similarity index 69% rename from apps/schematic/api/schematic_api/models/nodes_page.py rename to apps/schematic/api/schematic_api/models/node_page.py index abe813ec61..ffa81cee8a 100644 --- a/apps/schematic/api/schematic_api/models/nodes_page.py +++ b/apps/schematic/api/schematic_api/models/node_page.py @@ -11,28 +11,28 @@ from schematic_api.models.node import Node # noqa: E501 -class NodesPage(Model): +class NodePage(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, nodes=None): # noqa: E501 - """NodesPage - a model defined in OpenAPI + """NodePage - a model defined in OpenAPI - :param number: The number of this NodesPage. # noqa: E501 + :param number: The number of this NodePage. # noqa: E501 :type number: int - :param size: The size of this NodesPage. # noqa: E501 + :param size: The size of this NodePage. # noqa: E501 :type size: int - :param total_elements: The total_elements of this NodesPage. # noqa: E501 + :param total_elements: The total_elements of this NodePage. # noqa: E501 :type total_elements: int - :param total_pages: The total_pages of this NodesPage. # noqa: E501 + :param total_pages: The total_pages of this NodePage. # noqa: E501 :type total_pages: int - :param has_next: The has_next of this NodesPage. # noqa: E501 + :param has_next: The has_next of this NodePage. # noqa: E501 :type has_next: bool - :param has_previous: The has_previous of this NodesPage. # noqa: E501 + :param has_previous: The has_previous of this NodePage. # noqa: E501 :type has_previous: bool - :param nodes: The nodes of this NodesPage. # noqa: E501 + :param nodes: The nodes of this NodePage. # noqa: E501 :type nodes: List[Node] """ self.openapi_types = { @@ -64,34 +64,34 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None self._nodes = nodes @classmethod - def from_dict(cls, dikt) -> 'NodesPage': + def from_dict(cls, dikt) -> 'NodePage': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The NodesPage of this NodesPage. # noqa: E501 - :rtype: NodesPage + :return: The NodePage of this NodePage. # noqa: E501 + :rtype: NodePage """ return util.deserialize_model(dikt, cls) @property def number(self): - """Gets the number of this NodesPage. + """Gets the number of this NodePage. The page number. # noqa: E501 - :return: The number of this NodesPage. + :return: The number of this NodePage. :rtype: int """ return self._number @number.setter def number(self, number): - """Sets the number of this NodesPage. + """Sets the number of this NodePage. The page number. # noqa: E501 - :param number: The number of this NodesPage. + :param number: The number of this NodePage. :type number: int """ if number is None: @@ -101,22 +101,22 @@ def number(self, number): @property def size(self): - """Gets the size of this NodesPage. + """Gets the size of this NodePage. The number of items in a single page. # noqa: E501 - :return: The size of this NodesPage. + :return: The size of this NodePage. :rtype: int """ return self._size @size.setter def size(self, size): - """Sets the size of this NodesPage. + """Sets the size of this NodePage. The number of items in a single page. # noqa: E501 - :param size: The size of this NodesPage. + :param size: The size of this NodePage. :type size: int """ if size is None: @@ -126,22 +126,22 @@ def size(self, size): @property def total_elements(self): - """Gets the total_elements of this NodesPage. + """Gets the total_elements of this NodePage. Total number of elements in the result set. # noqa: E501 - :return: The total_elements of this NodesPage. + :return: The total_elements of this NodePage. :rtype: int """ return self._total_elements @total_elements.setter def total_elements(self, total_elements): - """Sets the total_elements of this NodesPage. + """Sets the total_elements of this NodePage. Total number of elements in the result set. # noqa: E501 - :param total_elements: The total_elements of this NodesPage. + :param total_elements: The total_elements of this NodePage. :type total_elements: int """ if total_elements is None: @@ -151,22 +151,22 @@ def total_elements(self, total_elements): @property def total_pages(self): - """Gets the total_pages of this NodesPage. + """Gets the total_pages of this NodePage. Total number of pages in the result set. # noqa: E501 - :return: The total_pages of this NodesPage. + :return: The total_pages of this NodePage. :rtype: int """ return self._total_pages @total_pages.setter def total_pages(self, total_pages): - """Sets the total_pages of this NodesPage. + """Sets the total_pages of this NodePage. Total number of pages in the result set. # noqa: E501 - :param total_pages: The total_pages of this NodesPage. + :param total_pages: The total_pages of this NodePage. :type total_pages: int """ if total_pages is None: @@ -176,22 +176,22 @@ def total_pages(self, total_pages): @property def has_next(self): - """Gets the has_next of this NodesPage. + """Gets the has_next of this NodePage. Returns if there is a next page. # noqa: E501 - :return: The has_next of this NodesPage. + :return: The has_next of this NodePage. :rtype: bool """ return self._has_next @has_next.setter def has_next(self, has_next): - """Sets the has_next of this NodesPage. + """Sets the has_next of this NodePage. Returns if there is a next page. # noqa: E501 - :param has_next: The has_next of this NodesPage. + :param has_next: The has_next of this NodePage. :type has_next: bool """ if has_next is None: @@ -201,22 +201,22 @@ def has_next(self, has_next): @property def has_previous(self): - """Gets the has_previous of this NodesPage. + """Gets the has_previous of this NodePage. Returns if there is a previous page. # noqa: E501 - :return: The has_previous of this NodesPage. + :return: The has_previous of this NodePage. :rtype: bool """ return self._has_previous @has_previous.setter def has_previous(self, has_previous): - """Sets the has_previous of this NodesPage. + """Sets the has_previous of this NodePage. Returns if there is a previous page. # noqa: E501 - :param has_previous: The has_previous of this NodesPage. + :param has_previous: The has_previous of this NodePage. :type has_previous: bool """ if has_previous is None: @@ -226,22 +226,22 @@ def has_previous(self, has_previous): @property def nodes(self): - """Gets the nodes of this NodesPage. + """Gets the nodes of this NodePage. - A list of nodes. # noqa: E501 + An array of nodes. # noqa: E501 - :return: The nodes of this NodesPage. + :return: The nodes of this NodePage. :rtype: List[Node] """ return self._nodes @nodes.setter def nodes(self, nodes): - """Sets the nodes of this NodesPage. + """Sets the nodes of this NodePage. - A list of nodes. # noqa: E501 + An array of nodes. # noqa: E501 - :param nodes: The nodes of this NodesPage. + :param nodes: The nodes of this NodePage. :type nodes: List[Node] """ if nodes is None: diff --git a/apps/schematic/api/schematic_api/models/nodes_page_all_of.py b/apps/schematic/api/schematic_api/models/node_page_all_of.py similarity index 67% rename from apps/schematic/api/schematic_api/models/nodes_page_all_of.py rename to apps/schematic/api/schematic_api/models/node_page_all_of.py index f131673c5d..43aedbd7d6 100644 --- a/apps/schematic/api/schematic_api/models/nodes_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/node_page_all_of.py @@ -11,16 +11,16 @@ from schematic_api.models.node import Node # noqa: E501 -class NodesPageAllOf(Model): +class NodePageAllOf(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, nodes=None): # noqa: E501 - """NodesPageAllOf - a model defined in OpenAPI + """NodePageAllOf - a model defined in OpenAPI - :param nodes: The nodes of this NodesPageAllOf. # noqa: E501 + :param nodes: The nodes of this NodePageAllOf. # noqa: E501 :type nodes: List[Node] """ self.openapi_types = { @@ -34,34 +34,34 @@ def __init__(self, nodes=None): # noqa: E501 self._nodes = nodes @classmethod - def from_dict(cls, dikt) -> 'NodesPageAllOf': + def from_dict(cls, dikt) -> 'NodePageAllOf': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The NodesPage_allOf of this NodesPageAllOf. # noqa: E501 - :rtype: NodesPageAllOf + :return: The NodePage_allOf of this NodePageAllOf. # noqa: E501 + :rtype: NodePageAllOf """ return util.deserialize_model(dikt, cls) @property def nodes(self): - """Gets the nodes of this NodesPageAllOf. + """Gets the nodes of this NodePageAllOf. - A list of nodes. # noqa: E501 + An array of nodes. # noqa: E501 - :return: The nodes of this NodesPageAllOf. + :return: The nodes of this NodePageAllOf. :rtype: List[Node] """ return self._nodes @nodes.setter def nodes(self, nodes): - """Sets the nodes of this NodesPageAllOf. + """Sets the nodes of this NodePageAllOf. - A list of nodes. # noqa: E501 + An array of nodes. # noqa: E501 - :param nodes: The nodes of this NodesPageAllOf. + :param nodes: The nodes of this NodePageAllOf. :type nodes: List[Node] """ if nodes is None: diff --git a/apps/schematic/api/schematic_api/models/node_properties_page.py b/apps/schematic/api/schematic_api/models/node_properties_page.py deleted file mode 100644 index 5b3f96db08..0000000000 --- a/apps/schematic/api/schematic_api/models/node_properties_page.py +++ /dev/null @@ -1,250 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from schematic_api.models.base_model_ import Model -from schematic_api.models.node_property import NodeProperty -from schematic_api import util - -from schematic_api.models.node_property import NodeProperty # noqa: E501 - -class NodePropertiesPage(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, node_properties=None): # noqa: E501 - """NodePropertiesPage - a model defined in OpenAPI - - :param number: The number of this NodePropertiesPage. # noqa: E501 - :type number: int - :param size: The size of this NodePropertiesPage. # noqa: E501 - :type size: int - :param total_elements: The total_elements of this NodePropertiesPage. # noqa: E501 - :type total_elements: int - :param total_pages: The total_pages of this NodePropertiesPage. # noqa: E501 - :type total_pages: int - :param has_next: The has_next of this NodePropertiesPage. # noqa: E501 - :type has_next: bool - :param has_previous: The has_previous of this NodePropertiesPage. # noqa: E501 - :type has_previous: bool - :param node_properties: The node_properties of this NodePropertiesPage. # noqa: E501 - :type node_properties: List[NodeProperty] - """ - self.openapi_types = { - 'number': int, - 'size': int, - 'total_elements': int, - 'total_pages': int, - 'has_next': bool, - 'has_previous': bool, - 'node_properties': List[NodeProperty] - } - - self.attribute_map = { - 'number': 'number', - 'size': 'size', - 'total_elements': 'totalElements', - 'total_pages': 'totalPages', - 'has_next': 'hasNext', - 'has_previous': 'hasPrevious', - 'node_properties': 'node_properties' - } - - self._number = number - self._size = size - self._total_elements = total_elements - self._total_pages = total_pages - self._has_next = has_next - self._has_previous = has_previous - self._node_properties = node_properties - - @classmethod - def from_dict(cls, dikt) -> 'NodePropertiesPage': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The NodePropertiesPage of this NodePropertiesPage. # noqa: E501 - :rtype: NodePropertiesPage - """ - return util.deserialize_model(dikt, cls) - - @property - def number(self): - """Gets the number of this NodePropertiesPage. - - The page number. # noqa: E501 - - :return: The number of this NodePropertiesPage. - :rtype: int - """ - return self._number - - @number.setter - def number(self, number): - """Sets the number of this NodePropertiesPage. - - The page number. # noqa: E501 - - :param number: The number of this NodePropertiesPage. - :type number: int - """ - if number is None: - raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501 - - self._number = number - - @property - def size(self): - """Gets the size of this NodePropertiesPage. - - The number of items in a single page. # noqa: E501 - - :return: The size of this NodePropertiesPage. - :rtype: int - """ - return self._size - - @size.setter - def size(self, size): - """Sets the size of this NodePropertiesPage. - - The number of items in a single page. # noqa: E501 - - :param size: The size of this NodePropertiesPage. - :type size: int - """ - if size is None: - raise ValueError("Invalid value for `size`, must not be `None`") # noqa: E501 - - self._size = size - - @property - def total_elements(self): - """Gets the total_elements of this NodePropertiesPage. - - Total number of elements in the result set. # noqa: E501 - - :return: The total_elements of this NodePropertiesPage. - :rtype: int - """ - return self._total_elements - - @total_elements.setter - def total_elements(self, total_elements): - """Sets the total_elements of this NodePropertiesPage. - - Total number of elements in the result set. # noqa: E501 - - :param total_elements: The total_elements of this NodePropertiesPage. - :type total_elements: int - """ - if total_elements is None: - raise ValueError("Invalid value for `total_elements`, must not be `None`") # noqa: E501 - - self._total_elements = total_elements - - @property - def total_pages(self): - """Gets the total_pages of this NodePropertiesPage. - - Total number of pages in the result set. # noqa: E501 - - :return: The total_pages of this NodePropertiesPage. - :rtype: int - """ - return self._total_pages - - @total_pages.setter - def total_pages(self, total_pages): - """Sets the total_pages of this NodePropertiesPage. - - Total number of pages in the result set. # noqa: E501 - - :param total_pages: The total_pages of this NodePropertiesPage. - :type total_pages: int - """ - if total_pages is None: - raise ValueError("Invalid value for `total_pages`, must not be `None`") # noqa: E501 - - self._total_pages = total_pages - - @property - def has_next(self): - """Gets the has_next of this NodePropertiesPage. - - Returns if there is a next page. # noqa: E501 - - :return: The has_next of this NodePropertiesPage. - :rtype: bool - """ - return self._has_next - - @has_next.setter - def has_next(self, has_next): - """Sets the has_next of this NodePropertiesPage. - - Returns if there is a next page. # noqa: E501 - - :param has_next: The has_next of this NodePropertiesPage. - :type has_next: bool - """ - if has_next is None: - raise ValueError("Invalid value for `has_next`, must not be `None`") # noqa: E501 - - self._has_next = has_next - - @property - def has_previous(self): - """Gets the has_previous of this NodePropertiesPage. - - Returns if there is a previous page. # noqa: E501 - - :return: The has_previous of this NodePropertiesPage. - :rtype: bool - """ - return self._has_previous - - @has_previous.setter - def has_previous(self, has_previous): - """Sets the has_previous of this NodePropertiesPage. - - Returns if there is a previous page. # noqa: E501 - - :param has_previous: The has_previous of this NodePropertiesPage. - :type has_previous: bool - """ - if has_previous is None: - raise ValueError("Invalid value for `has_previous`, must not be `None`") # noqa: E501 - - self._has_previous = has_previous - - @property - def node_properties(self): - """Gets the node_properties of this NodePropertiesPage. - - A list of node properties. # noqa: E501 - - :return: The node_properties of this NodePropertiesPage. - :rtype: List[NodeProperty] - """ - return self._node_properties - - @node_properties.setter - def node_properties(self, node_properties): - """Sets the node_properties of this NodePropertiesPage. - - A list of node properties. # noqa: E501 - - :param node_properties: The node_properties of this NodePropertiesPage. - :type node_properties: List[NodeProperty] - """ - if node_properties is None: - raise ValueError("Invalid value for `node_properties`, must not be `None`") # noqa: E501 - - self._node_properties = node_properties diff --git a/apps/schematic/api/schematic_api/models/node_property.py b/apps/schematic/api/schematic_api/models/node_property.py deleted file mode 100644 index 5477a5ed70..0000000000 --- a/apps/schematic/api/schematic_api/models/node_property.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from schematic_api.models.base_model_ import Model -from schematic_api import util - - -class NodeProperty(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None): # noqa: E501 - """NodeProperty - a model defined in OpenAPI - - :param name: The name of this NodeProperty. # noqa: E501 - :type name: str - """ - self.openapi_types = { - 'name': str - } - - self.attribute_map = { - 'name': 'name' - } - - self._name = name - - @classmethod - def from_dict(cls, dikt) -> 'NodeProperty': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The NodeProperty of this NodeProperty. # noqa: E501 - :rtype: NodeProperty - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self): - """Gets the name of this NodeProperty. - - The name of the property # noqa: E501 - - :return: The name of this NodeProperty. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this NodeProperty. - - The name of the property # noqa: E501 - - :param name: The name of this NodeProperty. - :type name: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name diff --git a/apps/schematic/api/schematic_api/models/node_properties_page_all_of.py b/apps/schematic/api/schematic_api/models/node_property_array.py similarity index 51% rename from apps/schematic/api/schematic_api/models/node_properties_page_all_of.py rename to apps/schematic/api/schematic_api/models/node_property_array.py index c683405931..f3f51fb9e2 100644 --- a/apps/schematic/api/schematic_api/models/node_properties_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/node_property_array.py @@ -6,25 +6,23 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.node_property import NodeProperty from schematic_api import util -from schematic_api.models.node_property import NodeProperty # noqa: E501 -class NodePropertiesPageAllOf(Model): +class NodePropertyArray(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, node_properties=None): # noqa: E501 - """NodePropertiesPageAllOf - a model defined in OpenAPI + """NodePropertyArray - a model defined in OpenAPI - :param node_properties: The node_properties of this NodePropertiesPageAllOf. # noqa: E501 - :type node_properties: List[NodeProperty] + :param node_properties: The node_properties of this NodePropertyArray. # noqa: E501 + :type node_properties: List[str] """ self.openapi_types = { - 'node_properties': List[NodeProperty] + 'node_properties': List[str] } self.attribute_map = { @@ -34,37 +32,35 @@ def __init__(self, node_properties=None): # noqa: E501 self._node_properties = node_properties @classmethod - def from_dict(cls, dikt) -> 'NodePropertiesPageAllOf': + def from_dict(cls, dikt) -> 'NodePropertyArray': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The NodePropertiesPage_allOf of this NodePropertiesPageAllOf. # noqa: E501 - :rtype: NodePropertiesPageAllOf + :return: The NodePropertyArray of this NodePropertyArray. # noqa: E501 + :rtype: NodePropertyArray """ return util.deserialize_model(dikt, cls) @property def node_properties(self): - """Gets the node_properties of this NodePropertiesPageAllOf. + """Gets the node_properties of this NodePropertyArray. - A list of node properties. # noqa: E501 + An array of node properties. # noqa: E501 - :return: The node_properties of this NodePropertiesPageAllOf. - :rtype: List[NodeProperty] + :return: The node_properties of this NodePropertyArray. + :rtype: List[str] """ return self._node_properties @node_properties.setter def node_properties(self, node_properties): - """Sets the node_properties of this NodePropertiesPageAllOf. + """Sets the node_properties of this NodePropertyArray. - A list of node properties. # noqa: E501 + An array of node properties. # noqa: E501 - :param node_properties: The node_properties of this NodePropertiesPageAllOf. - :type node_properties: List[NodeProperty] + :param node_properties: The node_properties of this NodePropertyArray. + :type node_properties: List[str] """ - if node_properties is None: - raise ValueError("Invalid value for `node_properties`, must not be `None`") # noqa: E501 self._node_properties = node_properties diff --git a/apps/schematic/api/schematic_api/models/project.py b/apps/schematic/api/schematic_api/models/project_metadata.py similarity index 68% rename from apps/schematic/api/schematic_api/models/project.py rename to apps/schematic/api/schematic_api/models/project_metadata.py index e03bb219c7..d68d72984c 100644 --- a/apps/schematic/api/schematic_api/models/project.py +++ b/apps/schematic/api/schematic_api/models/project_metadata.py @@ -9,18 +9,18 @@ from schematic_api import util -class Project(Model): +class ProjectMetadata(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, name=None, id=None): # noqa: E501 - """Project - a model defined in OpenAPI + """ProjectMetadata - a model defined in OpenAPI - :param name: The name of this Project. # noqa: E501 + :param name: The name of this ProjectMetadata. # noqa: E501 :type name: str - :param id: The id of this Project. # noqa: E501 + :param id: The id of this ProjectMetadata. # noqa: E501 :type id: str """ self.openapi_types = { @@ -37,34 +37,34 @@ def __init__(self, name=None, id=None): # noqa: E501 self._id = id @classmethod - def from_dict(cls, dikt) -> 'Project': + def from_dict(cls, dikt) -> 'ProjectMetadata': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The Project of this Project. # noqa: E501 - :rtype: Project + :return: The ProjectMetadata of this ProjectMetadata. # noqa: E501 + :rtype: ProjectMetadata """ return util.deserialize_model(dikt, cls) @property def name(self): - """Gets the name of this Project. + """Gets the name of this ProjectMetadata. The name of the project. # noqa: E501 - :return: The name of this Project. + :return: The name of this ProjectMetadata. :rtype: str """ return self._name @name.setter def name(self, name): - """Sets the name of this Project. + """Sets the name of this ProjectMetadata. The name of the project. # noqa: E501 - :param name: The name of this Project. + :param name: The name of this ProjectMetadata. :type name: str """ if name is None: @@ -74,22 +74,22 @@ def name(self, name): @property def id(self): - """Gets the id of this Project. + """Gets the id of this ProjectMetadata. The ID of the project. # noqa: E501 - :return: The id of this Project. + :return: The id of this ProjectMetadata. :rtype: str """ return self._id @id.setter def id(self, id): - """Sets the id of this Project. + """Sets the id of this ProjectMetadata. The ID of the project. # noqa: E501 - :param id: The id of this Project. + :param id: The id of this ProjectMetadata. :type id: str """ if id is None: diff --git a/apps/schematic/api/schematic_api/models/project_metadata_array.py b/apps/schematic/api/schematic_api/models/project_metadata_array.py new file mode 100644 index 0000000000..d0f7661d92 --- /dev/null +++ b/apps/schematic/api/schematic_api/models/project_metadata_array.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from schematic_api.models.base_model_ import Model +from schematic_api.models.project_metadata import ProjectMetadata +from schematic_api import util + +from schematic_api.models.project_metadata import ProjectMetadata # noqa: E501 + +class ProjectMetadataArray(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, projects=None): # noqa: E501 + """ProjectMetadataArray - a model defined in OpenAPI + + :param projects: The projects of this ProjectMetadataArray. # noqa: E501 + :type projects: List[ProjectMetadata] + """ + self.openapi_types = { + 'projects': List[ProjectMetadata] + } + + self.attribute_map = { + 'projects': 'projects' + } + + self._projects = projects + + @classmethod + def from_dict(cls, dikt) -> 'ProjectMetadataArray': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ProjectMetadataArray of this ProjectMetadataArray. # noqa: E501 + :rtype: ProjectMetadataArray + """ + return util.deserialize_model(dikt, cls) + + @property + def projects(self): + """Gets the projects of this ProjectMetadataArray. + + An array of project metadata. # noqa: E501 + + :return: The projects of this ProjectMetadataArray. + :rtype: List[ProjectMetadata] + """ + return self._projects + + @projects.setter + def projects(self, projects): + """Sets the projects of this ProjectMetadataArray. + + An array of project metadata. # noqa: E501 + + :param projects: The projects of this ProjectMetadataArray. + :type projects: List[ProjectMetadata] + """ + + self._projects = projects diff --git a/apps/schematic/api/schematic_api/models/projects_page.py b/apps/schematic/api/schematic_api/models/project_metadata_page.py similarity index 63% rename from apps/schematic/api/schematic_api/models/projects_page.py rename to apps/schematic/api/schematic_api/models/project_metadata_page.py index 430c80c757..a386eb46c2 100644 --- a/apps/schematic/api/schematic_api/models/projects_page.py +++ b/apps/schematic/api/schematic_api/models/project_metadata_page.py @@ -6,34 +6,34 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.project import Project +from schematic_api.models.project_metadata import ProjectMetadata from schematic_api import util -from schematic_api.models.project import Project # noqa: E501 +from schematic_api.models.project_metadata import ProjectMetadata # noqa: E501 -class ProjectsPage(Model): +class ProjectMetadataPage(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, projects=None): # noqa: E501 - """ProjectsPage - a model defined in OpenAPI + """ProjectMetadataPage - a model defined in OpenAPI - :param number: The number of this ProjectsPage. # noqa: E501 + :param number: The number of this ProjectMetadataPage. # noqa: E501 :type number: int - :param size: The size of this ProjectsPage. # noqa: E501 + :param size: The size of this ProjectMetadataPage. # noqa: E501 :type size: int - :param total_elements: The total_elements of this ProjectsPage. # noqa: E501 + :param total_elements: The total_elements of this ProjectMetadataPage. # noqa: E501 :type total_elements: int - :param total_pages: The total_pages of this ProjectsPage. # noqa: E501 + :param total_pages: The total_pages of this ProjectMetadataPage. # noqa: E501 :type total_pages: int - :param has_next: The has_next of this ProjectsPage. # noqa: E501 + :param has_next: The has_next of this ProjectMetadataPage. # noqa: E501 :type has_next: bool - :param has_previous: The has_previous of this ProjectsPage. # noqa: E501 + :param has_previous: The has_previous of this ProjectMetadataPage. # noqa: E501 :type has_previous: bool - :param projects: The projects of this ProjectsPage. # noqa: E501 - :type projects: List[Project] + :param projects: The projects of this ProjectMetadataPage. # noqa: E501 + :type projects: List[ProjectMetadata] """ self.openapi_types = { 'number': int, @@ -42,7 +42,7 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None 'total_pages': int, 'has_next': bool, 'has_previous': bool, - 'projects': List[Project] + 'projects': List[ProjectMetadata] } self.attribute_map = { @@ -64,34 +64,34 @@ def __init__(self, number=None, size=None, total_elements=None, total_pages=None self._projects = projects @classmethod - def from_dict(cls, dikt) -> 'ProjectsPage': + def from_dict(cls, dikt) -> 'ProjectMetadataPage': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ProjectsPage of this ProjectsPage. # noqa: E501 - :rtype: ProjectsPage + :return: The ProjectMetadataPage of this ProjectMetadataPage. # noqa: E501 + :rtype: ProjectMetadataPage """ return util.deserialize_model(dikt, cls) @property def number(self): - """Gets the number of this ProjectsPage. + """Gets the number of this ProjectMetadataPage. The page number. # noqa: E501 - :return: The number of this ProjectsPage. + :return: The number of this ProjectMetadataPage. :rtype: int """ return self._number @number.setter def number(self, number): - """Sets the number of this ProjectsPage. + """Sets the number of this ProjectMetadataPage. The page number. # noqa: E501 - :param number: The number of this ProjectsPage. + :param number: The number of this ProjectMetadataPage. :type number: int """ if number is None: @@ -101,22 +101,22 @@ def number(self, number): @property def size(self): - """Gets the size of this ProjectsPage. + """Gets the size of this ProjectMetadataPage. The number of items in a single page. # noqa: E501 - :return: The size of this ProjectsPage. + :return: The size of this ProjectMetadataPage. :rtype: int """ return self._size @size.setter def size(self, size): - """Sets the size of this ProjectsPage. + """Sets the size of this ProjectMetadataPage. The number of items in a single page. # noqa: E501 - :param size: The size of this ProjectsPage. + :param size: The size of this ProjectMetadataPage. :type size: int """ if size is None: @@ -126,22 +126,22 @@ def size(self, size): @property def total_elements(self): - """Gets the total_elements of this ProjectsPage. + """Gets the total_elements of this ProjectMetadataPage. Total number of elements in the result set. # noqa: E501 - :return: The total_elements of this ProjectsPage. + :return: The total_elements of this ProjectMetadataPage. :rtype: int """ return self._total_elements @total_elements.setter def total_elements(self, total_elements): - """Sets the total_elements of this ProjectsPage. + """Sets the total_elements of this ProjectMetadataPage. Total number of elements in the result set. # noqa: E501 - :param total_elements: The total_elements of this ProjectsPage. + :param total_elements: The total_elements of this ProjectMetadataPage. :type total_elements: int """ if total_elements is None: @@ -151,22 +151,22 @@ def total_elements(self, total_elements): @property def total_pages(self): - """Gets the total_pages of this ProjectsPage. + """Gets the total_pages of this ProjectMetadataPage. Total number of pages in the result set. # noqa: E501 - :return: The total_pages of this ProjectsPage. + :return: The total_pages of this ProjectMetadataPage. :rtype: int """ return self._total_pages @total_pages.setter def total_pages(self, total_pages): - """Sets the total_pages of this ProjectsPage. + """Sets the total_pages of this ProjectMetadataPage. Total number of pages in the result set. # noqa: E501 - :param total_pages: The total_pages of this ProjectsPage. + :param total_pages: The total_pages of this ProjectMetadataPage. :type total_pages: int """ if total_pages is None: @@ -176,22 +176,22 @@ def total_pages(self, total_pages): @property def has_next(self): - """Gets the has_next of this ProjectsPage. + """Gets the has_next of this ProjectMetadataPage. Returns if there is a next page. # noqa: E501 - :return: The has_next of this ProjectsPage. + :return: The has_next of this ProjectMetadataPage. :rtype: bool """ return self._has_next @has_next.setter def has_next(self, has_next): - """Sets the has_next of this ProjectsPage. + """Sets the has_next of this ProjectMetadataPage. Returns if there is a next page. # noqa: E501 - :param has_next: The has_next of this ProjectsPage. + :param has_next: The has_next of this ProjectMetadataPage. :type has_next: bool """ if has_next is None: @@ -201,22 +201,22 @@ def has_next(self, has_next): @property def has_previous(self): - """Gets the has_previous of this ProjectsPage. + """Gets the has_previous of this ProjectMetadataPage. Returns if there is a previous page. # noqa: E501 - :return: The has_previous of this ProjectsPage. + :return: The has_previous of this ProjectMetadataPage. :rtype: bool """ return self._has_previous @has_previous.setter def has_previous(self, has_previous): - """Sets the has_previous of this ProjectsPage. + """Sets the has_previous of this ProjectMetadataPage. Returns if there is a previous page. # noqa: E501 - :param has_previous: The has_previous of this ProjectsPage. + :param has_previous: The has_previous of this ProjectMetadataPage. :type has_previous: bool """ if has_previous is None: @@ -226,23 +226,23 @@ def has_previous(self, has_previous): @property def projects(self): - """Gets the projects of this ProjectsPage. + """Gets the projects of this ProjectMetadataPage. - A list of projects. # noqa: E501 + An array of project metadata. # noqa: E501 - :return: The projects of this ProjectsPage. - :rtype: List[Project] + :return: The projects of this ProjectMetadataPage. + :rtype: List[ProjectMetadata] """ return self._projects @projects.setter def projects(self, projects): - """Sets the projects of this ProjectsPage. + """Sets the projects of this ProjectMetadataPage. - A list of projects. # noqa: E501 + An array of project metadata. # noqa: E501 - :param projects: The projects of this ProjectsPage. - :type projects: List[Project] + :param projects: The projects of this ProjectMetadataPage. + :type projects: List[ProjectMetadata] """ if projects is None: raise ValueError("Invalid value for `projects`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/projects_page_all_of.py b/apps/schematic/api/schematic_api/models/project_metadata_page_all_of.py similarity index 50% rename from apps/schematic/api/schematic_api/models/projects_page_all_of.py rename to apps/schematic/api/schematic_api/models/project_metadata_page_all_of.py index d7ca674d9f..c2c0b45ce8 100644 --- a/apps/schematic/api/schematic_api/models/projects_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/project_metadata_page_all_of.py @@ -6,25 +6,25 @@ from typing import List, Dict # noqa: F401 from schematic_api.models.base_model_ import Model -from schematic_api.models.project import Project +from schematic_api.models.project_metadata import ProjectMetadata from schematic_api import util -from schematic_api.models.project import Project # noqa: E501 +from schematic_api.models.project_metadata import ProjectMetadata # noqa: E501 -class ProjectsPageAllOf(Model): +class ProjectMetadataPageAllOf(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, projects=None): # noqa: E501 - """ProjectsPageAllOf - a model defined in OpenAPI + """ProjectMetadataPageAllOf - a model defined in OpenAPI - :param projects: The projects of this ProjectsPageAllOf. # noqa: E501 - :type projects: List[Project] + :param projects: The projects of this ProjectMetadataPageAllOf. # noqa: E501 + :type projects: List[ProjectMetadata] """ self.openapi_types = { - 'projects': List[Project] + 'projects': List[ProjectMetadata] } self.attribute_map = { @@ -34,35 +34,35 @@ def __init__(self, projects=None): # noqa: E501 self._projects = projects @classmethod - def from_dict(cls, dikt) -> 'ProjectsPageAllOf': + def from_dict(cls, dikt) -> 'ProjectMetadataPageAllOf': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ProjectsPage_allOf of this ProjectsPageAllOf. # noqa: E501 - :rtype: ProjectsPageAllOf + :return: The ProjectMetadataPage_allOf of this ProjectMetadataPageAllOf. # noqa: E501 + :rtype: ProjectMetadataPageAllOf """ return util.deserialize_model(dikt, cls) @property def projects(self): - """Gets the projects of this ProjectsPageAllOf. + """Gets the projects of this ProjectMetadataPageAllOf. - A list of projects. # noqa: E501 + An array of project metadata. # noqa: E501 - :return: The projects of this ProjectsPageAllOf. - :rtype: List[Project] + :return: The projects of this ProjectMetadataPageAllOf. + :rtype: List[ProjectMetadata] """ return self._projects @projects.setter def projects(self, projects): - """Sets the projects of this ProjectsPageAllOf. + """Sets the projects of this ProjectMetadataPageAllOf. - A list of projects. # noqa: E501 + An array of project metadata. # noqa: E501 - :param projects: The projects of this ProjectsPageAllOf. - :type projects: List[Project] + :param projects: The projects of this ProjectMetadataPageAllOf. + :type projects: List[ProjectMetadata] """ if projects is None: raise ValueError("Invalid value for `projects`, must not be `None`") # noqa: E501 diff --git a/apps/schematic/api/schematic_api/models/validation_rules_page_all_of.py b/apps/schematic/api/schematic_api/models/validation_rule_array.py similarity index 65% rename from apps/schematic/api/schematic_api/models/validation_rules_page_all_of.py rename to apps/schematic/api/schematic_api/models/validation_rule_array.py index 0070de77e9..9f1fe5e0a2 100644 --- a/apps/schematic/api/schematic_api/models/validation_rules_page_all_of.py +++ b/apps/schematic/api/schematic_api/models/validation_rule_array.py @@ -11,16 +11,16 @@ from schematic_api.models.validation_rule import ValidationRule # noqa: E501 -class ValidationRulesPageAllOf(Model): +class ValidationRuleArray(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, validation_rules=None): # noqa: E501 - """ValidationRulesPageAllOf - a model defined in OpenAPI + """ValidationRuleArray - a model defined in OpenAPI - :param validation_rules: The validation_rules of this ValidationRulesPageAllOf. # noqa: E501 + :param validation_rules: The validation_rules of this ValidationRuleArray. # noqa: E501 :type validation_rules: List[ValidationRule] """ self.openapi_types = { @@ -34,37 +34,35 @@ def __init__(self, validation_rules=None): # noqa: E501 self._validation_rules = validation_rules @classmethod - def from_dict(cls, dikt) -> 'ValidationRulesPageAllOf': + def from_dict(cls, dikt) -> 'ValidationRuleArray': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The ValidationRulesPage_allOf of this ValidationRulesPageAllOf. # noqa: E501 - :rtype: ValidationRulesPageAllOf + :return: The ValidationRuleArray of this ValidationRuleArray. # noqa: E501 + :rtype: ValidationRuleArray """ return util.deserialize_model(dikt, cls) @property def validation_rules(self): - """Gets the validation_rules of this ValidationRulesPageAllOf. + """Gets the validation_rules of this ValidationRuleArray. - A list of validation rules. # noqa: E501 + An array of validation rules. # noqa: E501 - :return: The validation_rules of this ValidationRulesPageAllOf. + :return: The validation_rules of this ValidationRuleArray. :rtype: List[ValidationRule] """ return self._validation_rules @validation_rules.setter def validation_rules(self, validation_rules): - """Sets the validation_rules of this ValidationRulesPageAllOf. + """Sets the validation_rules of this ValidationRuleArray. - A list of validation rules. # noqa: E501 + An array of validation rules. # noqa: E501 - :param validation_rules: The validation_rules of this ValidationRulesPageAllOf. + :param validation_rules: The validation_rules of this ValidationRuleArray. :type validation_rules: List[ValidationRule] """ - if validation_rules is None: - raise ValueError("Invalid value for `validation_rules`, must not be `None`") # noqa: E501 self._validation_rules = validation_rules diff --git a/apps/schematic/api/schematic_api/models/validation_rules_page.py b/apps/schematic/api/schematic_api/models/validation_rules_page.py deleted file mode 100644 index 6e6947c105..0000000000 --- a/apps/schematic/api/schematic_api/models/validation_rules_page.py +++ /dev/null @@ -1,250 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from schematic_api.models.base_model_ import Model -from schematic_api.models.validation_rule import ValidationRule -from schematic_api import util - -from schematic_api.models.validation_rule import ValidationRule # noqa: E501 - -class ValidationRulesPage(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, number=None, size=None, total_elements=None, total_pages=None, has_next=None, has_previous=None, validation_rules=None): # noqa: E501 - """ValidationRulesPage - a model defined in OpenAPI - - :param number: The number of this ValidationRulesPage. # noqa: E501 - :type number: int - :param size: The size of this ValidationRulesPage. # noqa: E501 - :type size: int - :param total_elements: The total_elements of this ValidationRulesPage. # noqa: E501 - :type total_elements: int - :param total_pages: The total_pages of this ValidationRulesPage. # noqa: E501 - :type total_pages: int - :param has_next: The has_next of this ValidationRulesPage. # noqa: E501 - :type has_next: bool - :param has_previous: The has_previous of this ValidationRulesPage. # noqa: E501 - :type has_previous: bool - :param validation_rules: The validation_rules of this ValidationRulesPage. # noqa: E501 - :type validation_rules: List[ValidationRule] - """ - self.openapi_types = { - 'number': int, - 'size': int, - 'total_elements': int, - 'total_pages': int, - 'has_next': bool, - 'has_previous': bool, - 'validation_rules': List[ValidationRule] - } - - self.attribute_map = { - 'number': 'number', - 'size': 'size', - 'total_elements': 'totalElements', - 'total_pages': 'totalPages', - 'has_next': 'hasNext', - 'has_previous': 'hasPrevious', - 'validation_rules': 'validation_rules' - } - - self._number = number - self._size = size - self._total_elements = total_elements - self._total_pages = total_pages - self._has_next = has_next - self._has_previous = has_previous - self._validation_rules = validation_rules - - @classmethod - def from_dict(cls, dikt) -> 'ValidationRulesPage': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The ValidationRulesPage of this ValidationRulesPage. # noqa: E501 - :rtype: ValidationRulesPage - """ - return util.deserialize_model(dikt, cls) - - @property - def number(self): - """Gets the number of this ValidationRulesPage. - - The page number. # noqa: E501 - - :return: The number of this ValidationRulesPage. - :rtype: int - """ - return self._number - - @number.setter - def number(self, number): - """Sets the number of this ValidationRulesPage. - - The page number. # noqa: E501 - - :param number: The number of this ValidationRulesPage. - :type number: int - """ - if number is None: - raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501 - - self._number = number - - @property - def size(self): - """Gets the size of this ValidationRulesPage. - - The number of items in a single page. # noqa: E501 - - :return: The size of this ValidationRulesPage. - :rtype: int - """ - return self._size - - @size.setter - def size(self, size): - """Sets the size of this ValidationRulesPage. - - The number of items in a single page. # noqa: E501 - - :param size: The size of this ValidationRulesPage. - :type size: int - """ - if size is None: - raise ValueError("Invalid value for `size`, must not be `None`") # noqa: E501 - - self._size = size - - @property - def total_elements(self): - """Gets the total_elements of this ValidationRulesPage. - - Total number of elements in the result set. # noqa: E501 - - :return: The total_elements of this ValidationRulesPage. - :rtype: int - """ - return self._total_elements - - @total_elements.setter - def total_elements(self, total_elements): - """Sets the total_elements of this ValidationRulesPage. - - Total number of elements in the result set. # noqa: E501 - - :param total_elements: The total_elements of this ValidationRulesPage. - :type total_elements: int - """ - if total_elements is None: - raise ValueError("Invalid value for `total_elements`, must not be `None`") # noqa: E501 - - self._total_elements = total_elements - - @property - def total_pages(self): - """Gets the total_pages of this ValidationRulesPage. - - Total number of pages in the result set. # noqa: E501 - - :return: The total_pages of this ValidationRulesPage. - :rtype: int - """ - return self._total_pages - - @total_pages.setter - def total_pages(self, total_pages): - """Sets the total_pages of this ValidationRulesPage. - - Total number of pages in the result set. # noqa: E501 - - :param total_pages: The total_pages of this ValidationRulesPage. - :type total_pages: int - """ - if total_pages is None: - raise ValueError("Invalid value for `total_pages`, must not be `None`") # noqa: E501 - - self._total_pages = total_pages - - @property - def has_next(self): - """Gets the has_next of this ValidationRulesPage. - - Returns if there is a next page. # noqa: E501 - - :return: The has_next of this ValidationRulesPage. - :rtype: bool - """ - return self._has_next - - @has_next.setter - def has_next(self, has_next): - """Sets the has_next of this ValidationRulesPage. - - Returns if there is a next page. # noqa: E501 - - :param has_next: The has_next of this ValidationRulesPage. - :type has_next: bool - """ - if has_next is None: - raise ValueError("Invalid value for `has_next`, must not be `None`") # noqa: E501 - - self._has_next = has_next - - @property - def has_previous(self): - """Gets the has_previous of this ValidationRulesPage. - - Returns if there is a previous page. # noqa: E501 - - :return: The has_previous of this ValidationRulesPage. - :rtype: bool - """ - return self._has_previous - - @has_previous.setter - def has_previous(self, has_previous): - """Sets the has_previous of this ValidationRulesPage. - - Returns if there is a previous page. # noqa: E501 - - :param has_previous: The has_previous of this ValidationRulesPage. - :type has_previous: bool - """ - if has_previous is None: - raise ValueError("Invalid value for `has_previous`, must not be `None`") # noqa: E501 - - self._has_previous = has_previous - - @property - def validation_rules(self): - """Gets the validation_rules of this ValidationRulesPage. - - A list of validation rules. # noqa: E501 - - :return: The validation_rules of this ValidationRulesPage. - :rtype: List[ValidationRule] - """ - return self._validation_rules - - @validation_rules.setter - def validation_rules(self, validation_rules): - """Sets the validation_rules of this ValidationRulesPage. - - A list of validation rules. # noqa: E501 - - :param validation_rules: The validation_rules of this ValidationRulesPage. - :type validation_rules: List[ValidationRule] - """ - if validation_rules is None: - raise ValueError("Invalid value for `validation_rules`, must not be `None`") # noqa: E501 - - self._validation_rules = validation_rules diff --git a/apps/schematic/api/schematic_api/openapi/openapi.yaml b/apps/schematic/api/schematic_api/openapi/openapi.yaml index eac46f0796..41b33d94a7 100644 --- a/apps/schematic/api/schematic_api/openapi/openapi.yaml +++ b/apps/schematic/api/schematic_api/openapi/openapi.yaml @@ -83,10 +83,10 @@ paths: tags: - Storage x-openapi-router-controller: schematic_api.controllers.storage_controller - /assetTypes/{assetType}/assetViews/{assetViewId}/projects: + /assetTypes/{assetType}/assetViews/{assetViewId}/projectMetadataArray: get: description: Gets all storage projects the current user has access to. - operationId: get_projects + operationId: get_project_metadata_array parameters: - description: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for @@ -111,7 +111,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ProjectsPage' + $ref: '#/components/schemas/ProjectMetadataArray' description: Success "400": content: @@ -150,10 +150,98 @@ paths: tags: - Storage x-openapi-router-controller: schematic_api.controllers.storage_controller - /assetTypes/{assetType}/datasets/{datasetId}/files: + /assetTypes/{assetType}/assetViews/{assetViewId}/projectMetadataPage: + get: + description: Gets all storage projects the current user has access to. + operationId: get_project_metadata_page + parameters: + - description: ID of view listing all project data assets. E.g. for Synapse + this would be the Synapse ID of the fileview listing all data assets for + a given project + explode: false + in: path + name: assetViewId + required: true + schema: + $ref: '#/components/schemas/AssetViewId' + style: simple + - description: "Type of asset, such as Synapse" + explode: false + in: path + name: assetType + required: true + schema: + $ref: '#/components/schemas/AssetType' + style: simple + - description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectMetadataPage' + description: Success + "400": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Invalid request + "401": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "404": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The specified resource was not found + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The request cannot be fulfilled due to an unexpected server + error + security: + - bearerAuth: [] + summary: Gets all storage projects the current user has access to. + tags: + - Storage + x-openapi-router-controller: schematic_api.controllers.storage_controller + /assetTypes/{assetType}/datasets/{datasetId}/fileMetadataArray: get: description: Gets all files associated with a dataset. - operationId: get_dataset_files + operationId: get_dataset_file_metadata_array parameters: - description: The ID of a dataset. explode: false @@ -203,7 +291,120 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/FilesPage' + $ref: '#/components/schemas/FileMetadataArray' + description: Success + "400": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Invalid request + "401": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "404": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The specified resource was not found + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The request cannot be fulfilled due to an unexpected server + error + security: + - bearerAuth: [] + summary: Gets all files associated with a dataset. + tags: + - Storage + x-openapi-router-controller: schematic_api.controllers.storage_controller + /assetTypes/{assetType}/datasets/{datasetId}/fileMetadataPage: + get: + description: Gets all files associated with a dataset. + operationId: get_dataset_file_metadata_page + parameters: + - description: The ID of a dataset. + explode: false + in: path + name: datasetId + required: true + schema: + $ref: '#/components/schemas/DatasetId' + style: simple + - description: "Type of asset, such as Synapse" + explode: false + in: path + name: assetType + required: true + schema: + $ref: '#/components/schemas/AssetType' + style: simple + - description: A list of file names used to filter the output. + explode: true + in: query + name: fileNames + required: false + schema: + $ref: '#/components/schemas/FileNames' + style: form + - description: "Whether or not to return the full path of output, or just the\ + \ basename." + explode: true + in: query + name: useFullFilePath + required: false + schema: + $ref: '#/components/schemas/UseFullFilePath' + style: form + - description: ID of view listing all project data assets. E.g. for Synapse + this would be the Synapse ID of the fileview listing all data assets for + a given project + explode: true + in: query + name: assetViewId + required: true + schema: + $ref: '#/components/schemas/AssetViewId' + style: form + - description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/FileMetadataPage' description: Success "400": content: @@ -382,11 +583,88 @@ paths: tags: - Storage x-openapi-router-controller: schematic_api.controllers.storage_controller - /assetTypes/{assetType}/projects/{projectId}/datasets: + /assetTypes/{assetType}/projects/{projectId}/datasetMetadataArray: get: - description: Gets all datasets in folder under a given storage project that + description: Gets all dataset meatdata in folder under a given storage project + that the current user has access to. + operationId: get_project_dataset_metadata_array + parameters: + - description: The Synapse ID of a storage project. + explode: false + in: path + name: projectId + required: true + schema: + $ref: '#/components/schemas/ProjectId' + style: simple + - description: "Type of asset, such as Synapse" + explode: false + in: path + name: assetType + required: true + schema: + $ref: '#/components/schemas/AssetType' + style: simple + - description: ID of view listing all project data assets. E.g. for Synapse + this would be the Synapse ID of the fileview listing all data assets for + a given project + explode: true + in: query + name: assetViewId + required: true + schema: + $ref: '#/components/schemas/AssetViewId' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetMetadataArray' + description: Success + "400": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Invalid request + "401": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "404": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The specified resource was not found + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The request cannot be fulfilled due to an unexpected server + error + security: + - bearerAuth: [] + summary: Gets all dataset metadata in folder under a given storage project that the current user has access to. - operationId: get_project_datasets + tags: + - Storage + x-openapi-router-controller: schematic_api.controllers.storage_controller + /assetTypes/{assetType}/projects/{projectId}/datasetMetadataPage: + get: + description: Gets a page of dataset meatdata in folder under a given storage + project that the current user has access to. + operationId: get_project_dataset_metadata_page parameters: - description: The Synapse ID of a storage project. explode: false @@ -414,12 +692,33 @@ paths: schema: $ref: '#/components/schemas/AssetViewId' style: form + - description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form responses: "200": content: application/json: schema: - $ref: '#/components/schemas/DatasetsPage' + $ref: '#/components/schemas/DatasetMetadataPage' description: Success "400": content: @@ -454,16 +753,16 @@ paths: error security: - bearerAuth: [] - summary: Gets all datasets in folder under a given storage project that the - current user has access to. + summary: Gets a page of dataset metadata in folder under a given storage project + that the current user has access to. tags: - Storage x-openapi-router-controller: schematic_api.controllers.storage_controller - /assetTypes/{assetType}/projects/{projectId}/manifests: + /assetTypes/{assetType}/projects/{projectId}/manifestMetadataArray: get: description: Gets all manifests in a project folder that the current user has access to. - operationId: get_project_manifests + operationId: get_project_manifest_metadata_array parameters: - description: The Synapse ID of a storage project. explode: false @@ -496,7 +795,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ManifestsPage' + $ref: '#/components/schemas/ManifestMetadataArray' description: Success "400": content: @@ -533,22 +832,162 @@ paths: - bearerAuth: [] summary: Gets all manifests in a project folder that users have access to tags: - - Storage - x-openapi-router-controller: schematic_api.controllers.storage_controller - /components/{componentLabel}/: + - Storage + x-openapi-router-controller: schematic_api.controllers.storage_controller + /assetTypes/{assetType}/projects/{projectId}/manifestMetadataPage: + get: + description: Gets all manifests in a project folder that the current user has + access to. + operationId: get_project_manifest_metadata_page + parameters: + - description: The Synapse ID of a storage project. + explode: false + in: path + name: projectId + required: true + schema: + $ref: '#/components/schemas/ProjectId' + style: simple + - description: "Type of asset, such as Synapse" + explode: false + in: path + name: assetType + required: true + schema: + $ref: '#/components/schemas/AssetType' + style: simple + - description: ID of view listing all project data assets. E.g. for Synapse + this would be the Synapse ID of the fileview listing all data assets for + a given project + explode: true + in: query + name: assetViewId + required: true + schema: + $ref: '#/components/schemas/AssetViewId' + style: form + - description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ManifestMetadataPage' + description: Success + "400": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Invalid request + "401": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: Unauthorized + "404": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The specified resource was not found + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The request cannot be fulfilled due to an unexpected server + error + security: + - bearerAuth: [] + summary: Gets all manifests in a project folder that users have access to + tags: + - Storage + x-openapi-router-controller: schematic_api.controllers.storage_controller + /components/{componentLabel}/: + get: + description: Get all the attributes associated with a specific data model component + formatted as a dataframe (stored as a JSON String). + operationId: get_component + parameters: + - description: The label of a component in a schema + explode: false + in: path + name: componentLabel + required: true + schema: + $ref: '#/components/schemas/ComponentLabel' + style: simple + - description: The URL of a schema in jsonld form + explode: true + in: query + name: schemaUrl + required: true + schema: + $ref: '#/components/schemas/SchemaUrl' + style: form + - description: Whether to include the indexes of the dataframe in the returned + JSON string. + explode: true + in: query + name: includeIndex + required: false + schema: + default: false + type: boolean + style: form + responses: + "200": + content: + application/json: + schema: + description: The component as a json string + type: string + description: Success + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The request cannot be fulfilled due to an unexpected server + error + summary: Get all the attributes associated with a specific data model component + formatted as a dataframe (stored as a JSON String). + tags: + - Schema + x-openapi-router-controller: schematic_api.controllers.schema_controller + /connectedNodePairArray: get: - description: Get all the attributes associated with a specific data model component - formatted as a dataframe (stored as a JSON String). - operationId: get_component + description: Gets a array of connected node pairs + operationId: get_connected_node_pair_array parameters: - - description: The label of a component in a schema - explode: false - in: path - name: componentLabel - required: true - schema: - $ref: '#/components/schemas/ComponentLabel' - style: simple - description: The URL of a schema in jsonld form explode: true in: query @@ -557,23 +996,20 @@ paths: schema: $ref: '#/components/schemas/SchemaUrl' style: form - - description: Whether to include the indexes of the dataframe in the returned - JSON string. + - description: "Type of relationship in a schema, such as requiresDependency" explode: true in: query - name: includeIndex - required: false + name: relationshipType + required: true schema: - default: false - type: boolean + $ref: '#/components/schemas/RelationshipType' style: form responses: "200": content: application/json: schema: - description: The component as a json string - type: string + $ref: '#/components/schemas/ConnectedNodePairArray' description: Success "500": content: @@ -582,15 +1018,14 @@ paths: $ref: '#/components/schemas/BasicError' description: The request cannot be fulfilled due to an unexpected server error - summary: Get all the attributes associated with a specific data model component - formatted as a dataframe (stored as a JSON String). + summary: Gets an array of connected node pairs tags: - Schema x-openapi-router-controller: schematic_api.controllers.schema_controller - /connectedNodes: + /connectedNodePairPage: get: - description: Gets a list of connected node pairs - operationId: get_connected_nodes + description: Gets a page of connected node pairs + operationId: get_connected_node_pair_page parameters: - description: The URL of a schema in jsonld form explode: true @@ -608,12 +1043,33 @@ paths: schema: $ref: '#/components/schemas/RelationshipType' style: form + - description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form responses: "200": content: application/json: schema: - $ref: '#/components/schemas/ConnectedNodesPage' + $ref: '#/components/schemas/ConnectedNodePairPage' description: Success "500": content: @@ -622,7 +1078,7 @@ paths: $ref: '#/components/schemas/BasicError' description: The request cannot be fulfilled due to an unexpected server error - summary: Gets a list of connected node pairs + summary: Gets a page of connected node pairs tags: - Schema x-openapi-router-controller: schematic_api.controllers.schema_controller @@ -718,7 +1174,7 @@ paths: get: description: "Gets the validation rules, along with the arguments for each given\ \ rule associated with a given node" - operationId: list_node_validation_rules + operationId: get_node_validation_rules parameters: - description: The display name of the node in a schema explode: false @@ -741,7 +1197,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ValidationRulesPage' + $ref: '#/components/schemas/ValidationRuleArray' description: Success "500": content: @@ -755,11 +1211,71 @@ paths: tags: - Schema x-openapi-router-controller: schematic_api.controllers.schema_controller - /nodes/{nodeLabel}/dependencies: + /nodes/{nodeLabel}/dependencyArray: + get: + description: Gets the immediate dependencies that are related to the given source + node + operationId: get_node_dependency_array + parameters: + - description: The label of the source node in a schema to get the dependencies + of + explode: false + in: path + name: nodeLabel + required: true + schema: + $ref: '#/components/schemas/NodeLabel' + style: simple + - description: The URL of a schema in jsonld form + explode: true + in: query + name: schemaUrl + required: true + schema: + $ref: '#/components/schemas/SchemaUrl' + style: form + - description: "Whether or not to return the display names of the component,\ + \ otherwise the label" + explode: true + in: query + name: returnDisplayNames + required: false + schema: + $ref: '#/components/schemas/ReturnDisplayNames' + style: form + - description: "Whether or not to order the components by their order in the\ + \ schema, otherwise random" + explode: true + in: query + name: returnOrderedBySchema + required: false + schema: + $ref: '#/components/schemas/ReturnOrderedBySchema' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/NodeArray' + description: Success + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/BasicError' + description: The request cannot be fulfilled due to an unexpected server + error + summary: Gets the immediate dependencies that are related to the given source + node + tags: + - Schema + x-openapi-router-controller: schematic_api.controllers.schema_controller + /nodes/{nodeLabel}/dependencyPage: get: description: Gets the immediate dependencies that are related to the given source node - operationId: list_node_dependencies + operationId: get_node_dependency_page parameters: - description: The label of the source node in a schema to get the dependencies of @@ -796,12 +1312,33 @@ paths: schema: $ref: '#/components/schemas/ReturnOrderedBySchema' style: form + - description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form responses: "200": content: application/json: schema: - $ref: '#/components/schemas/NodesPage' + $ref: '#/components/schemas/NodePage' description: Success "500": content: @@ -842,7 +1379,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NodePropertiesPage' + $ref: '#/components/schemas/NodePropertyArray' description: Success "500": content: @@ -1420,6 +1957,29 @@ components: schema: $ref: '#/components/schemas/AssetViewId' style: form + pageNumber: + description: The page number to get for a paginated query + explode: true + in: query + name: pageNumber + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + pageMaxItems: + description: "The maximum number of items per page (up to 100,000) for paginated\ + \ endpoints" + explode: true + in: query + name: pageMaxItems + required: false + schema: + default: 100000 + minimum: 1 + type: integer + style: form assetViewId: description: ID of view listing all project data assets. E.g. for Synapse this would be the Synapse ID of the fileview listing all data assets for a given @@ -1745,6 +2305,46 @@ components: description: An asset view ID. example: syn23643253 type: string + DatasetMetadata: + description: The metadata of a dataset. + example: + name: Example dataset + id: Syn1 + properties: + name: + description: The name of the dataset. + example: Example dataset + title: name + type: string + id: + description: The ID of the dataset. + example: Syn1 + title: id + type: string + required: + - id + - name + title: DatasetMetadata + type: object + x-java-class-annotations: + - '@lombok.Builder' + DatasetMetadataArray: + description: An array of dataset metadata. + example: + datasets: + - name: Example dataset + id: Syn1 + - name: Example dataset + id: Syn1 + properties: + datasets: + description: An array of dataset meatdata. + items: + $ref: '#/components/schemas/DatasetMetadata' + title: datasets + type: array + title: DatasetMetadataArray + type: object PageMetadata: description: The metadata of a page. properties: @@ -1791,37 +2391,23 @@ components: - totalPages title: PageMetadata type: object - Dataset: - description: A dataset. - properties: - name: - description: The name of the dataset. - example: Example dataset - title: name - type: string - id: - description: The ID of the dataset. - example: Syn1 - title: id - type: string - required: - - id - - name - title: Dataset - type: object - x-java-class-annotations: - - '@lombok.Builder' - DatasetsPage: + DatasetMetadataPage: allOf: - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/DatasetsPage_allOf' - description: A page of datasets. - title: DatasetsPage + - $ref: '#/components/schemas/DatasetMetadataPage_allOf' + description: A page of dataset metadata. + title: DatasetMetadataPage type: object x-java-class-annotations: - '@lombok.Builder' - Manifest: - description: A manifest object + ManifestMetadata: + description: The metadata for a manifest file + example: + name: synapse_storage_manifest.csv + datasetName: dataset_X + datasetId: syn2 + id: syn1 + componentName: patient properties: name: description: The name of the manifest file. @@ -1851,14 +2437,37 @@ components: required: - id - name - title: Manifest + title: ManifestMetadata + type: object + ManifestMetadataArray: + description: An array of manifest metadata + example: + manifests: + - name: synapse_storage_manifest.csv + datasetName: dataset_X + datasetId: syn2 + id: syn1 + componentName: patient + - name: synapse_storage_manifest.csv + datasetName: dataset_X + datasetId: syn2 + id: syn1 + componentName: patient + properties: + manifests: + description: A list of manifest metadata + items: + $ref: '#/components/schemas/ManifestMetadata' + title: manifests + type: array + title: ManifestMetadataArray type: object - ManifestsPage: + ManifestMetadataPage: allOf: - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/ManifestsPage_allOf' - description: A page of manifests. - title: ManifestsPage + - $ref: '#/components/schemas/ManifestMetadataPage_allOf' + description: A page of manifest metadata + title: ManifestMetadataPage type: object x-java-class-annotations: - '@lombok.Builder' @@ -1872,8 +2481,11 @@ components: ManifestJson: description: A manifest in json format type: object - Project: - description: A project. + ProjectMetadata: + description: The metadata for a project + example: + name: Example project + id: Syn1 properties: name: description: The name of the project. @@ -1888,16 +2500,33 @@ components: required: - id - name - title: Project + title: ProjectMetadata type: object x-java-class-annotations: - '@lombok.Builder' - ProjectsPage: + ProjectMetadataArray: + description: An array of project metadata. + example: + projects: + - name: Example project + id: Syn1 + - name: Example project + id: Syn1 + properties: + projects: + description: An array of project metadata. + items: + $ref: '#/components/schemas/ProjectMetadata' + title: projects + type: array + title: ProjectMetadataArray + type: object + ProjectMetadataPage: allOf: - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/ProjectsPage_allOf' - description: A page of projects. - title: ProjectsPage + - $ref: '#/components/schemas/ProjectMetadataPage_allOf' + description: A page of project metadata. + title: ProjectMetadataPage type: object x-java-class-annotations: - '@lombok.Builder' @@ -1911,8 +2540,11 @@ components: description: "Whether or not to return the full path of output, or just the\ \ basename." type: boolean - File: - description: A file. + FileMetadata: + description: The metadata for a file + example: + name: file.txt + id: Syn1 properties: name: description: The name of the file. @@ -1927,16 +2559,33 @@ components: required: - id - name - title: File + title: FileMetadata type: object x-java-class-annotations: - '@lombok.Builder' - FilesPage: + FileMetadataArray: + description: A list of file metadata. + example: + files: + - name: file.txt + id: Syn1 + - name: file.txt + id: Syn1 + properties: + files: + description: A list of file metadata. + items: + $ref: '#/components/schemas/FileMetadata' + title: files + type: array + title: FileMetadataArray + type: object + FileMetadataPage: allOf: - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/FilesPage_allOf' - description: A page of files. - title: FilesPage + - $ref: '#/components/schemas/FileMetadataPage_allOf' + description: A page of file metadata. + title: FileMetadataPage type: object x-java-class-annotations: - '@lombok.Builder' @@ -1964,6 +2613,8 @@ components: type: boolean Node: description: A node of a schema. + example: + name: Patient properties: name: description: The name of the node. @@ -1976,12 +2627,27 @@ components: type: object x-java-class-annotations: - '@lombok.Builder' - NodesPage: + NodeArray: + description: An array of nodes. + example: + nodes: + - name: Patient + - name: Patient + properties: + nodes: + description: An array of nodes. + items: + $ref: '#/components/schemas/Node' + title: nodes + type: array + title: NodeArray + type: object + NodePage: allOf: - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/NodesPage_allOf' + - $ref: '#/components/schemas/NodePage_allOf' description: A page of nodes. - title: NodesPage + title: NodePage type: object x-java-class-annotations: - '@lombok.Builder' @@ -1989,27 +2655,21 @@ components: description: The display name of a node in a schema example: MolecularEntity type: string - NodeProperty: - description: A node property + NodePropertyArray: + description: An array of node properties. + example: + node_properties: + - node_properties + - node_properties properties: - name: - description: The name of the property - example: molecularlyInteractsWith - title: name - type: string - required: - - name - title: NodeProperty - type: object - NodePropertiesPage: - allOf: - - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/NodePropertiesPage_allOf' - description: A page of node properties. - title: NodePropertiesPage + node_properties: + description: An array of node properties. + items: + type: string + title: node_properties + type: array + title: NodePropertyArray type: object - x-java-class-annotations: - - '@lombok.Builder' UseStrictCamelCase: default: true description: Whether or not to use the more strict way of converting to camel @@ -2021,6 +2681,8 @@ components: type: string ValidationRule: description: A validation rule. + example: + name: list strict properties: name: description: "The name of the rule, along with the arguments for the given\ @@ -2034,15 +2696,21 @@ components: type: object x-java-class-annotations: - '@lombok.Builder' - ValidationRulesPage: - allOf: - - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/ValidationRulesPage_allOf' - description: A page of validation rules. - title: ValidationRulesPage + ValidationRuleArray: + description: An array of validation rules. + example: + validation_rules: + - name: list strict + - name: list strict + properties: + validation_rules: + description: An array of validation rules. + items: + $ref: '#/components/schemas/ValidationRule' + title: validation_rules + type: array + title: ValidationRuleArray type: object - x-java-class-annotations: - - '@lombok.Builder' ComponentLabel: description: The label of a component in a schema example: MolecularEntity @@ -2051,8 +2719,11 @@ components: description: A type of schema relationship example: requiresDependency type: string - ConnectedNodes: + ConnectedNodePair: description: A pair of conncted nodes + example: + node2: Node2 + node1: Node1 properties: node1: description: The disaplay name of the first node. @@ -2067,16 +2738,33 @@ components: required: - node1 - node2 - title: ConnectedNodes + title: ConnectedNodePair type: object x-java-class-annotations: - '@lombok.Builder' - ConnectedNodesPage: + ConnectedNodePairArray: + description: An array of conncted node pairs + example: + connectedNodes: + - node2: Node2 + node1: Node1 + - node2: Node2 + node1: Node1 + properties: + connectedNodes: + description: An array of conncted node pairs. + items: + $ref: '#/components/schemas/ConnectedNodePair' + title: connectedNodes + type: array + title: ConnectedNodePairArray + type: object + ConnectedNodePairPage: allOf: - $ref: '#/components/schemas/PageMetadata' - - $ref: '#/components/schemas/ConnectedNodesPage_allOf' - description: A page of conncted nodes. - title: ConnectedNodesPage + - $ref: '#/components/schemas/ConnectedNodePairPage_allOf' + description: A page of conncted node pairs + title: ConnectedNodePairPage type: object x-java-class-annotations: - '@lombok.Builder' @@ -2117,108 +2805,82 @@ components: description: Tangled tree plain or higlighted text to display for a given data model type: object - DatasetsPage_allOf: + DatasetMetadataPage_allOf: properties: datasets: - description: A list of datasets. + description: An array of dataset meatdata. items: - $ref: '#/components/schemas/Dataset' + $ref: '#/components/schemas/DatasetMetadata' title: datasets type: array required: - datasets - title: DatasetsPage_allOf + title: DatasetMetadataPage_allOf type: object example: null - ManifestsPage_allOf: + ManifestMetadataPage_allOf: properties: manifests: - description: A list of manifests. + description: A list of manifest metadata items: - $ref: '#/components/schemas/Manifest' + $ref: '#/components/schemas/ManifestMetadata' title: manifests type: array required: - manifests - title: ManifestsPage_allOf + title: ManifestMetadataPage_allOf type: object example: null - ProjectsPage_allOf: + ProjectMetadataPage_allOf: properties: projects: - description: A list of projects. + description: An array of project metadata. items: - $ref: '#/components/schemas/Project' + $ref: '#/components/schemas/ProjectMetadata' title: projects type: array required: - projects - title: ProjectsPage_allOf + title: ProjectMetadataPage_allOf type: object example: null - FilesPage_allOf: + FileMetadataPage_allOf: properties: files: - description: A list of files. + description: A list of file metadata. items: - $ref: '#/components/schemas/File' + $ref: '#/components/schemas/FileMetadata' title: files type: array required: - files - title: FilesPage_allOf + title: FileMetadataPage_allOf type: object example: null - NodesPage_allOf: + NodePage_allOf: properties: nodes: - description: A list of nodes. + description: An array of nodes. items: $ref: '#/components/schemas/Node' title: nodes type: array required: - nodes - title: NodesPage_allOf - type: object - example: null - NodePropertiesPage_allOf: - properties: - node_properties: - description: A list of node properties. - items: - $ref: '#/components/schemas/NodeProperty' - title: node_properties - type: array - required: - - node_properties - title: NodePropertiesPage_allOf - type: object - example: null - ValidationRulesPage_allOf: - properties: - validation_rules: - description: A list of validation rules. - items: - $ref: '#/components/schemas/ValidationRule' - title: validation_rules - type: array - required: - - validation_rules - title: ValidationRulesPage_allOf + title: NodePage_allOf type: object example: null - ConnectedNodesPage_allOf: + ConnectedNodePairPage_allOf: properties: - connected_nodes: - description: A list of conncted node pairs. + connectedNodes: + description: An array of conncted node pairs. items: - $ref: '#/components/schemas/ConnectedNodes' - title: connected_nodes + $ref: '#/components/schemas/ConnectedNodePair' + title: connectedNodes type: array required: - - connected_nodes - title: ConnectedNodesPage_allOf + - connectedNodes + title: ConnectedNodePairPage_allOf type: object example: null securitySchemes: diff --git a/apps/schematic/api/schematic_api/test/conftest.py b/apps/schematic/api/schematic_api/test/conftest.py index 5ae30b730c..990cda017d 100644 --- a/apps/schematic/api/schematic_api/test/conftest.py +++ b/apps/schematic/api/schematic_api/test/conftest.py @@ -4,6 +4,8 @@ import pandas as pd +from schematic_api.models.manifest_metadata import ManifestMetadata + def csv_to_bytes(path: str) -> str: """reads in a csv file and returns as bytes""" @@ -19,8 +21,37 @@ def csv_to_json_str(path: str) -> str: EXAMPLE_MANIFEST_METADATA = [ - (("dataset_id1", "dataset_name1"), ("syn1", "name1"), ("component1", "component1")), - (("dataset_id2", "dataset_name2"), ("syn2", "name2"), ("component2", "component2")), + ManifestMetadata( + name="name", + id="id", + dataset_name="name", + dataset_id="id", + component_name="name", + ), + ManifestMetadata( + name="name", + id="id", + dataset_name="name", + dataset_id="id", + component_name="name", + ), +] + +MANIFEST_METADATA_KEYS = [ + "componentName", + "datasetId", + "datasetName", + "id", + "name", +] + +PAGING_KEYS = [ + "hasNext", + "hasPrevious", + "number", + "size", + "totalElements", + "totalPages", ] diff --git a/apps/schematic/api/schematic_api/test/test_paging.py b/apps/schematic/api/schematic_api/test/test_paging.py new file mode 100644 index 0000000000..b9d70847af --- /dev/null +++ b/apps/schematic/api/schematic_api/test/test_paging.py @@ -0,0 +1,108 @@ +"""Testing for pagination utilities""" + +import pytest + +from schematic_api.controllers.paging import ( + get_item_slice, + get_page_amount, + get_page_indeces, + Page, +) + + +class TestPage: + """Tests for Page class""" + + def test_page1(self) -> None: + """Tests for Page class""" + items = list(range(1, 22)) + page = Page(items, page_max_items=5, page_number=1) + assert page.page_number == 1 + assert page.page_max_items == 5 + assert page.total_items == 21 + assert page.total_pages == 5 + assert page.has_next + assert not page.has_previous + assert page.items == [1, 2, 3, 4, 5] + + def test_page2(self) -> None: + """Tests for Page class""" + items = list(range(1, 22)) + page = Page(items, page_max_items=5, page_number=2) + assert page.page_number == 2 + assert page.page_max_items == 5 + assert page.total_items == 21 + assert page.total_pages == 5 + assert page.has_next + assert page.has_previous + assert page.items == [6, 7, 8, 9, 10] + + def test_page3(self) -> None: + """Tests for Page class""" + items = list(range(1, 22)) + page = Page(items, page_max_items=5, page_number=5) + assert page.page_number == 5 + assert page.page_max_items == 5 + assert page.total_items == 21 + assert page.total_pages == 5 + assert not page.has_next + assert page.has_previous + assert page.items == [21] + + +class TestPagingUtils: + """Tests for various paging utils""" + + def test_get_page_amount(self) -> None: + """Tests for get_page_amount""" + assert get_page_amount(1, 1) == 1 + assert get_page_amount(2, 1) == 2 + assert get_page_amount(11, 10) == 2 + assert get_page_amount(0, 1) == 0 + with pytest.raises( + ValueError, match="('total_items must be 0 or greater: ', -1)" + ): + get_page_amount(-1, 1) + with pytest.raises( + ValueError, match="('page_max_items must be 1 or greater: ', 0)" + ): + get_page_amount(0, 0) + + def test_get_item_slice(self) -> None: + """Tests for get_item_slice""" + lst = list(range(1, 8)) + assert get_item_slice(items=lst, page_max_items=1, page_number=1) == [1] + assert get_item_slice(items=lst, page_max_items=1, page_number=2) == [2] + assert get_item_slice(items=lst, page_max_items=1, page_number=7) == [7] + assert get_item_slice(items=lst, page_max_items=1, page_number=8) == [] + assert get_item_slice(items=lst, page_max_items=1, page_number=2) == [2] + assert get_item_slice(items=lst, page_max_items=3, page_number=1) == [1, 2, 3] + assert get_item_slice(items=lst, page_max_items=3, page_number=2) == [4, 5, 6] + assert get_item_slice(items=lst, page_max_items=3, page_number=3) == [7] + + def test_get_page_indeces(self) -> None: + """Tests for get_page_indeces""" + assert get_page_indeces(total_items=21, page_max_items=10, page_number=1) == ( + 0, + 10, + ) + assert get_page_indeces(total_items=21, page_max_items=10, page_number=2) == ( + 10, + 20, + ) + assert get_page_indeces(total_items=21, page_max_items=10, page_number=3) == ( + 20, + 21, + ) + with pytest.raises( + ValueError, match="('total_items must be 0 or greater: ', -1)" + ): + get_page_indeces(-1, 1, 1) + with pytest.raises( + ValueError, match="('page_max_items must be 1 or greater: ', 0)" + ): + get_page_indeces(0, 0, 1) + with pytest.raises( + ValueError, match="('page_number must be 1 or greater: ', 0)" + ): + get_page_indeces(0, 1, 0) diff --git a/apps/schematic/api/schematic_api/test/test_schema_controller_endpoints.py b/apps/schematic/api/schematic_api/test/test_schema_controller_endpoints.py index 8381baa9d4..526d9c311e 100644 --- a/apps/schematic/api/schematic_api/test/test_schema_controller_endpoints.py +++ b/apps/schematic/api/schematic_api/test/test_schema_controller_endpoints.py @@ -4,7 +4,7 @@ import unittest from schematic_api.test import BaseTestCase -from .conftest import TEST_SCHEMA_URL +from .conftest import TEST_SCHEMA_URL, PAGING_KEYS HEADERS = { "Accept": "application/json", @@ -12,13 +12,15 @@ } COMPONENT_URL = "/api/v1/components/Patient/?schemaUrl=" -CONNECTED_NODES_URL = "/api/v1/connectedNodes?schemaUrl=" +CONNECTED_NODE_PAIR_ARRAY_URL = "/api/v1/connectedNodePairArray?schemaUrl=" +CONNECTED_NODE_PAIR_PAGE_URL = "/api/v1/connectedNodePairPage?schemaUrl=" NODE_IS_REQUIRED_URL = "/api/v1/nodes/FamilyHistory/isRequired?schemaUrl=" PROPERTY_LABEL_URL = "/api/v1/nodes/node_label/propertyLabel?schemaUrl=" SCHEMA_ATTRIBUTES_URL = "/api/v1/schemaAttributes?schemaUrl=" NODE_PROPERTIES_URL = "/api/v1/nodes/MolecularEntity/nodeProperties?schemaUrl=" NODE_VALIDATION_RULES_URL = "/api/v1/nodes/CheckRegexList/validationRules?schemaUrl=" -NODE_DEPENDENCIES_URL = "/api/v1/nodes/Patient/dependencies?schemaUrl=" +NODE_DEPENDENCY_ARRAY_URL = "/api/v1/nodes/Patient/dependencyArray?schemaUrl=" +NODE_DEPENDENCY_PAGE_URL = "/api/v1/nodes/Patient/dependencyPage?schemaUrl=" class TestGetComponent(BaseTestCase): @@ -45,26 +47,58 @@ def test_404(self) -> None: self.assert404(response, f"Response body is : {response.data.decode('utf-8')}") -class TestGetConnectedNodes(BaseTestCase): - """Tests for connected nodes endpoint""" +class TestGetConnectedNodePairArray(BaseTestCase): + """Tests for connected node pair array endpoint""" def test_success(self) -> None: """Test for successful result""" - url = f"{CONNECTED_NODES_URL}{TEST_SCHEMA_URL}&relationshipType=requiresDependency" + url = ( + f"{CONNECTED_NODE_PAIR_ARRAY_URL}{TEST_SCHEMA_URL}" + "&relationshipType=requiresDependency" + ) response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalPages"] == 1 - connected_nodes = response.json["connected_nodes"] - assert connected_nodes - assert isinstance(connected_nodes, list) + result = response.json + assert isinstance(result, dict) + assert isinstance(result["connectedNodes"], list) + for item in result["connectedNodes"]: + assert isinstance(item, dict) + assert isinstance(item["node1"], str) + assert isinstance(item["node2"], str) def test_500(self) -> None: """Test for 500 result""" - url = f"{CONNECTED_NODES_URL}not_a_url&relationshipType=requiresDependency" + url = f"{CONNECTED_NODE_PAIR_ARRAY_URL}not_a_url&relationshipType=requiresDependency" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert500(response, f"Response body is : {response.data.decode('utf-8')}") + + +class TestGetConnectedNodePairPage(BaseTestCase): + """Tests for connected node pair page endpoint""" + + def test_success(self) -> None: + """Test for successful result""" + url = f"{CONNECTED_NODE_PAIR_PAGE_URL}{TEST_SCHEMA_URL}&relationshipType=requiresDependency" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == sorted(PAGING_KEYS + ["connectedNodes"]) + assert result["number"] == 1 + assert result["size"] == 100000 + assert not result["hasNext"] + assert not result["hasPrevious"] + assert result["totalPages"] == 1 + assert isinstance(result["totalElements"], int) + assert isinstance(result["connectedNodes"], list) + for item in result["connectedNodes"]: + assert isinstance(item, dict) + assert isinstance(item["node1"], str) + assert isinstance(item["node2"], str) + + def test_500(self) -> None: + """Test for 500 result""" + url = f"{CONNECTED_NODE_PAIR_PAGE_URL}not_a_url&relationshipType=requiresDependency" response = self.client.open(url, method="GET", headers=HEADERS) self.assert500(response, f"Response body is : {response.data.decode('utf-8')}") @@ -128,13 +162,11 @@ def test_success(self) -> None: url = f"{NODE_PROPERTIES_URL}{TEST_SCHEMA_URL}" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalPages"] == 1 - node_properties = response.json["node_properties"] - assert isinstance(node_properties, list) + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == ["node_properties"] + for item in result["node_properties"]: + assert isinstance(item, str) def test_500(self) -> None: """Test for 500 result""" @@ -143,69 +175,121 @@ def test_500(self) -> None: self.assert500(response, f"Response body is : {response.data.decode('utf-8')}") -class TestNodeValidationRules(BaseTestCase): +class TestGetNodeValidationRules(BaseTestCase): """Test case for node validation rules endpoint""" def test_success(self) -> None: """Test for successful result""" url = f"{NODE_VALIDATION_RULES_URL}{TEST_SCHEMA_URL}" response = self.client.open(url, method="GET", headers=HEADERS) + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == ["validation_rules"] + assert isinstance(result["validation_rules"], list) + for item in result["validation_rules"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["name"] + assert isinstance(item["name"], str) + + def test_500(self) -> None: + """Test for 500 result""" + url = f"{NODE_VALIDATION_RULES_URL}not_a_url" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert500(response, f"Response body is : {response.data.decode('utf-8')}") + + +class TestGetNodeDependencyArray(BaseTestCase): + """Test case for node depencencies endpoint""" + + def test_success(self) -> None: + """Test for successful result""" + url = f"{NODE_DEPENDENCY_ARRAY_URL}{TEST_SCHEMA_URL}" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == ["nodes"] + assert isinstance(result["nodes"], list) + for item in result["nodes"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["name"] + assert isinstance(item["name"], str) + + def test_return_display_names(self) -> None: + """Test for returnDisplayNames parameter""" + url = f"{NODE_DEPENDENCY_ARRAY_URL}{TEST_SCHEMA_URL}&returnDisplayNames=true" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + + url = f"{NODE_DEPENDENCY_ARRAY_URL}{TEST_SCHEMA_URL}&returnDisplayNames=false" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + + def test_return_ordered_by_schema(self) -> None: + """Test for returnOrderedBySchema parameter""" + url = f"{NODE_DEPENDENCY_ARRAY_URL}{TEST_SCHEMA_URL}&returnOrderedBySchema=true" + response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalPages"] == 1 - validation_rules = response.json["validation_rules"] - assert validation_rules + url = ( + f"{NODE_DEPENDENCY_ARRAY_URL}{TEST_SCHEMA_URL}&returnOrderedBySchema=false" + ) + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") def test_500(self) -> None: """Test for 500 result""" - url = f"{NODE_VALIDATION_RULES_URL}not_a_url" + url = f"{NODE_DEPENDENCY_ARRAY_URL}not_a_url" response = self.client.open(url, method="GET", headers=HEADERS) self.assert500(response, f"Response body is : {response.data.decode('utf-8')}") -class TestNodeDependencies(BaseTestCase): +class TestGetNodeDependencyPage(BaseTestCase): """Test case for node depencencies endpoint""" def test_success(self) -> None: """Test for successful result""" - url = f"{NODE_DEPENDENCIES_URL}{TEST_SCHEMA_URL}" + url = f"{NODE_DEPENDENCY_PAGE_URL}{TEST_SCHEMA_URL}" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalPages"] == 1 - dependencies = response.json["nodes"] - assert dependencies + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == sorted(PAGING_KEYS + ["nodes"]) + assert result["number"] == 1 + assert result["size"] == 100000 + assert not result["hasNext"] + assert not result["hasPrevious"] + assert result["totalPages"] == 1 + assert isinstance(result["totalElements"], int) + assert isinstance(result["nodes"], list) + for item in result["nodes"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["name"] + assert isinstance(item["name"], str) def test_return_display_names(self) -> None: """Test for returnDisplayNames parameter""" - url = f"{NODE_DEPENDENCIES_URL}{TEST_SCHEMA_URL}&returnDisplayNames=true" + url = f"{NODE_DEPENDENCY_PAGE_URL}{TEST_SCHEMA_URL}&returnDisplayNames=true" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") - url = f"{NODE_DEPENDENCIES_URL}{TEST_SCHEMA_URL}&returnDisplayNames=false" + url = f"{NODE_DEPENDENCY_PAGE_URL}{TEST_SCHEMA_URL}&returnDisplayNames=false" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") def test_return_ordered_by_schema(self) -> None: """Test for returnOrderedBySchema parameter""" - url = f"{NODE_DEPENDENCIES_URL}{TEST_SCHEMA_URL}&returnOrderedBySchema=true" + url = f"{NODE_DEPENDENCY_PAGE_URL}{TEST_SCHEMA_URL}&returnOrderedBySchema=true" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") - url = f"{NODE_DEPENDENCIES_URL}{TEST_SCHEMA_URL}&returnOrderedBySchema=false" + url = f"{NODE_DEPENDENCY_PAGE_URL}{TEST_SCHEMA_URL}&returnOrderedBySchema=false" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") def test_500(self) -> None: """Test for 500 result""" - url = f"{NODE_DEPENDENCIES_URL}not_a_url" + url = f"{NODE_DEPENDENCY_PAGE_URL}not_a_url" response = self.client.open(url, method="GET", headers=HEADERS) self.assert500(response, f"Response body is : {response.data.decode('utf-8')}") diff --git a/apps/schematic/api/schematic_api/test/test_schema_controller_impl.py b/apps/schematic/api/schematic_api/test/test_schema_controller_impl.py index 15cf4b966c..c85cbc05a7 100644 --- a/apps/schematic/api/schematic_api/test/test_schema_controller_impl.py +++ b/apps/schematic/api/schematic_api/test/test_schema_controller_impl.py @@ -1,19 +1,27 @@ """Tests for schema endpoint functions""" +# pylint: disable=duplicate-code from schematic_api.models.basic_error import BasicError -from schematic_api.models.node_properties_page import NodePropertiesPage -from schematic_api.models.validation_rules_page import ValidationRulesPage -from schematic_api.models.nodes_page import NodesPage -from schematic_api.models.connected_nodes_page import ConnectedNodesPage +from schematic_api.models.node_property_array import NodePropertyArray +from schematic_api.models.validation_rule import ValidationRule +from schematic_api.models.validation_rule_array import ValidationRuleArray +from schematic_api.models.node import Node +from schematic_api.models.node_array import NodeArray +from schematic_api.models.node_page import NodePage +from schematic_api.models.connected_node_pair_page import ConnectedNodePairPage +from schematic_api.models.connected_node_pair_array import ConnectedNodePairArray +from schematic_api.models.connected_node_pair import ConnectedNodePair from schematic_api.controllers.schema_controller_impl import ( get_component, + get_connected_node_pair_page, + get_connected_node_pair_array, get_node_is_required, get_property_label, get_schema_attributes, get_node_properties, - get_connected_nodes, - list_node_validation_rules, - list_node_dependencies, + get_node_validation_rules, + get_node_dependency_array, + get_node_dependency_page, ) @@ -37,21 +45,59 @@ def test_internal_error(self, test_schema_url: str) -> None: assert isinstance(result, BasicError) -class TestGetConnectedNodes: - """Tests forget_connected_nodes""" +class TestGetConnectedNodePairArray: + """Tests get_connected_node_pair_array""" def test_success(self, test_schema_url: str) -> None: """Test for successful result""" - result, status = get_connected_nodes( + result, status = get_connected_node_pair_array( schema_url=test_schema_url, relationship_type="requiresDependency", ) assert status == 200 - assert isinstance(result, ConnectedNodesPage) + assert isinstance(result, ConnectedNodePairArray) + assert isinstance(result.connected_nodes, list) + for item in result.connected_nodes: + assert isinstance(item, ConnectedNodePair) + assert isinstance(item.node1, str) + assert isinstance(item.node2, str) def test_internal_error(self) -> None: """Test for 500 result""" - result, status = get_connected_nodes( + result, status = get_connected_node_pair_array( + schema_url="not_a_url", + relationship_type="requiresDependency", + ) + assert status == 500 + assert isinstance(result, BasicError) + + +class TestGetConnectedNodePairPage: + """Tests get_connected_node_pair_page""" + + def test_success(self, test_schema_url: str) -> None: + """Test for successful result""" + result, status = get_connected_node_pair_page( + schema_url=test_schema_url, + relationship_type="requiresDependency", + ) + assert status == 200 + assert isinstance(result, ConnectedNodePairPage) + assert result.number == 1 + assert result.size == 100000 + assert isinstance(result.total_elements, int) + assert isinstance(result.total_pages, int) + assert isinstance(result.has_next, bool) + assert isinstance(result.has_previous, bool) + assert isinstance(result.connected_nodes, list) + for item in result.connected_nodes: + assert isinstance(item, ConnectedNodePair) + assert isinstance(item.node1, str) + assert isinstance(item.node2, str) + + def test_internal_error(self) -> None: + """Test for 500 result""" + result, status = get_connected_node_pair_page( schema_url="not_a_url", relationship_type="requiresDependency", ) @@ -131,7 +177,10 @@ def test_success(self, test_schema_url: str) -> None: schema_url=test_schema_url, ) assert status == 200 - assert isinstance(result, NodePropertiesPage) + assert isinstance(result, NodePropertyArray) + assert isinstance(result.node_properties, list) + for item in result.node_properties: + assert isinstance(item, str) def test_internal_error(self) -> None: """Test for 500 result""" @@ -143,21 +192,25 @@ def test_internal_error(self) -> None: assert isinstance(result, BasicError) -class TestNodeValidationRules: - """Test case for list_node_validation_rules""" +class TestGetNodeValidationRuleArray: + """Test case for get_node_validation_rules""" def test_success(self, test_schema_url: str) -> None: """Test for successful result""" - result, status = list_node_validation_rules( + result, status = get_node_validation_rules( node_display="CheckRegexList", schema_url=test_schema_url, ) assert status == 200 - assert isinstance(result, ValidationRulesPage) + assert isinstance(result, ValidationRuleArray) + assert isinstance(result.validation_rules, list) + for item in result.validation_rules: + assert isinstance(item, ValidationRule) + assert isinstance(item.name, str) def test_internal_error(self) -> None: """Test for 500 result""" - result, status = list_node_validation_rules( + result, status = get_node_validation_rules( node_display="CheckRegexList", schema_url="not_a_url", ) @@ -165,21 +218,57 @@ def test_internal_error(self) -> None: assert isinstance(result, BasicError) -class TestListNodeDependencies: - """Test case for list_node_dependencies""" +class TestGetNodeDependencyArray: + """Test case for get_node_dependency_array""" + + def test_success(self, test_schema_url: str) -> None: + """Test for successful result""" + result, status = get_node_dependency_array( + schema_url=test_schema_url, + node_label="Patient", + ) + assert status == 200 + assert isinstance(result, NodeArray) + assert isinstance(result.nodes, list) + for item in result.nodes: + assert isinstance(item, Node) + assert isinstance(item.name, str) + + def test_internal_error(self) -> None: + """Test for 500 result""" + result, status = get_node_dependency_page( + schema_url="not_a_url", + node_label="Patient", + ) + assert status == 500 + assert isinstance(result, BasicError) + + +class TestGetNodeDependencyPage: + """Test case for get_node_dependency_page""" def test_success(self, test_schema_url: str) -> None: """Test for successful result""" - result, status = list_node_dependencies( + result, status = get_node_dependency_page( schema_url=test_schema_url, node_label="Patient", ) assert status == 200 - assert isinstance(result, NodesPage) + assert isinstance(result, NodePage) + assert result.number == 1 + assert result.size == 100000 + assert isinstance(result.total_elements, int) + assert isinstance(result.total_pages, int) + assert isinstance(result.has_next, bool) + assert isinstance(result.has_previous, bool) + assert isinstance(result.nodes, list) + for item in result.nodes: + assert isinstance(item, Node) + assert isinstance(item.name, str) def test_internal_error(self) -> None: """Test for 500 result""" - result, status = list_node_dependencies( + result, status = get_node_dependency_page( schema_url="not_a_url", node_label="Patient", ) diff --git a/apps/schematic/api/schematic_api/test/test_storage_controller_endpoints.py b/apps/schematic/api/schematic_api/test/test_storage_controller_endpoints.py index 83997b9621..d7deee6d22 100644 --- a/apps/schematic/api/schematic_api/test/test_storage_controller_endpoints.py +++ b/apps/schematic/api/schematic_api/test/test_storage_controller_endpoints.py @@ -1,4 +1,5 @@ """Tests for endpoints""" +# pylint: disable=duplicate-code import unittest from unittest.mock import patch @@ -9,7 +10,10 @@ import schematic_api.controllers.storage_controller_impl from schematic_api.test import BaseTestCase -from .conftest import EXAMPLE_MANIFEST_METADATA +from schematic_api.models.file_metadata import FileMetadata +from schematic_api.models.dataset_metadata import DatasetMetadata +from schematic_api.models.project_metadata import ProjectMetadata +from .conftest import EXAMPLE_MANIFEST_METADATA, MANIFEST_METADATA_KEYS, PAGING_KEYS HEADERS = { "Accept": "application/json", @@ -17,17 +21,33 @@ } ASSET_VIEW_JSON_URL = "/api/v1/assetTypes/synapse/assetViews/syn1/json" -DATASET_FILES_URL = "/api/v1/assetTypes/synapse/datasets/syn2/files?assetViewId=syn1" +DATASET_FILE_METADATA_ARRAY_URL = ( + "/api/v1/assetTypes/synapse/datasets/syn2/fileMetadataArray?assetViewId=syn1" +) +DATASET_FILE_METADATA_PAGE_URL = ( + "/api/v1/assetTypes/synapse/datasets/syn2/fileMetadataPage?assetViewId=syn1" +) DATASET_MANIFEST_JSON_URL = ( "/api/v1/assetTypes/synapse/datasets/syn2/manifestJson?assetViewId=syn1" ) MANIFEST_JSON_URL = "/api/v1/assetTypes/synapse/manifests/syn1/json" -PROJECTS_URL = "/api/v1/assetTypes/synapse/assetViews/syn1/projects" -PROJECT_DATASETS_URL = ( - "/api/v1/assetTypes/synapse/projects/syn2/datasets?assetViewId=syn1" +PROJECT_METADATA_ARRAY_URL = ( + "/api/v1/assetTypes/synapse/assetViews/syn1/projectMetadataArray" +) +PROJECT_METADATA_PAGE_URL = ( + "/api/v1/assetTypes/synapse/assetViews/syn1/projectMetadataPage" +) +PROJECT_DATASET_METATDATA_ARRRAY_URL = ( + "/api/v1/assetTypes/synapse/projects/syn2/datasetMetadataArray?assetViewId=syn1" +) +PROJECT_DATASET_METATDATA_PAGE_URL = ( + "/api/v1/assetTypes/synapse/projects/syn2/datasetMetadataPage?assetViewId=syn1" ) -PROJECT_MANIFESTS_URL = ( - "/api/v1/assetTypes/synapse/projects/syn2/manifests?assetViewId=syn1" +PROJECT_MANIFEST_METADATA_ARRAY_URL = ( + "/api/v1/assetTypes/synapse/projects/syn2/manifestMetadataArray?assetViewId=syn1" +) +PROJECT_MANIFEST_METADATA_PAGE_URL = ( + "/api/v1/assetTypes/synapse/projects/syn2/manifestMetadataPage?assetViewId=syn1" ) @@ -93,7 +113,7 @@ def test_500(self) -> None: ) -class TestGetDatasetFiles(BaseTestCase): +class TestGetDatasetFileMetadataArray(BaseTestCase): """Test case for files endpoint""" def test_success(self) -> None: @@ -101,53 +121,176 @@ def test_success(self) -> None: with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], ): response = self.client.open( - DATASET_FILES_URL, method="GET", headers=HEADERS + DATASET_FILE_METADATA_ARRAY_URL, method="GET", headers=HEADERS ) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) + result = response.json + assert isinstance(result, dict) + assert isinstance(result["files"], list) + for item in result["files"]: + assert isinstance(item, dict) + assert isinstance(item["id"], str) + assert isinstance(item["name"], str) + + def test_file_names(self) -> None: + """Test with file_names parameter""" + + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], + ) as mock_function: + response = self.client.open( + DATASET_FILE_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + mock_function.assert_called_with("syn2", "synapse", None, False) + + url = f"{DATASET_FILE_METADATA_ARRAY_URL}&fileNames=file.text" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + mock_function.assert_called_with("syn2", "synapse", ["file.text"], False) + + url = f"{DATASET_FILE_METADATA_ARRAY_URL}&fileNames=file.text&fileNames=file2.text" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + mock_function.assert_called_with( + "syn2", "synapse", ["file.text", "file2.text"], False + ) + + def test_use_full_file_path(self) -> None: + """Test with use_full_file_path parameter""" + + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], + ) as mock_function: + url = f"{DATASET_FILE_METADATA_ARRAY_URL}&useFullFilePath=true" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + mock_function.assert_called_with("syn2", "synapse", None, True) + + url = f"{DATASET_FILE_METADATA_ARRAY_URL}&useFullFilePath=false" + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + mock_function.assert_called_with("syn2", "synapse", None, False) + + def test_401(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + response = self.client.open( + DATASET_FILE_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert401( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_403(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + response = self.client.open( + DATASET_FILE_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert403( + response, f"Response body is : {response.data.decode('utf-8')}" + ) - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalElements"] == 2 - assert response.json["totalPages"] == 1 - files = response.json["files"] - assert len(files) == 2 - file1 = files[0] - assert list(file1.keys()) == ["id", "name"] - assert file1["name"] == "name1" - assert file1["id"] == "syn1" + def test_500(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=TypeError, + ): + response = self.client.open( + DATASET_FILE_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert500( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + +class TestGetDatasetFileMetadataPage(BaseTestCase): + """Test case for files endpoint""" + + def test_success(self) -> None: + """Test for successful result""" + + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], + ): + response = self.client.open( + DATASET_FILE_METADATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + result = response.json + assert isinstance(result, dict) + assert result["number"] == 1 + assert result["size"] == 100000 + assert not result["hasNext"] + assert not result["hasPrevious"] + assert result["totalPages"] == 1 + assert isinstance(result["totalElements"], int) + assert isinstance(result["files"], list) + for item in result["files"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["id", "name"] + assert isinstance(item["id"], str) + assert isinstance(item["name"], str) def test_file_names(self) -> None: """Test with file_names parameter""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], ) as mock_function: response = self.client.open( - DATASET_FILES_URL, method="GET", headers=HEADERS + DATASET_FILE_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) mock_function.assert_called_with("syn2", "synapse", None, False) - url = f"{DATASET_FILES_URL}&fileNames=file.text" + url = f"{DATASET_FILE_METADATA_PAGE_URL}&fileNames=file.text" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) mock_function.assert_called_with("syn2", "synapse", ["file.text"], False) - url = f"{DATASET_FILES_URL}&fileNames=file.text&fileNames=file2.text" + url = f"{DATASET_FILE_METADATA_PAGE_URL}&fileNames=file.text&fileNames=file2.text" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" @@ -161,17 +304,17 @@ def test_use_full_file_path(self) -> None: with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], ) as mock_function: - url = f"{DATASET_FILES_URL}&useFullFilePath=true" + url = f"{DATASET_FILE_METADATA_PAGE_URL}&useFullFilePath=true" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) mock_function.assert_called_with("syn2", "synapse", None, True) - url = f"{DATASET_FILES_URL}&useFullFilePath=false" + url = f"{DATASET_FILE_METADATA_PAGE_URL}&useFullFilePath=false" response = self.client.open(url, method="GET", headers=HEADERS) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" @@ -182,11 +325,11 @@ def test_401(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): response = self.client.open( - DATASET_FILES_URL, method="GET", headers=HEADERS + DATASET_FILE_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert401( response, f"Response body is : {response.data.decode('utf-8')}" @@ -196,11 +339,11 @@ def test_403(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): response = self.client.open( - DATASET_FILES_URL, method="GET", headers=HEADERS + DATASET_FILE_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert403( response, f"Response body is : {response.data.decode('utf-8')}" @@ -210,11 +353,11 @@ def test_500(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=TypeError, ): response = self.client.open( - DATASET_FILES_URL, method="GET", headers=HEADERS + DATASET_FILE_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert500( response, f"Response body is : {response.data.decode('utf-8')}" @@ -345,7 +488,7 @@ def test_500(self) -> None: ) -class TestGetProjects(BaseTestCase): +class TestGetProjectMetadataArray(BaseTestCase): """Test case for projects endpoint""" def test_success(self) -> None: @@ -353,35 +496,38 @@ def test_success(self) -> None: with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_project_metadata_from_schematic", + return_value=[ + ProjectMetadata("syn1", "name1"), + ProjectMetadata("syn2", "name2"), + ], ): - response = self.client.open(PROJECTS_URL, method="GET", headers=HEADERS) + response = self.client.open( + PROJECT_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) - - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalElements"] == 2 - assert response.json["totalPages"] == 1 - projects = response.json["projects"] - assert len(projects) == 2 - project = projects[0] - assert list(project.keys()) == ["id", "name"] - assert project["name"] == "name1" - assert project["id"] == "syn1" + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == ["projects"] + assert isinstance(result["projects"], list) + for item in result["projects"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["id", "name"] + assert isinstance(item["name"], str) + assert isinstance(item["id"], str) def test_401(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): - response = self.client.open(PROJECTS_URL, method="GET", headers=HEADERS) + response = self.client.open( + PROJECT_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) self.assert401( response, f"Response body is : {response.data.decode('utf-8')}" ) @@ -390,10 +536,12 @@ def test_403(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): - response = self.client.open(PROJECTS_URL, method="GET", headers=HEADERS) + response = self.client.open( + PROJECT_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) self.assert403( response, f"Response body is : {response.data.decode('utf-8')}" ) @@ -402,55 +550,133 @@ def test_500(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_metadata_from_schematic", side_effect=TypeError, ): - response = self.client.open(PROJECTS_URL, method="GET", headers=HEADERS) + response = self.client.open( + PROJECT_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) self.assert500( response, f"Response body is : {response.data.decode('utf-8')}" ) -class TestGetProjectDatasets(BaseTestCase): - """Test case for datasets endpoint""" +class TestGetProjectMetadataPage(BaseTestCase): + """Test case for projects endpoint""" def test_success(self) -> None: """Test for successful result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_project_metadata_from_schematic", + return_value=[ + ProjectMetadata("syn1", "name1"), + ProjectMetadata("syn2", "name2"), + ], ): response = self.client.open( - PROJECT_DATASETS_URL, method="GET", headers=HEADERS + PROJECT_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) + result = response.json + assert isinstance(result, dict) + assert list(result.keys()) == sorted(PAGING_KEYS + ["projects"]) + assert result["number"] == 1 + assert result["size"] == 100000 + assert not result["hasNext"] + assert not result["hasPrevious"] + assert result["totalPages"] == 1 + assert isinstance(result["totalElements"], int) + assert isinstance(result["projects"], list) + for item in result["projects"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["id", "name"] + assert isinstance(item["name"], str) + assert isinstance(item["id"], str) - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalElements"] == 2 - assert response.json["totalPages"] == 1 - datasets = response.json["datasets"] - assert len(datasets) == 2 - dataset = datasets[0] - assert list(dataset.keys()) == ["id", "name"] - assert dataset["name"] == "name1" - assert dataset["id"] == "syn1" + def test_401(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + response = self.client.open( + PROJECT_METADATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert401( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_403(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + response = self.client.open( + PROJECT_METADATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert403( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_500(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=TypeError, + ): + response = self.client.open( + PROJECT_METADATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert500( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + +class TestGetProjectDatasetMetadataArray(BaseTestCase): + """Test case for dataset metadat endpoint""" + + def test_success(self) -> None: + """Test for successful result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + return_value=[ + DatasetMetadata("syn1", "name1"), + DatasetMetadata("syn2", "name2"), + ], + ): + response = self.client.open( + PROJECT_DATASET_METATDATA_ARRRAY_URL, method="GET", headers=HEADERS + ) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + result = response.json + assert isinstance(result, dict) + assert isinstance(result["datasets"], list) + for item in result["datasets"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["id", "name"] + assert isinstance(item["id"], str) + assert isinstance(item["name"], str) def test_401(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): response = self.client.open( - PROJECT_DATASETS_URL, method="GET", headers=HEADERS + PROJECT_DATASET_METATDATA_ARRRAY_URL, method="GET", headers=HEADERS ) self.assert401( response, f"Response body is : {response.data.decode('utf-8')}" @@ -460,11 +686,11 @@ def test_403(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): response = self.client.open( - PROJECT_DATASETS_URL, method="GET", headers=HEADERS + PROJECT_DATASET_METATDATA_ARRRAY_URL, method="GET", headers=HEADERS ) self.assert403( response, f"Response body is : {response.data.decode('utf-8')}" @@ -474,18 +700,95 @@ def test_500(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=TypeError, ): response = self.client.open( - PROJECT_DATASETS_URL, method="GET", headers=HEADERS + PROJECT_DATASET_METATDATA_ARRRAY_URL, method="GET", headers=HEADERS ) self.assert500( response, f"Response body is : {response.data.decode('utf-8')}" ) -class TestGetProjectManifests(BaseTestCase): +class TestGetProjectDatasetMetadataPage(BaseTestCase): + """Test case for dataset metadat endpoint""" + + def test_success(self) -> None: + """Test for successful result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + return_value=[ + DatasetMetadata("syn1", "name1"), + DatasetMetadata("syn2", "name2"), + ], + ): + response = self.client.open( + PROJECT_DATASET_METATDATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + result = response.json + assert isinstance(result, dict) + assert result["number"] == 1 + assert result["size"] == 100000 + assert not result["hasNext"] + assert not result["hasPrevious"] + assert result["totalPages"] == 1 + assert isinstance(result["totalElements"], int) + assert isinstance(result["datasets"], list) + for item in result["datasets"]: + assert isinstance(item, dict) + assert list(item.keys()) == ["id", "name"] + assert isinstance(item["id"], str) + assert isinstance(item["name"], str) + + def test_401(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + response = self.client.open( + PROJECT_DATASET_METATDATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert401( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_403(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + response = self.client.open( + PROJECT_DATASET_METATDATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert403( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_500(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=TypeError, + ): + response = self.client.open( + PROJECT_DATASET_METATDATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert500( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + +class TestGetProjectManifestMetadataArray(BaseTestCase): """Test case for manifests endpoint""" def test_success(self) -> None: @@ -493,47 +796,114 @@ def test_success(self) -> None: with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", return_value=EXAMPLE_MANIFEST_METADATA, ): response = self.client.open( - PROJECT_MANIFESTS_URL, method="GET", headers=HEADERS + PROJECT_MANIFEST_METADATA_ARRAY_URL, method="GET", headers=HEADERS ) self.assert200( response, f"Response body is : {response.data.decode('utf-8')}" ) + result = response.json + assert isinstance(result, dict) + assert isinstance(result["manifests"], list) + for item in result["manifests"]: + assert isinstance(item, dict) + assert list(item.keys()) == MANIFEST_METADATA_KEYS + assert isinstance(item["id"], str) + assert isinstance(item["name"], str) + assert isinstance(item["datasetName"], str) + assert isinstance(item["datasetId"], str) + assert isinstance(item["componentName"], str) + + def test_401(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_manifest_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + response = self.client.open( + PROJECT_MANIFEST_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert401( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_403(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_manifest_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + response = self.client.open( + PROJECT_MANIFEST_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert403( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + def test_500(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_manifest_metadata_from_schematic", + side_effect=TypeError, + ): + response = self.client.open( + PROJECT_MANIFEST_METADATA_ARRAY_URL, method="GET", headers=HEADERS + ) + self.assert500( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + + +class TestGetProjectManifestMetadataPage(BaseTestCase): + """Test case for manifests endpoint""" - assert not response.json["hasNext"] - assert not response.json["hasPrevious"] - assert response.json["number"] == 0 - assert response.json["size"] == 100 - assert response.json["totalElements"] == 2 - assert response.json["totalPages"] == 1 - manifests = response.json["manifests"] - assert len(manifests) == 2 - manifest = manifests[0] - assert list(manifest.keys()) == [ - "componentName", - "datasetId", - "datasetName", - "id", - "name", - ] - assert manifest["name"] == "name1" - assert manifest["id"] == "syn1" - assert manifest["componentName"] == "component1" - assert manifest["datasetId"] == "dataset_id1" - assert manifest["datasetName"] == "dataset_name1" + def test_success(self) -> None: + """Test for successful result""" + + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_manifest_metadata_from_schematic", + return_value=EXAMPLE_MANIFEST_METADATA, + ): + response = self.client.open( + PROJECT_MANIFEST_METADATA_PAGE_URL, method="GET", headers=HEADERS + ) + self.assert200( + response, f"Response body is : {response.data.decode('utf-8')}" + ) + result = response.json + assert isinstance(result, dict) + assert result["number"] == 1 + assert result["size"] == 100000 + assert not result["hasNext"] + assert not result["hasPrevious"] + assert result["totalPages"] == 1 + assert isinstance(result["totalElements"], int) + assert isinstance(result["manifests"], list) + for item in result["manifests"]: + assert isinstance(item, dict) + assert list(item.keys()) == MANIFEST_METADATA_KEYS + assert isinstance(item["id"], str) + assert isinstance(item["name"], str) + assert isinstance(item["datasetName"], str) + assert isinstance(item["datasetId"], str) + assert isinstance(item["componentName"], str) def test_401(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): response = self.client.open( - PROJECT_MANIFESTS_URL, method="GET", headers=HEADERS + PROJECT_MANIFEST_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert401( response, f"Response body is : {response.data.decode('utf-8')}" @@ -543,11 +913,11 @@ def test_403(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): response = self.client.open( - PROJECT_MANIFESTS_URL, method="GET", headers=HEADERS + PROJECT_MANIFEST_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert403( response, f"Response body is : {response.data.decode('utf-8')}" @@ -557,11 +927,11 @@ def test_500(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=TypeError, ): response = self.client.open( - PROJECT_MANIFESTS_URL, method="GET", headers=HEADERS + PROJECT_MANIFEST_METADATA_PAGE_URL, method="GET", headers=HEADERS ) self.assert500( response, f"Response body is : {response.data.decode('utf-8')}" diff --git a/apps/schematic/api/schematic_api/test/test_storage_controller_impl.py b/apps/schematic/api/schematic_api/test/test_storage_controller_impl.py index de8d5bf78e..d6480541cc 100644 --- a/apps/schematic/api/schematic_api/test/test_storage_controller_impl.py +++ b/apps/schematic/api/schematic_api/test/test_storage_controller_impl.py @@ -1,4 +1,5 @@ -"""Tests for endpoint functions""" +"""Tests for storage endpoint functions""" +# pylint: disable=duplicate-code from unittest.mock import patch @@ -10,19 +11,31 @@ from schematic.exceptions import AccessCredentialsError # type: ignore from schematic_api.models.basic_error import BasicError -from schematic_api.models.manifests_page import ManifestsPage -from schematic_api.models.datasets_page import DatasetsPage -from schematic_api.models.projects_page import ProjectsPage -from schematic_api.models.files_page import FilesPage +from schematic_api.models.manifest_metadata import ManifestMetadata +from schematic_api.models.manifest_metadata_array import ManifestMetadataArray +from schematic_api.models.manifest_metadata_page import ManifestMetadataPage +from schematic_api.models.dataset_metadata import DatasetMetadata +from schematic_api.models.dataset_metadata_array import DatasetMetadataArray +from schematic_api.models.dataset_metadata_page import DatasetMetadataPage +from schematic_api.models.project_metadata import ProjectMetadata +from schematic_api.models.project_metadata_array import ProjectMetadataArray +from schematic_api.models.project_metadata_page import ProjectMetadataPage +from schematic_api.models.file_metadata import FileMetadata +from schematic_api.models.file_metadata_page import FileMetadataPage +from schematic_api.models.file_metadata_array import FileMetadataArray import schematic_api.controllers.storage_controller_impl from schematic_api.controllers.storage_controller_impl import ( get_dataset_manifest_json, get_manifest_json, get_asset_view_json, - get_dataset_files, - get_projects, - get_project_datasets, - get_project_manifests, + get_dataset_file_metadata_array, + get_dataset_file_metadata_page, + get_project_metadata_array, + get_project_metadata_page, + get_project_dataset_metadata_array, + get_project_dataset_metadata_page, + get_project_manifest_metadata_array, + get_project_manifest_metadata_page, ) @@ -95,30 +108,35 @@ def test_internal_error(self) -> None: assert isinstance(result, BasicError) -class TestGetDatasetFiles: - """Test case for get_dataset_files""" +class TestGetDatasetFileMetadataArray: + """Test case for get_dataset_file_metadata_array""" def test_success(self) -> None: """Test for successful result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], ): - result, status = get_dataset_files( + result, status = get_dataset_file_metadata_array( dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 200 - assert isinstance(result, FilesPage) + assert isinstance(result, FileMetadataArray) + assert isinstance(result.files, list) + for item in result.files: + assert isinstance(item, FileMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) def test_no_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): - result, status = get_dataset_files( + result, status = get_dataset_file_metadata_array( dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 401 @@ -128,10 +146,10 @@ def test_bad_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=SynapseAuthenticationError, ): - result, status = get_dataset_files( + result, status = get_dataset_file_metadata_array( dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 401 @@ -141,10 +159,10 @@ def test_no_access_error(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): - result, status = get_dataset_files( + result, status = get_dataset_file_metadata_array( dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 403 @@ -154,10 +172,90 @@ def test_internal_error(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_dataset_files_from_schematic", + "get_dataset_file_metadata_from_schematic", side_effect=TypeError, ): - result, status = get_dataset_files( + result, status = get_dataset_file_metadata_array( + dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 500 + assert isinstance(result, BasicError) + + +class TestGetDatasetFileMetadataPage: + """Test case for get_dataset_file_metadata_page""" + + def test_success(self) -> None: + """Test for successful result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + return_value=[FileMetadata("syn1", "name1"), FileMetadata("syn2", "name2")], + ): + result, status = get_dataset_file_metadata_page( + dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 200 + assert isinstance(result, FileMetadataPage) + assert result.number == 1 + assert result.size == 100000 + assert isinstance(result.total_elements, int) + assert isinstance(result.total_pages, int) + assert isinstance(result.has_next, bool) + assert isinstance(result.has_previous, bool) + assert isinstance(result.files, list) + for item in result.files: + assert isinstance(item, FileMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) + + def test_no_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + result, status = get_dataset_file_metadata_page( + dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_bad_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=SynapseAuthenticationError, + ): + result, status = get_dataset_file_metadata_page( + dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_no_access_error(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + result, status = get_dataset_file_metadata_page( + dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 403 + assert isinstance(result, BasicError) + + def test_internal_error(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_dataset_file_metadata_from_schematic", + side_effect=TypeError, + ): + result, status = get_dataset_file_metadata_page( dataset_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 500 @@ -292,28 +390,200 @@ def test_internal_error(self) -> None: assert isinstance(result, BasicError) -class TestGetProjects: - """Test case for list_projects""" +class TestGetProjectMetadataArray: + """Test case for get_project_metadata_array""" + + def test_success(self) -> None: + """Test for successful result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + return_value=[ + ProjectMetadata("syn1", "name1"), + ProjectMetadata("syn2", "name2"), + ], + ): + result, status = get_project_metadata_array( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 200 + assert isinstance(result, ProjectMetadataArray) + assert isinstance(result.projects, list) + for item in result.projects: + assert isinstance(item, ProjectMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) + + def test_no_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + result, status = get_project_metadata_array( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_bad_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=SynapseAuthenticationError, + ): + result, status = get_project_metadata_array( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_no_access_error(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + result, status = get_project_metadata_array( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 403 + assert isinstance(result, BasicError) + + def test_internal_error(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=TypeError, + ): + result, status = get_project_metadata_array( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 500 + assert isinstance(result, BasicError) + + +class TestGetProjectMetadataPage: + """Test case for get_project_metadata_page""" + + def test_success(self) -> None: + """Test for successful result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + return_value=[ + ProjectMetadata("syn1", "name1"), + ProjectMetadata("syn2", "name2"), + ], + ): + result, status = get_project_metadata_page( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 200 + assert isinstance(result, ProjectMetadataPage) + assert result.number == 1 + assert result.size == 100000 + assert isinstance(result.total_elements, int) + assert isinstance(result.total_pages, int) + assert isinstance(result.has_next, bool) + assert isinstance(result.has_previous, bool) + assert isinstance(result.projects, list) + for item in result.projects: + assert isinstance(item, ProjectMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) + + def test_no_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + result, status = get_project_metadata_page( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_bad_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=SynapseAuthenticationError, + ): + result, status = get_project_metadata_page( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_no_access_error(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + result, status = get_project_metadata_page( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 403 + assert isinstance(result, BasicError) + + def test_internal_error(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_metadata_from_schematic", + side_effect=TypeError, + ): + result, status = get_project_metadata_page( + asset_view_id="syn1", asset_type="synapse" + ) + assert status == 500 + assert isinstance(result, BasicError) + + +class TestGetProjectDatasetMetadataArray: + """Test case for get_project_dataset_metadata_array""" def test_success(self) -> None: """Test for successful result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_project_dataset_metadata_from_schematic", + return_value=[ + DatasetMetadata("syn1", "name1"), + DatasetMetadata("syn2", "name2"), + ], ): - result, status = get_projects(asset_view_id="syn1", asset_type="synapse") + result, status = get_project_dataset_metadata_array( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) assert status == 200 - assert isinstance(result, ProjectsPage) + assert isinstance(result, DatasetMetadataArray) + assert isinstance(result.datasets, list) + for item in result.datasets: + assert isinstance(item, DatasetMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) def test_no_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): - result, status = get_projects(asset_view_id="syn1", asset_type="synapse") + result, status = get_project_dataset_metadata_array( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) assert status == 401 assert isinstance(result, BasicError) @@ -321,10 +591,12 @@ def test_bad_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=SynapseAuthenticationError, ): - result, status = get_projects(asset_view_id="syn1", asset_type="synapse") + result, status = get_project_dataset_metadata_array( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) assert status == 401 assert isinstance(result, BasicError) @@ -332,10 +604,12 @@ def test_no_access_error(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): - result, status = get_projects(asset_view_id="syn1", asset_type="synapse") + result, status = get_project_dataset_metadata_array( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) assert status == 403 assert isinstance(result, BasicError) @@ -343,38 +617,131 @@ def test_internal_error(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_projects_from_schematic", + "get_project_dataset_metadata_from_schematic", side_effect=TypeError, ): - result, status = get_projects(asset_view_id="syn1", asset_type="synapse") + result, status = get_project_dataset_metadata_array( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) assert status == 500 assert isinstance(result, BasicError) -class TestGetProjectDatasets: - """Test case for list_storage_project_datasets""" +class TestGetProjectDatasetMetadataPage: + """Test case for get_project_dataset_metadata_page""" def test_success(self) -> None: """Test for successful result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", - return_value=[("syn1", "name1"), ("syn2", "name2")], + "get_project_dataset_metadata_from_schematic", + return_value=[ + DatasetMetadata("syn1", "name1"), + DatasetMetadata("syn2", "name2"), + ], + ): + result, status = get_project_dataset_metadata_page( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 200 + assert isinstance(result, DatasetMetadataPage) + assert result.number == 1 + assert result.size == 100000 + assert isinstance(result.total_elements, int) + assert isinstance(result.total_pages, int) + assert isinstance(result.has_next, bool) + assert isinstance(result.has_previous, bool) + assert isinstance(result.datasets, list) + for item in result.datasets: + assert isinstance(item, DatasetMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) + + def test_no_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=SynapseNoCredentialsError, + ): + result, status = get_project_dataset_metadata_page( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_bad_credentials_error(self) -> None: + """Test for 401 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=SynapseAuthenticationError, + ): + result, status = get_project_dataset_metadata_page( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 401 + assert isinstance(result, BasicError) + + def test_no_access_error(self) -> None: + """Test for 403 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=AccessCredentialsError("project"), + ): + result, status = get_project_dataset_metadata_page( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 403 + assert isinstance(result, BasicError) + + def test_internal_error(self) -> None: + """Test for 500 result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_dataset_metadata_from_schematic", + side_effect=TypeError, + ): + result, status = get_project_dataset_metadata_page( + project_id="syn1", asset_view_id="syn2", asset_type="synapse" + ) + assert status == 500 + assert isinstance(result, BasicError) + + +class TestGetProjectManifestMetadataArray: + """Test case for get_project_manifest_metadata_array""" + + def test_success(self, example_manifest_metadata: list[ManifestMetadata]) -> None: + """Test for successful result""" + with patch.object( + schematic_api.controllers.storage_controller_impl, + "get_project_manifest_metadata_from_schematic", + return_value=example_manifest_metadata, ): - result, status = get_project_datasets( + result, status = get_project_manifest_metadata_array( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 200 - assert isinstance(result, DatasetsPage) + assert isinstance(result, ManifestMetadataArray) + assert isinstance(result.manifests, list) + for item in result.manifests: + assert isinstance(item, ManifestMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) + assert isinstance(item.dataset_name, str) + assert isinstance(item.dataset_id, str) + assert isinstance(item.component_name, str) def test_no_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): - result, status = get_project_datasets( + result, status = get_project_manifest_metadata_array( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 401 @@ -384,10 +751,10 @@ def test_bad_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=SynapseAuthenticationError, ): - result, status = get_project_datasets( + result, status = get_project_manifest_metadata_array( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 401 @@ -397,10 +764,10 @@ def test_no_access_error(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): - result, status = get_project_datasets( + result, status = get_project_manifest_metadata_array( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 403 @@ -410,40 +777,54 @@ def test_internal_error(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_datasets_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=TypeError, ): - result, status = get_project_datasets( + result, status = get_project_manifest_metadata_array( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 500 assert isinstance(result, BasicError) -class TestGetProjectManifests: - """Test case for list_storage_project_manifests""" +class TestGetProjectManifestMetadataPage: + """Test case for get_project_manifest_metadata_page""" - def test_success(self, example_manifest_metadata: list) -> None: + def test_success(self, example_manifest_metadata: list[ManifestMetadata]) -> None: """Test for successful result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", return_value=example_manifest_metadata, ): - result, status = get_project_manifests( + result, status = get_project_manifest_metadata_page( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 200 - assert isinstance(result, ManifestsPage) + assert isinstance(result, ManifestMetadataPage) + assert result.number == 1 + assert result.size == 100000 + assert isinstance(result.total_elements, int) + assert isinstance(result.total_pages, int) + assert isinstance(result.has_next, bool) + assert isinstance(result.has_previous, bool) + assert isinstance(result.manifests, list) + for item in result.manifests: + assert isinstance(item, ManifestMetadata) + assert isinstance(item.id, str) + assert isinstance(item.name, str) + assert isinstance(item.dataset_name, str) + assert isinstance(item.dataset_id, str) + assert isinstance(item.component_name, str) def test_no_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=SynapseNoCredentialsError, ): - result, status = get_project_manifests( + result, status = get_project_manifest_metadata_page( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 401 @@ -453,10 +834,10 @@ def test_bad_credentials_error(self) -> None: """Test for 401 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=SynapseAuthenticationError, ): - result, status = get_project_manifests( + result, status = get_project_manifest_metadata_page( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 401 @@ -466,10 +847,10 @@ def test_no_access_error(self) -> None: """Test for 403 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=AccessCredentialsError("project"), ): - result, status = get_project_manifests( + result, status = get_project_manifest_metadata_page( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 403 @@ -479,10 +860,10 @@ def test_internal_error(self) -> None: """Test for 500 result""" with patch.object( schematic_api.controllers.storage_controller_impl, - "get_project_manifests_from_schematic", + "get_project_manifest_metadata_from_schematic", side_effect=TypeError, ): - result, status = get_project_manifests( + result, status = get_project_manifest_metadata_page( project_id="syn1", asset_view_id="syn2", asset_type="synapse" ) assert status == 500 diff --git a/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py b/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py index 514278b6eb..e3ab1806e5 100644 --- a/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py +++ b/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py @@ -9,6 +9,7 @@ from schematic_api.test import BaseTestCase from .conftest import ( + MANIFEST_METADATA_KEYS, TEST_SCHEMA_URL, CORRECT_MANIFEST_PATH, csv_to_bytes, @@ -87,11 +88,11 @@ def test_get_asset_view_json(self) -> None: dataframe = pd.DataFrame.from_dict(response_dict) assert isinstance(dataframe, pd.DataFrame) - def test_get_dataset_files(self) -> None: + def test_get_dataset_file_metadata_array(self) -> None: """Test for successful result""" url = ( "/api/v1/assetTypes/synapse/" - f"datasets/{TEST_DATASET}/files" + f"datasets/{TEST_DATASET}/fileMetadataArray" f"?assetViewId={TEST_ASSET_VIEW}" ) response = self.client.open(url, method="GET", headers=HEADERS) @@ -99,10 +100,27 @@ def test_get_dataset_files(self) -> None: assert isinstance(response.json, dict) assert "files" in response.json assert isinstance(response.json["files"], list) - for fle in response.json["files"]: - assert isinstance(fle, dict) + for item in response.json["files"]: + assert isinstance(item, dict) for key in ["id", "name"]: - assert key in fle + assert key in item + + def test_get_dataset_file_metadata_page(self) -> None: + """Test for successful result""" + url = ( + "/api/v1/assetTypes/synapse/" + f"datasets/{TEST_DATASET}/fileMetadataPage" + f"?assetViewId={TEST_ASSET_VIEW}" + ) + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + assert isinstance(response.json, dict) + assert "files" in response.json + assert isinstance(response.json["files"], list) + for item in response.json["files"]: + assert isinstance(item, dict) + for key in ["id", "name"]: + assert key in item def test_get_dataset_manifest_json(self) -> None: """Test for successful result""" @@ -130,9 +148,28 @@ def test_get_manifest_json(self) -> None: dataframe = pd.DataFrame.from_dict(response_dict) assert isinstance(dataframe, pd.DataFrame) - def test_get_projects(self) -> None: + def test_get_project_metadata_array(self) -> None: """Test for successful result""" - url = "/api/v1/assetTypes/synapse/" f"assetViews/{TEST_ASSET_VIEW}/projects" + url = ( + "/api/v1/assetTypes/synapse/" + f"assetViews/{TEST_ASSET_VIEW}/projectMetadataArray" + ) + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + assert isinstance(response.json, dict) + assert "projects" in response.json + assert isinstance(response.json["projects"], list) + for project in response.json["projects"]: + assert isinstance(project, dict) + for key in ["id", "name"]: + assert key in project + + def test_get_project_metadata_page(self) -> None: + """Test for successful result""" + url = ( + "/api/v1/assetTypes/synapse/" + f"assetViews/{TEST_ASSET_VIEW}/projectMetadataPage" + ) response = self.client.open(url, method="GET", headers=HEADERS) self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") assert isinstance(response.json, dict) @@ -143,11 +180,11 @@ def test_get_projects(self) -> None: for key in ["id", "name"]: assert key in project - def test_get_project_datasets(self) -> None: + def test_get_project_dataset_metadata_array(self) -> None: """Test for successful result""" url = ( "/api/v1/assetTypes/synapse/" - f"projects/{TEST_PROJECT}/datasets" + f"projects/{TEST_PROJECT}/datasetMetadataArray" f"?assetViewId={TEST_ASSET_VIEW}" ) response = self.client.open(url, method="GET", headers=HEADERS) @@ -160,11 +197,44 @@ def test_get_project_datasets(self) -> None: for key in ["id", "name"]: assert key in dataset - def test_get_project_manifests(self) -> None: + def test_get_project_dataset_metadata_page(self) -> None: + """Test for successful result""" + url = ( + "/api/v1/assetTypes/synapse/" + f"projects/{TEST_PROJECT}/datasetMetadataPage" + f"?assetViewId={TEST_ASSET_VIEW}" + ) + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + assert isinstance(response.json, dict) + assert "datasets" in response.json + assert isinstance(response.json["datasets"], list) + for dataset in response.json["datasets"]: + assert isinstance(dataset, dict) + for key in ["id", "name"]: + assert key in dataset + + def test_get_project_manifest_metadata_array(self) -> None: + """Test for successful result""" + url = ( + "/api/v1/assetTypes/synapse/" + f"projects/{TEST_PROJECT}/manifestMetadataArray" + f"?assetViewId={TEST_ASSET_VIEW}" + ) + response = self.client.open(url, method="GET", headers=HEADERS) + self.assert200(response, f"Response body is : {response.data.decode('utf-8')}") + assert isinstance(response.json, dict) + assert "manifests" in response.json + assert isinstance(response.json["manifests"], list) + for manifest in response.json["manifests"]: + assert isinstance(manifest, dict) + assert list(manifest.keys()) == MANIFEST_METADATA_KEYS + + def test_get_project_manifest_metadata_page(self) -> None: """Test for successful result""" url = ( "/api/v1/assetTypes/synapse/" - f"projects/{TEST_PROJECT}/manifests" + f"projects/{TEST_PROJECT}/manifestMetadataPage" f"?assetViewId={TEST_ASSET_VIEW}" ) response = self.client.open(url, method="GET", headers=HEADERS) @@ -174,5 +244,4 @@ def test_get_project_manifests(self) -> None: assert isinstance(response.json["manifests"], list) for manifest in response.json["manifests"]: assert isinstance(manifest, dict) - for key in ["componentName", "datasetId", "datasetName", "id", "name"]: - assert key in manifest + assert list(manifest.keys()) == MANIFEST_METADATA_KEYS diff --git a/apps/schematic/api/schematic_api/test/test_version_endpoints.py b/apps/schematic/api/schematic_api/test/test_version_endpoints.py index 376046e3ce..df4d2fb37b 100644 --- a/apps/schematic/api/schematic_api/test/test_version_endpoints.py +++ b/apps/schematic/api/schematic_api/test/test_version_endpoints.py @@ -1,4 +1,5 @@ -"""Tests for endpoints""" +"""Tests for version endpoints""" +# pylint: disable=duplicate-code import importlib.metadata from unittest.mock import patch diff --git a/libs/schematic/api-description/build/openapi.yaml b/libs/schematic/api-description/build/openapi.yaml index 07b078f4fc..69a5f35b5e 100644 --- a/libs/schematic/api-description/build/openapi.yaml +++ b/libs/schematic/api-description/build/openapi.yaml @@ -33,16 +33,16 @@ paths: example: v21.1.1 '500': $ref: '#/components/responses/InternalServerError' - /assetTypes/{assetType}/projects/{projectId}/datasets: + /assetTypes/{assetType}/projects/{projectId}/datasetMetadataArray: parameters: - $ref: '#/components/parameters/projectId' - $ref: '#/components/parameters/assetType' get: tags: - Storage - summary: Gets all datasets in folder under a given storage project that the current user has access to. - description: Gets all datasets in folder under a given storage project that the current user has access to. - operationId: getProjectDatasets + summary: Gets all dataset metadata in folder under a given storage project that the current user has access to. + description: Gets all dataset meatdata in folder under a given storage project that the current user has access to. + operationId: getProjectDatasetMetadataArray parameters: - $ref: '#/components/parameters/assetViewIdQuery' security: @@ -53,7 +53,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DatasetsPage' + $ref: '#/components/schemas/DatasetMetadataArray' '400': $ref: '#/components/responses/BadRequest' '401': @@ -64,7 +64,40 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' - /assetTypes/{assetType}/projects/{projectId}/manifests: + /assetTypes/{assetType}/projects/{projectId}/datasetMetadataPage: + parameters: + - $ref: '#/components/parameters/projectId' + - $ref: '#/components/parameters/assetType' + get: + tags: + - Storage + summary: Gets a page of dataset metadata in folder under a given storage project that the current user has access to. + description: Gets a page of dataset meatdata in folder under a given storage project that the current user has access to. + operationId: getProjectDatasetMetadataPage + parameters: + - $ref: '#/components/parameters/assetViewIdQuery' + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageMaxItems' + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetMetadataPage' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + /assetTypes/{assetType}/projects/{projectId}/manifestMetadataArray: parameters: - $ref: '#/components/parameters/projectId' - $ref: '#/components/parameters/assetType' @@ -73,7 +106,7 @@ paths: - Storage summary: Gets all manifests in a project folder that users have access to description: Gets all manifests in a project folder that the current user has access to. - operationId: getProjectManifests + operationId: getProjectManifestMetadataArray parameters: - $ref: '#/components/parameters/assetViewIdQuery' security: @@ -84,7 +117,40 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ManifestsPage' + $ref: '#/components/schemas/ManifestMetadataArray' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + /assetTypes/{assetType}/projects/{projectId}/manifestMetadataPage: + parameters: + - $ref: '#/components/parameters/projectId' + - $ref: '#/components/parameters/assetType' + get: + tags: + - Storage + summary: Gets all manifests in a project folder that users have access to + description: Gets all manifests in a project folder that the current user has access to. + operationId: getProjectManifestMetadataPage + parameters: + - $ref: '#/components/parameters/assetViewIdQuery' + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageMaxItems' + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ManifestMetadataPage' '400': $ref: '#/components/responses/BadRequest' '401': @@ -155,7 +221,7 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' - /assetTypes/{assetType}/assetViews/{assetViewId}/projects: + /assetTypes/{assetType}/assetViews/{assetViewId}/projectMetadataArray: parameters: - $ref: '#/components/parameters/assetViewId' - $ref: '#/components/parameters/assetType' @@ -164,7 +230,7 @@ paths: - Storage summary: Gets all storage projects the current user has access to. description: Gets all storage projects the current user has access to. - operationId: getProjects + operationId: getProjectMetadataArray security: - bearerAuth: [] responses: @@ -173,7 +239,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ProjectsPage' + $ref: '#/components/schemas/ProjectMetadataArray' '400': $ref: '#/components/responses/BadRequest' '401': @@ -184,7 +250,72 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' - /assetTypes/{assetType}/datasets/{datasetId}/files: + /assetTypes/{assetType}/assetViews/{assetViewId}/projectMetadataPage: + parameters: + - $ref: '#/components/parameters/assetViewId' + - $ref: '#/components/parameters/assetType' + get: + tags: + - Storage + summary: Gets all storage projects the current user has access to. + description: Gets all storage projects the current user has access to. + operationId: getProjectMetadataPage + parameters: + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageMaxItems' + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectMetadataPage' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + /assetTypes/{assetType}/datasets/{datasetId}/fileMetadataArray: + parameters: + - $ref: '#/components/parameters/datasetId' + - $ref: '#/components/parameters/assetType' + get: + tags: + - Storage + summary: Gets all files associated with a dataset. + description: Gets all files associated with a dataset. + operationId: getDatasetFileMetadataArray + parameters: + - $ref: '#/components/parameters/fileNames' + - $ref: '#/components/parameters/useFullFilePath' + - $ref: '#/components/parameters/assetViewIdQuery' + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/FileMetadataArray' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + /assetTypes/{assetType}/datasets/{datasetId}/fileMetadataPage: parameters: - $ref: '#/components/parameters/datasetId' - $ref: '#/components/parameters/assetType' @@ -193,11 +324,13 @@ paths: - Storage summary: Gets all files associated with a dataset. description: Gets all files associated with a dataset. - operationId: getDatasetFiles + operationId: getDatasetFileMetadataPage parameters: - $ref: '#/components/parameters/fileNames' - $ref: '#/components/parameters/useFullFilePath' - $ref: '#/components/parameters/assetViewIdQuery' + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageMaxItems' security: - bearerAuth: [] responses: @@ -206,7 +339,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/FilesPage' + $ref: '#/components/schemas/FileMetadataPage' '400': $ref: '#/components/responses/BadRequest' '401': @@ -246,7 +379,7 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' - /nodes/{nodeLabel}/dependencies: + /nodes/{nodeLabel}/dependencyArray: parameters: - $ref: '#/components/parameters/nodeLabel' get: @@ -254,7 +387,7 @@ paths: - Schema summary: Gets the immediate dependencies that are related to the given source node description: Gets the immediate dependencies that are related to the given source node - operationId: listNodeDependencies + operationId: getNodeDependencyArray parameters: - $ref: '#/components/parameters/schemaUrl' - $ref: '#/components/parameters/returnDisplayNames' @@ -265,7 +398,31 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NodesPage' + $ref: '#/components/schemas/NodeArray' + '500': + $ref: '#/components/responses/InternalServerError' + /nodes/{nodeLabel}/dependencyPage: + parameters: + - $ref: '#/components/parameters/nodeLabel' + get: + tags: + - Schema + summary: Gets the immediate dependencies that are related to the given source node + description: Gets the immediate dependencies that are related to the given source node + operationId: getNodeDependencyPage + parameters: + - $ref: '#/components/parameters/schemaUrl' + - $ref: '#/components/parameters/returnDisplayNames' + - $ref: '#/components/parameters/returnOrderedBySchema' + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageMaxItems' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/NodePage' '500': $ref: '#/components/responses/InternalServerError' /nodes/{nodeDisplay}/isRequired: @@ -306,7 +463,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NodePropertiesPage' + $ref: '#/components/schemas/NodePropertyArray' '500': $ref: '#/components/responses/InternalServerError' /nodes/{nodeDisplay}/propertyLabel: @@ -338,7 +495,7 @@ paths: - Schema summary: Gets the validation rules, along with the arguments for each given rule associated with a given node description: Gets the validation rules, along with the arguments for each given rule associated with a given node - operationId: listNodeValidationRules + operationId: getNodeValidationRules parameters: - $ref: '#/components/parameters/schemaUrl' responses: @@ -347,7 +504,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ValidationRulesPage' + $ref: '#/components/schemas/ValidationRuleArray' '500': $ref: '#/components/responses/InternalServerError' /components/{componentLabel}/: @@ -391,13 +548,13 @@ paths: type: string '500': $ref: '#/components/responses/InternalServerError' - /connectedNodes: + /connectedNodePairArray: get: tags: - Schema - summary: Gets a list of connected node pairs - description: Gets a list of connected node pairs - operationId: getConnectedNodes + summary: Gets an array of connected node pairs + description: Gets a array of connected node pairs + operationId: getConnectedNodePairArray parameters: - $ref: '#/components/parameters/schemaUrl' - $ref: '#/components/parameters/relationshipType' @@ -407,7 +564,28 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ConnectedNodesPage' + $ref: '#/components/schemas/ConnectedNodePairArray' + '500': + $ref: '#/components/responses/InternalServerError' + /connectedNodePairPage: + get: + tags: + - Schema + summary: Gets a page of connected node pairs + description: Gets a page of connected node pairs + operationId: getConnectedNodePairPage + parameters: + - $ref: '#/components/parameters/schemaUrl' + - $ref: '#/components/parameters/relationshipType' + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageMaxItems' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ConnectedNodePairPage' '500': $ref: '#/components/responses/InternalServerError' /validateManifestJson: @@ -617,6 +795,32 @@ components: description: An asset view ID. type: string example: syn23643253 + DatasetMetadata: + type: object + description: The metadata of a dataset. + properties: + name: + type: string + description: The name of the dataset. + example: Example dataset + id: + type: string + description: The ID of the dataset. + example: Syn1 + required: + - name + - id + x-java-class-annotations: + - '@lombok.Builder' + DatasetMetadataArray: + type: object + description: An array of dataset metadata. + properties: + datasets: + description: An array of dataset meatdata. + type: array + items: + $ref: '#/components/schemas/DatasetMetadata' PageMetadata: type: object description: The metadata of a page. @@ -656,42 +860,25 @@ components: - totalPages - hasNext - hasPrevious - Dataset: - type: object - description: A dataset. - properties: - name: - type: string - description: The name of the dataset. - example: Example dataset - id: - type: string - description: The ID of the dataset. - example: Syn1 - required: - - name - - id - x-java-class-annotations: - - '@lombok.Builder' - DatasetsPage: + DatasetMetadataPage: type: object - description: A page of datasets. + description: A page of dataset metadata. allOf: - $ref: '#/components/schemas/PageMetadata' - type: object properties: datasets: - description: A list of datasets. + description: An array of dataset meatdata. type: array items: - $ref: '#/components/schemas/Dataset' + $ref: '#/components/schemas/DatasetMetadata' required: - datasets x-java-class-annotations: - '@lombok.Builder' - Manifest: + ManifestMetadata: type: object - description: A manifest object + description: The metadata for a manifest file properties: name: type: string @@ -716,18 +903,27 @@ components: required: - name - id - ManifestsPage: + ManifestMetadataArray: + type: object + description: An array of manifest metadata + properties: + manifests: + description: A list of manifest metadata + type: array + items: + $ref: '#/components/schemas/ManifestMetadata' + ManifestMetadataPage: type: object - description: A page of manifests. + description: A page of manifest metadata allOf: - $ref: '#/components/schemas/PageMetadata' - type: object properties: manifests: - description: A list of manifests. + description: A list of manifest metadata type: array items: - $ref: '#/components/schemas/Manifest' + $ref: '#/components/schemas/ManifestMetadata' required: - manifests x-java-class-annotations: @@ -742,9 +938,9 @@ components: ManifestJson: description: A manifest in json format type: object - Project: + ProjectMetadata: type: object - description: A project. + description: The metadata for a project properties: name: type: string @@ -759,18 +955,27 @@ components: - id x-java-class-annotations: - '@lombok.Builder' - ProjectsPage: + ProjectMetadataArray: type: object - description: A page of projects. + description: An array of project metadata. + properties: + projects: + description: An array of project metadata. + type: array + items: + $ref: '#/components/schemas/ProjectMetadata' + ProjectMetadataPage: + type: object + description: A page of project metadata. allOf: - $ref: '#/components/schemas/PageMetadata' - type: object properties: projects: - description: A list of projects. + description: An array of project metadata. type: array items: - $ref: '#/components/schemas/Project' + $ref: '#/components/schemas/ProjectMetadata' required: - projects x-java-class-annotations: @@ -784,9 +989,9 @@ components: description: Whether or not to return the full path of output, or just the basename. type: boolean default: false - File: + FileMetadata: type: object - description: A file. + description: The metadata for a file properties: name: type: string @@ -801,18 +1006,27 @@ components: - id x-java-class-annotations: - '@lombok.Builder' - FilesPage: + FileMetadataArray: + type: object + description: A list of file metadata. + properties: + files: + description: A list of file metadata. + type: array + items: + $ref: '#/components/schemas/FileMetadata' + FileMetadataPage: type: object - description: A page of files. + description: A page of file metadata. allOf: - $ref: '#/components/schemas/PageMetadata' - type: object properties: files: - description: A list of files. + description: A list of file metadata. type: array items: - $ref: '#/components/schemas/File' + $ref: '#/components/schemas/FileMetadata' required: - files x-java-class-annotations: @@ -849,7 +1063,16 @@ components: - name x-java-class-annotations: - '@lombok.Builder' - NodesPage: + NodeArray: + type: object + description: An array of nodes. + properties: + nodes: + description: An array of nodes. + type: array + items: + $ref: '#/components/schemas/Node' + NodePage: type: object description: A page of nodes. allOf: @@ -857,7 +1080,7 @@ components: - type: object properties: nodes: - description: A list of nodes. + description: An array of nodes. type: array items: $ref: '#/components/schemas/Node' @@ -869,32 +1092,15 @@ components: description: The display name of a node in a schema type: string example: MolecularEntity - NodeProperty: + NodePropertyArray: type: object - description: A node property + description: An array of node properties. properties: - name: - type: string - description: The name of the property - example: molecularlyInteractsWith - required: - - name - NodePropertiesPage: - type: object - description: A page of node properties. - allOf: - - $ref: '#/components/schemas/PageMetadata' - - type: object - properties: - node_properties: - description: A list of node properties. - type: array - items: - $ref: '#/components/schemas/NodeProperty' - required: - - node_properties - x-java-class-annotations: - - '@lombok.Builder' + node_properties: + description: An array of node properties. + type: array + items: + type: string UseStrictCamelCase: description: Whether or not to use the more strict way of converting to camel case type: boolean @@ -915,22 +1121,15 @@ components: - name x-java-class-annotations: - '@lombok.Builder' - ValidationRulesPage: + ValidationRuleArray: type: object - description: A page of validation rules. - allOf: - - $ref: '#/components/schemas/PageMetadata' - - type: object - properties: - validation_rules: - description: A list of validation rules. - type: array - items: - $ref: '#/components/schemas/ValidationRule' - required: - - validation_rules - x-java-class-annotations: - - '@lombok.Builder' + description: An array of validation rules. + properties: + validation_rules: + description: An array of validation rules. + type: array + items: + $ref: '#/components/schemas/ValidationRule' ComponentLabel: description: The label of a component in a schema type: string @@ -939,7 +1138,7 @@ components: description: A type of schema relationship type: string example: requiresDependency - ConnectedNodes: + ConnectedNodePair: type: object description: A pair of conncted nodes properties: @@ -956,20 +1155,29 @@ components: - node2 x-java-class-annotations: - '@lombok.Builder' - ConnectedNodesPage: + ConnectedNodePairArray: + type: object + description: An array of conncted node pairs + properties: + connectedNodes: + description: An array of conncted node pairs. + type: array + items: + $ref: '#/components/schemas/ConnectedNodePair' + ConnectedNodePairPage: type: object - description: A page of conncted nodes. + description: A page of conncted node pairs allOf: - $ref: '#/components/schemas/PageMetadata' - type: object properties: - connected_nodes: - description: A list of conncted node pairs. + connectedNodes: + description: An array of conncted node pairs. type: array items: - $ref: '#/components/schemas/ConnectedNodes' + $ref: '#/components/schemas/ConnectedNodePair' required: - - connected_nodes + - connectedNodes x-java-class-annotations: - '@lombok.Builder' RestrictRules: @@ -1043,6 +1251,24 @@ components: required: true schema: $ref: '#/components/schemas/AssetViewId' + pageNumber: + name: pageNumber + in: query + description: The page number to get for a paginated query + required: false + schema: + type: integer + default: 1 + minimum: 1 + pageMaxItems: + name: pageMaxItems + in: query + description: The maximum number of items per page (up to 100,000) for paginated endpoints + required: false + schema: + type: integer + default: 100000 + minimum: 1 assetViewId: name: assetViewId in: path diff --git a/libs/schematic/api-description/src/components/parameters/query/pageMaxItems.yaml b/libs/schematic/api-description/src/components/parameters/query/pageMaxItems.yaml new file mode 100644 index 0000000000..c49d0c6b0f --- /dev/null +++ b/libs/schematic/api-description/src/components/parameters/query/pageMaxItems.yaml @@ -0,0 +1,8 @@ +name: pageMaxItems +in: query +description: The maximum number of items per page (up to 100,000) for paginated endpoints +required: false +schema: + type: integer + default: 100000 + minimum: 1 diff --git a/libs/schematic/api-description/src/components/parameters/query/pageNumber.yaml b/libs/schematic/api-description/src/components/parameters/query/pageNumber.yaml new file mode 100644 index 0000000000..9cd8f8e4f6 --- /dev/null +++ b/libs/schematic/api-description/src/components/parameters/query/pageNumber.yaml @@ -0,0 +1,8 @@ +name: pageNumber +in: query +description: The page number to get for a paginated query +required: false +schema: + type: integer + default: 1 + minimum: 1 diff --git a/libs/schematic/api-description/src/components/schemas/ConnectedNodes.yaml b/libs/schematic/api-description/src/components/schemas/ConnectedNodePair.yaml similarity index 100% rename from libs/schematic/api-description/src/components/schemas/ConnectedNodes.yaml rename to libs/schematic/api-description/src/components/schemas/ConnectedNodePair.yaml diff --git a/libs/schematic/api-description/src/components/schemas/ConnectedNodePairArray.yaml b/libs/schematic/api-description/src/components/schemas/ConnectedNodePairArray.yaml new file mode 100644 index 0000000000..cb5f7e48fd --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/ConnectedNodePairArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of conncted node pairs +properties: + connectedNodes: + description: An array of conncted node pairs. + type: array + items: + $ref: ConnectedNodePair.yaml diff --git a/libs/schematic/api-description/src/components/schemas/ConnectedNodePairPage.yaml b/libs/schematic/api-description/src/components/schemas/ConnectedNodePairPage.yaml new file mode 100644 index 0000000000..145a4abbba --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/ConnectedNodePairPage.yaml @@ -0,0 +1,15 @@ +type: object +description: A page of conncted node pairs +allOf: + - $ref: PageMetadata.yaml + - type: object + properties: + connectedNodes: + description: An array of conncted node pairs. + type: array + items: + $ref: ConnectedNodePair.yaml + required: + - connectedNodes +x-java-class-annotations: + - '@lombok.Builder' diff --git a/libs/schematic/api-description/src/components/schemas/ConnectedNodesPage.yaml b/libs/schematic/api-description/src/components/schemas/ConnectedNodesPage.yaml deleted file mode 100644 index 45c636945e..0000000000 --- a/libs/schematic/api-description/src/components/schemas/ConnectedNodesPage.yaml +++ /dev/null @@ -1,15 +0,0 @@ -type: object -description: A page of conncted nodes. -allOf: - - $ref: PageMetadata.yaml - - type: object - properties: - connected_nodes: - description: A list of conncted node pairs. - type: array - items: - $ref: ConnectedNodes.yaml - required: - - connected_nodes -x-java-class-annotations: - - '@lombok.Builder' diff --git a/libs/schematic/api-description/src/components/schemas/Dataset.yaml b/libs/schematic/api-description/src/components/schemas/DatasetMetadata.yaml similarity index 87% rename from libs/schematic/api-description/src/components/schemas/Dataset.yaml rename to libs/schematic/api-description/src/components/schemas/DatasetMetadata.yaml index 62f35ef1d4..5295d6abfd 100644 --- a/libs/schematic/api-description/src/components/schemas/Dataset.yaml +++ b/libs/schematic/api-description/src/components/schemas/DatasetMetadata.yaml @@ -1,5 +1,5 @@ type: object -description: A dataset. +description: The metadata of a dataset. properties: name: type: string diff --git a/libs/schematic/api-description/src/components/schemas/DatasetMetadataArray.yaml b/libs/schematic/api-description/src/components/schemas/DatasetMetadataArray.yaml new file mode 100644 index 0000000000..e8054da9fd --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/DatasetMetadataArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of dataset metadata. +properties: + datasets: + description: An array of dataset meatdata. + type: array + items: + $ref: DatasetMetadata.yaml diff --git a/libs/schematic/api-description/src/components/schemas/DatasetsPage.yaml b/libs/schematic/api-description/src/components/schemas/DatasetMetadataPage.yaml similarity index 62% rename from libs/schematic/api-description/src/components/schemas/DatasetsPage.yaml rename to libs/schematic/api-description/src/components/schemas/DatasetMetadataPage.yaml index 33df734615..c5f6a7b0d4 100644 --- a/libs/schematic/api-description/src/components/schemas/DatasetsPage.yaml +++ b/libs/schematic/api-description/src/components/schemas/DatasetMetadataPage.yaml @@ -1,14 +1,14 @@ type: object -description: A page of datasets. +description: A page of dataset metadata. allOf: - $ref: PageMetadata.yaml - type: object properties: datasets: - description: A list of datasets. + description: An array of dataset meatdata. type: array items: - $ref: Dataset.yaml + $ref: DatasetMetadata.yaml required: - datasets x-java-class-annotations: diff --git a/libs/schematic/api-description/src/components/schemas/File.yaml b/libs/schematic/api-description/src/components/schemas/FileMetadata.yaml similarity index 87% rename from libs/schematic/api-description/src/components/schemas/File.yaml rename to libs/schematic/api-description/src/components/schemas/FileMetadata.yaml index 9f72f918a0..7446f4f0f9 100644 --- a/libs/schematic/api-description/src/components/schemas/File.yaml +++ b/libs/schematic/api-description/src/components/schemas/FileMetadata.yaml @@ -1,5 +1,5 @@ type: object -description: A file. +description: The metadata for a file properties: name: type: string diff --git a/libs/schematic/api-description/src/components/schemas/FileMetadataArray.yaml b/libs/schematic/api-description/src/components/schemas/FileMetadataArray.yaml new file mode 100644 index 0000000000..2a11cc4e3e --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/FileMetadataArray.yaml @@ -0,0 +1,8 @@ +type: object +description: A list of file metadata. +properties: + files: + description: A list of file metadata. + type: array + items: + $ref: FileMetadata.yaml diff --git a/libs/schematic/api-description/src/components/schemas/FilesPage.yaml b/libs/schematic/api-description/src/components/schemas/FileMetadataPage.yaml similarity index 63% rename from libs/schematic/api-description/src/components/schemas/FilesPage.yaml rename to libs/schematic/api-description/src/components/schemas/FileMetadataPage.yaml index 500837b95b..a4d2afd428 100644 --- a/libs/schematic/api-description/src/components/schemas/FilesPage.yaml +++ b/libs/schematic/api-description/src/components/schemas/FileMetadataPage.yaml @@ -1,14 +1,14 @@ type: object -description: A page of files. +description: A page of file metadata. allOf: - $ref: PageMetadata.yaml - type: object properties: files: - description: A list of files. + description: A list of file metadata. type: array items: - $ref: File.yaml + $ref: FileMetadata.yaml required: - files x-java-class-annotations: diff --git a/libs/schematic/api-description/src/components/schemas/Manifest.yaml b/libs/schematic/api-description/src/components/schemas/ManifestMetadata.yaml similarity index 92% rename from libs/schematic/api-description/src/components/schemas/Manifest.yaml rename to libs/schematic/api-description/src/components/schemas/ManifestMetadata.yaml index 4c168e1263..2f3359f3ef 100644 --- a/libs/schematic/api-description/src/components/schemas/Manifest.yaml +++ b/libs/schematic/api-description/src/components/schemas/ManifestMetadata.yaml @@ -1,5 +1,5 @@ type: object -description: A manifest object +description: The metadata for a manifest file properties: name: type: string diff --git a/libs/schematic/api-description/src/components/schemas/ManifestMetadataArray.yaml b/libs/schematic/api-description/src/components/schemas/ManifestMetadataArray.yaml new file mode 100644 index 0000000000..7e93f70097 --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/ManifestMetadataArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of manifest metadata +properties: + manifests: + description: A list of manifest metadata + type: array + items: + $ref: ManifestMetadata.yaml diff --git a/libs/schematic/api-description/src/components/schemas/ManifestsPage.yaml b/libs/schematic/api-description/src/components/schemas/ManifestMetadataPage.yaml similarity index 62% rename from libs/schematic/api-description/src/components/schemas/ManifestsPage.yaml rename to libs/schematic/api-description/src/components/schemas/ManifestMetadataPage.yaml index 0f184dca1a..53cff51887 100644 --- a/libs/schematic/api-description/src/components/schemas/ManifestsPage.yaml +++ b/libs/schematic/api-description/src/components/schemas/ManifestMetadataPage.yaml @@ -1,14 +1,14 @@ type: object -description: A page of manifests. +description: A page of manifest metadata allOf: - $ref: PageMetadata.yaml - type: object properties: manifests: - description: A list of manifests. + description: A list of manifest metadata type: array items: - $ref: Manifest.yaml + $ref: ManifestMetadata.yaml required: - manifests x-java-class-annotations: diff --git a/libs/schematic/api-description/src/components/schemas/NodeArray.yaml b/libs/schematic/api-description/src/components/schemas/NodeArray.yaml new file mode 100644 index 0000000000..8bb9d140a9 --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/NodeArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of nodes. +properties: + nodes: + description: An array of nodes. + type: array + items: + $ref: Node.yaml diff --git a/libs/schematic/api-description/src/components/schemas/NodesPage.yaml b/libs/schematic/api-description/src/components/schemas/NodePage.yaml similarity index 86% rename from libs/schematic/api-description/src/components/schemas/NodesPage.yaml rename to libs/schematic/api-description/src/components/schemas/NodePage.yaml index d9eaa02048..3b86b371bc 100644 --- a/libs/schematic/api-description/src/components/schemas/NodesPage.yaml +++ b/libs/schematic/api-description/src/components/schemas/NodePage.yaml @@ -5,7 +5,7 @@ allOf: - type: object properties: nodes: - description: A list of nodes. + description: An array of nodes. type: array items: $ref: Node.yaml diff --git a/libs/schematic/api-description/src/components/schemas/NodePropertiesPage.yaml b/libs/schematic/api-description/src/components/schemas/NodePropertiesPage.yaml deleted file mode 100644 index b8509aa4ad..0000000000 --- a/libs/schematic/api-description/src/components/schemas/NodePropertiesPage.yaml +++ /dev/null @@ -1,15 +0,0 @@ -type: object -description: A page of node properties. -allOf: - - $ref: PageMetadata.yaml - - type: object - properties: - node_properties: - description: A list of node properties. - type: array - items: - $ref: NodeProperty.yaml - required: - - node_properties -x-java-class-annotations: - - '@lombok.Builder' diff --git a/libs/schematic/api-description/src/components/schemas/NodeProperty.yaml b/libs/schematic/api-description/src/components/schemas/NodeProperty.yaml deleted file mode 100644 index 7ce26bc329..0000000000 --- a/libs/schematic/api-description/src/components/schemas/NodeProperty.yaml +++ /dev/null @@ -1,9 +0,0 @@ -type: object -description: A node property -properties: - name: - type: string - description: The name of the property - example: molecularlyInteractsWith -required: - - name diff --git a/libs/schematic/api-description/src/components/schemas/NodePropertyArray.yaml b/libs/schematic/api-description/src/components/schemas/NodePropertyArray.yaml new file mode 100644 index 0000000000..c84ee116b5 --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/NodePropertyArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of node properties. +properties: + node_properties: + description: An array of node properties. + type: array + items: + type: string diff --git a/libs/schematic/api-description/src/components/schemas/Project.yaml b/libs/schematic/api-description/src/components/schemas/ProjectMetadata.yaml similarity index 87% rename from libs/schematic/api-description/src/components/schemas/Project.yaml rename to libs/schematic/api-description/src/components/schemas/ProjectMetadata.yaml index a6c61c8995..1ae97023db 100644 --- a/libs/schematic/api-description/src/components/schemas/Project.yaml +++ b/libs/schematic/api-description/src/components/schemas/ProjectMetadata.yaml @@ -1,5 +1,5 @@ type: object -description: A project. +description: The metadata for a project properties: name: type: string diff --git a/libs/schematic/api-description/src/components/schemas/ProjectMetadataArray.yaml b/libs/schematic/api-description/src/components/schemas/ProjectMetadataArray.yaml new file mode 100644 index 0000000000..611f317fe0 --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/ProjectMetadataArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of project metadata. +properties: + projects: + description: An array of project metadata. + type: array + items: + $ref: ProjectMetadata.yaml diff --git a/libs/schematic/api-description/src/components/schemas/ProjectsPage.yaml b/libs/schematic/api-description/src/components/schemas/ProjectMetadataPage.yaml similarity index 62% rename from libs/schematic/api-description/src/components/schemas/ProjectsPage.yaml rename to libs/schematic/api-description/src/components/schemas/ProjectMetadataPage.yaml index 2355e05a46..e4377e5492 100644 --- a/libs/schematic/api-description/src/components/schemas/ProjectsPage.yaml +++ b/libs/schematic/api-description/src/components/schemas/ProjectMetadataPage.yaml @@ -1,14 +1,14 @@ type: object -description: A page of projects. +description: A page of project metadata. allOf: - $ref: PageMetadata.yaml - type: object properties: projects: - description: A list of projects. + description: An array of project metadata. type: array items: - $ref: Project.yaml + $ref: ProjectMetadata.yaml required: - projects x-java-class-annotations: diff --git a/libs/schematic/api-description/src/components/schemas/ValidationRuleArray.yaml b/libs/schematic/api-description/src/components/schemas/ValidationRuleArray.yaml new file mode 100644 index 0000000000..6758b42c63 --- /dev/null +++ b/libs/schematic/api-description/src/components/schemas/ValidationRuleArray.yaml @@ -0,0 +1,8 @@ +type: object +description: An array of validation rules. +properties: + validation_rules: + description: An array of validation rules. + type: array + items: + $ref: ValidationRule.yaml diff --git a/libs/schematic/api-description/src/components/schemas/ValidationRulesPage.yaml b/libs/schematic/api-description/src/components/schemas/ValidationRulesPage.yaml deleted file mode 100644 index 94984e5e1d..0000000000 --- a/libs/schematic/api-description/src/components/schemas/ValidationRulesPage.yaml +++ /dev/null @@ -1,15 +0,0 @@ -type: object -description: A page of validation rules. -allOf: - - $ref: PageMetadata.yaml - - type: object - properties: - validation_rules: - description: A list of validation rules. - type: array - items: - $ref: ValidationRule.yaml - required: - - validation_rules -x-java-class-annotations: - - '@lombok.Builder' diff --git a/libs/schematic/api-description/src/openapi.yaml b/libs/schematic/api-description/src/openapi.yaml index 0eb8f2dbad..3cb918ad6b 100644 --- a/libs/schematic/api-description/src/openapi.yaml +++ b/libs/schematic/api-description/src/openapi.yaml @@ -26,11 +26,17 @@ paths: /schematicVersion: $ref: paths/schematicVersion.yaml - /assetTypes/{assetType}/projects/{projectId}/datasets: - $ref: paths/assetTypes/@{assetType}/projects/@{projectId}/datasets.yaml + /assetTypes/{assetType}/projects/{projectId}/datasetMetadataArray: + $ref: paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataArray.yaml - /assetTypes/{assetType}/projects/{projectId}/manifests: - $ref: paths/assetTypes/@{assetType}/projects/@{projectId}/manifests.yaml + /assetTypes/{assetType}/projects/{projectId}/datasetMetadataPage: + $ref: paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataPage.yaml + + /assetTypes/{assetType}/projects/{projectId}/manifestMetadataArray: + $ref: paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataArray.yaml + + /assetTypes/{assetType}/projects/{projectId}/manifestMetadataPage: + $ref: paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataPage.yaml /assetTypes/{assetType}/assetViews/{assetViewId}/json: $ref: paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/json.yaml @@ -38,17 +44,26 @@ paths: /assetTypes/{assetType}/datasets/{datasetId}/manifestJson: $ref: paths/assetTypes/@{assetType}/datasets/@{datasetId}/manifestJson.yaml - /assetTypes/{assetType}/assetViews/{assetViewId}/projects: - $ref: paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projects.yaml + /assetTypes/{assetType}/assetViews/{assetViewId}/projectMetadataArray: + $ref: paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataArray.yaml + + /assetTypes/{assetType}/assetViews/{assetViewId}/projectMetadataPage: + $ref: paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataPage.yaml - /assetTypes/{assetType}/datasets/{datasetId}/files: - $ref: paths/assetTypes/@{assetType}/datasets/@{datasetId}/files.yaml + /assetTypes/{assetType}/datasets/{datasetId}/fileMetadataArray: + $ref: paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataArray.yaml + + /assetTypes/{assetType}/datasets/{datasetId}/fileMetadataPage: + $ref: paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataPage.yaml /assetTypes/{assetType}/manifests/{manifestId}/json: $ref: paths/assetTypes/@{assetType}/manifests/@{manifestId}/json.yaml - /nodes/{nodeLabel}/dependencies: - $ref: paths/nodes/@{nodeLabel}/dependencies.yaml + /nodes/{nodeLabel}/dependencyArray: + $ref: paths/nodes/@{nodeLabel}/dependencyArray.yaml + + /nodes/{nodeLabel}/dependencyPage: + $ref: paths/nodes/@{nodeLabel}/dependencyPage.yaml /nodes/{nodeDisplay}/isRequired: $ref: paths/nodes/@{nodeDisplay}/isRequired.yaml @@ -68,8 +83,11 @@ paths: /schemaAttributes: $ref: paths/schemaAttributes.yaml - /connectedNodes: - $ref: paths/connectedNodes.yaml + /connectedNodePairArray: + $ref: paths/connectedNodePairArray.yaml + + /connectedNodePairPage: + $ref: paths/connectedNodePairPage.yaml /validateManifestJson: $ref: paths/validateManifestJson.yaml diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projects.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataArray.yaml similarity index 87% rename from libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projects.yaml rename to libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataArray.yaml index 3e9f4f6452..1ec8199408 100644 --- a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projects.yaml +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataArray.yaml @@ -6,7 +6,7 @@ get: - Storage summary: Gets all storage projects the current user has access to. description: Gets all storage projects the current user has access to. - operationId: getProjects + operationId: getProjectMetadataArray security: - bearerAuth: [] responses: @@ -15,7 +15,7 @@ get: content: application/json: schema: - $ref: ../../../../../components/schemas/ProjectsPage.yaml + $ref: ../../../../../components/schemas/ProjectMetadataArray.yaml '400': $ref: ../../../../../components/responses/BadRequest.yaml '401': diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataPage.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataPage.yaml new file mode 100644 index 0000000000..919476deb4 --- /dev/null +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/assetViews/@{assetViewId}/projectMetadataPage.yaml @@ -0,0 +1,31 @@ +parameters: + - $ref: ../../../../../components/parameters/path/assetViewId.yaml + - $ref: ../../../../../components/parameters/path/assetType.yaml +get: + tags: + - Storage + summary: Gets all storage projects the current user has access to. + description: Gets all storage projects the current user has access to. + operationId: getProjectMetadataPage + parameters: + - $ref: ../../../../../components/parameters/query/pageNumber.yaml + - $ref: ../../../../../components/parameters/query/pageMaxItems.yaml + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../../../../../components/schemas/ProjectMetadataPage.yaml + '400': + $ref: ../../../../../components/responses/BadRequest.yaml + '401': + $ref: ../../../../../components/responses/Unauthorized.yaml + '403': + $ref: ../../../../../components/responses/Unauthorized.yaml + '404': + $ref: ../../../../../components/responses/NotFound.yaml + '500': + $ref: ../../../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/files.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataArray.yaml similarity index 89% rename from libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/files.yaml rename to libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataArray.yaml index bce54b88de..aa6662461d 100644 --- a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/files.yaml +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataArray.yaml @@ -6,7 +6,7 @@ get: - Storage summary: Gets all files associated with a dataset. description: Gets all files associated with a dataset. - operationId: getDatasetFiles + operationId: getDatasetFileMetadataArray parameters: - $ref: ../../../../../components/parameters/query/fileNames.yaml - $ref: ../../../../../components/parameters/query/useFullFilePath.yaml @@ -19,7 +19,7 @@ get: content: application/json: schema: - $ref: ../../../../../components/schemas/FilesPage.yaml + $ref: ../../../../../components/schemas/FileMetadataArray.yaml '400': $ref: ../../../../../components/responses/BadRequest.yaml '401': diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataPage.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataPage.yaml new file mode 100644 index 0000000000..bff550c543 --- /dev/null +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/datasets/@{datasetId}/fileMetadataPage.yaml @@ -0,0 +1,34 @@ +parameters: + - $ref: ../../../../../components/parameters/path/datasetId.yaml + - $ref: ../../../../../components/parameters/path/assetType.yaml +get: + tags: + - Storage + summary: Gets all files associated with a dataset. + description: Gets all files associated with a dataset. + operationId: getDatasetFileMetadataPage + parameters: + - $ref: ../../../../../components/parameters/query/fileNames.yaml + - $ref: ../../../../../components/parameters/query/useFullFilePath.yaml + - $ref: ../../../../../components/parameters/query/assetViewIdQuery.yaml + - $ref: ../../../../../components/parameters/query/pageNumber.yaml + - $ref: ../../../../../components/parameters/query/pageMaxItems.yaml + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../../../../../components/schemas/FileMetadataPage.yaml + '400': + $ref: ../../../../../components/responses/BadRequest.yaml + '401': + $ref: ../../../../../components/responses/Unauthorized.yaml + '403': + $ref: ../../../../../components/responses/Unauthorized.yaml + '404': + $ref: ../../../../../components/responses/NotFound.yaml + '500': + $ref: ../../../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasets.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataArray.yaml similarity index 69% rename from libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasets.yaml rename to libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataArray.yaml index af52d94eb1..3b3129d323 100644 --- a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasets.yaml +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataArray.yaml @@ -4,9 +4,9 @@ parameters: get: tags: - Storage - summary: Gets all datasets in folder under a given storage project that the current user has access to. - description: Gets all datasets in folder under a given storage project that the current user has access to. - operationId: getProjectDatasets + summary: Gets all dataset metadata in folder under a given storage project that the current user has access to. + description: Gets all dataset meatdata in folder under a given storage project that the current user has access to. + operationId: getProjectDatasetMetadataArray parameters: - $ref: ../../../../../components/parameters/query/assetViewIdQuery.yaml security: @@ -17,7 +17,7 @@ get: content: application/json: schema: - $ref: ../../../../../components/schemas/DatasetsPage.yaml + $ref: ../../../../../components/schemas/DatasetMetadataArray.yaml '400': $ref: ../../../../../components/responses/BadRequest.yaml '401': diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataPage.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataPage.yaml new file mode 100644 index 0000000000..3eb10177b5 --- /dev/null +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/datasetMetadataPage.yaml @@ -0,0 +1,32 @@ +parameters: + - $ref: ../../../../../components/parameters/path/projectId.yaml + - $ref: ../../../../../components/parameters/path/assetType.yaml +get: + tags: + - Storage + summary: Gets a page of dataset metadata in folder under a given storage project that the current user has access to. + description: Gets a page of dataset meatdata in folder under a given storage project that the current user has access to. + operationId: getProjectDatasetMetadataPage + parameters: + - $ref: ../../../../../components/parameters/query/assetViewIdQuery.yaml + - $ref: ../../../../../components/parameters/query/pageNumber.yaml + - $ref: ../../../../../components/parameters/query/pageMaxItems.yaml + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../../../../../components/schemas/DatasetMetadataPage.yaml + '400': + $ref: ../../../../../components/responses/BadRequest.yaml + '401': + $ref: ../../../../../components/responses/Unauthorized.yaml + '403': + $ref: ../../../../../components/responses/Unauthorized.yaml + '404': + $ref: ../../../../../components/responses/NotFound.yaml + '500': + $ref: ../../../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifests.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataArray.yaml similarity index 88% rename from libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifests.yaml rename to libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataArray.yaml index e8cae7a3b2..8507a8090e 100644 --- a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifests.yaml +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataArray.yaml @@ -6,7 +6,7 @@ get: - Storage summary: Gets all manifests in a project folder that users have access to description: Gets all manifests in a project folder that the current user has access to. - operationId: getProjectManifests + operationId: getProjectManifestMetadataArray parameters: - $ref: ../../../../../components/parameters/query/assetViewIdQuery.yaml security: @@ -17,7 +17,7 @@ get: content: application/json: schema: - $ref: ../../../../../components/schemas/ManifestsPage.yaml + $ref: ../../../../../components/schemas/ManifestMetadataArray.yaml '400': $ref: ../../../../../components/responses/BadRequest.yaml '401': diff --git a/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataPage.yaml b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataPage.yaml new file mode 100644 index 0000000000..0804995f25 --- /dev/null +++ b/libs/schematic/api-description/src/paths/assetTypes/@{assetType}/projects/@{projectId}/manifestMetadataPage.yaml @@ -0,0 +1,32 @@ +parameters: + - $ref: ../../../../../components/parameters/path/projectId.yaml + - $ref: ../../../../../components/parameters/path/assetType.yaml +get: + tags: + - Storage + summary: Gets all manifests in a project folder that users have access to + description: Gets all manifests in a project folder that the current user has access to. + operationId: getProjectManifestMetadataPage + parameters: + - $ref: ../../../../../components/parameters/query/assetViewIdQuery.yaml + - $ref: ../../../../../components/parameters/query/pageNumber.yaml + - $ref: ../../../../../components/parameters/query/pageMaxItems.yaml + security: + - bearerAuth: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../../../../../components/schemas/ManifestMetadataPage.yaml + '400': + $ref: ../../../../../components/responses/BadRequest.yaml + '401': + $ref: ../../../../../components/responses/Unauthorized.yaml + '403': + $ref: ../../../../../components/responses/Unauthorized.yaml + '404': + $ref: ../../../../../components/responses/NotFound.yaml + '500': + $ref: ../../../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/connectedNodes.yaml b/libs/schematic/api-description/src/paths/connectedNodePairArray.yaml similarity index 62% rename from libs/schematic/api-description/src/paths/connectedNodes.yaml rename to libs/schematic/api-description/src/paths/connectedNodePairArray.yaml index 1f48909c07..c7877f49f4 100644 --- a/libs/schematic/api-description/src/paths/connectedNodes.yaml +++ b/libs/schematic/api-description/src/paths/connectedNodePairArray.yaml @@ -1,9 +1,9 @@ get: tags: - Schema - summary: Gets a list of connected node pairs - description: Gets a list of connected node pairs - operationId: getConnectedNodes + summary: Gets an array of connected node pairs + description: Gets a array of connected node pairs + operationId: getConnectedNodePairArray parameters: - $ref: ../components/parameters/query/schemaUrl.yaml - $ref: ../components/parameters/query/relationshipType.yaml @@ -13,6 +13,6 @@ get: content: application/json: schema: - $ref: ../components/schemas/ConnectedNodesPage.yaml + $ref: ../components/schemas/ConnectedNodePairArray.yaml '500': $ref: ../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/connectedNodePairPage.yaml b/libs/schematic/api-description/src/paths/connectedNodePairPage.yaml new file mode 100644 index 0000000000..3465b55433 --- /dev/null +++ b/libs/schematic/api-description/src/paths/connectedNodePairPage.yaml @@ -0,0 +1,20 @@ +get: + tags: + - Schema + summary: Gets a page of connected node pairs + description: Gets a page of connected node pairs + operationId: getConnectedNodePairPage + parameters: + - $ref: ../components/parameters/query/schemaUrl.yaml + - $ref: ../components/parameters/query/relationshipType.yaml + - $ref: ../components/parameters/query/pageNumber.yaml + - $ref: ../components/parameters/query/pageMaxItems.yaml + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../components/schemas/ConnectedNodePairPage.yaml + '500': + $ref: ../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/nodes/@{nodeDisplay}/validationRules.yaml b/libs/schematic/api-description/src/paths/nodes/@{nodeDisplay}/validationRules.yaml index f8e30960d2..bb6f3fa52d 100644 --- a/libs/schematic/api-description/src/paths/nodes/@{nodeDisplay}/validationRules.yaml +++ b/libs/schematic/api-description/src/paths/nodes/@{nodeDisplay}/validationRules.yaml @@ -5,7 +5,7 @@ get: - Schema summary: Gets the validation rules, along with the arguments for each given rule associated with a given node description: Gets the validation rules, along with the arguments for each given rule associated with a given node - operationId: listNodeValidationRules + operationId: getNodeValidationRules parameters: - $ref: ../../../components/parameters/query/schemaUrl.yaml responses: @@ -14,6 +14,6 @@ get: content: application/json: schema: - $ref: ../../../components/schemas/ValidationRulesPage.yaml + $ref: ../../../components/schemas/ValidationRuleArray.yaml '500': $ref: ../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencies.yaml b/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencyArray.yaml similarity index 87% rename from libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencies.yaml rename to libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencyArray.yaml index 4d09ff773f..d183da2a0c 100644 --- a/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencies.yaml +++ b/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencyArray.yaml @@ -5,7 +5,7 @@ get: - Schema summary: Gets the immediate dependencies that are related to the given source node description: Gets the immediate dependencies that are related to the given source node - operationId: listNodeDependencies + operationId: getNodeDependencyArray parameters: - $ref: ../../../components/parameters/query/schemaUrl.yaml - $ref: ../../../components/parameters/query/returnDisplayNames.yaml @@ -16,6 +16,6 @@ get: content: application/json: schema: - $ref: ../../../components/schemas/NodesPage.yaml + $ref: ../../../components/schemas/NodeArray.yaml '500': $ref: ../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencyPage.yaml b/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencyPage.yaml new file mode 100644 index 0000000000..7e4c7c7f75 --- /dev/null +++ b/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/dependencyPage.yaml @@ -0,0 +1,23 @@ +parameters: + - $ref: ../../../components/parameters/path/nodeLabel.yaml +get: + tags: + - Schema + summary: Gets the immediate dependencies that are related to the given source node + description: Gets the immediate dependencies that are related to the given source node + operationId: getNodeDependencyPage + parameters: + - $ref: ../../../components/parameters/query/schemaUrl.yaml + - $ref: ../../../components/parameters/query/returnDisplayNames.yaml + - $ref: ../../../components/parameters/query/returnOrderedBySchema.yaml + - $ref: ../../../components/parameters/query/pageNumber.yaml + - $ref: ../../../components/parameters/query/pageMaxItems.yaml + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../../../components/schemas/NodePage.yaml + '500': + $ref: ../../../components/responses/InternalServerError.yaml diff --git a/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/nodeProperties.yaml b/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/nodeProperties.yaml index 4e6be627db..70e5a277ac 100644 --- a/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/nodeProperties.yaml +++ b/libs/schematic/api-description/src/paths/nodes/@{nodeLabel}/nodeProperties.yaml @@ -14,6 +14,6 @@ get: content: application/json: schema: - $ref: ../../../components/schemas/NodePropertiesPage.yaml + $ref: ../../../components/schemas/NodePropertyArray.yaml '500': $ref: ../../../components/responses/InternalServerError.yaml