-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ catalog API schema models moved to models-library (#4553)
- Loading branch information
Showing
119 changed files
with
841 additions
and
1,986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
packages/models-library/src/models_library/api_schemas_catalog/meta.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import Any, ClassVar | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from ..basic_types import VersionStr | ||
|
||
|
||
class Meta(BaseModel): | ||
name: str | ||
version: VersionStr | ||
released: dict[str, VersionStr] | None = Field( | ||
None, description="Maps every route's path tag with a released version" | ||
) | ||
|
||
class Config: | ||
schema_extra: ClassVar[dict[str, Any]] = { | ||
"example": { | ||
"name": "simcore_service_foo", | ||
"version": "2.4.45", | ||
"released": {"v1": "1.3.4", "v2": "2.4.45"}, | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...src/models_library/api_schemas_catalog.py → ..._schemas_catalog/service_access_rights.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
from typing import Optional | ||
from typing import Any, ClassVar | ||
|
||
from models_library.emails import LowerCaseEmailStr | ||
from models_library.services import ServiceDockerData, ServiceMetaData | ||
from models_library.services_access import ServiceAccessRights | ||
from models_library.services_resources import ServiceResourcesDict | ||
from pydantic import Extra | ||
from pydantic.main import BaseModel | ||
|
||
from ..emails import LowerCaseEmailStr | ||
from ..services import ServiceDockerData, ServiceMetaData | ||
from ..services_access import ServiceAccessRights | ||
from ..services_resources import ServiceResourcesDict | ||
|
||
|
||
# OpenAPI models (contain both service metadata and access rights) | ||
class ServiceUpdate(ServiceMetaData, ServiceAccessRights): | ||
class Config: | ||
schema_extra = { | ||
schema_extra: ClassVar[dict[str, Any]] = { | ||
"example": { | ||
# ServiceAccessRights | ||
"accessRights": { | ||
|
@@ -64,16 +63,16 @@ class Config: | |
class ServiceGet( | ||
ServiceDockerData, ServiceAccessRights, ServiceMetaData | ||
): # pylint: disable=too-many-ancestors | ||
owner: Optional[LowerCaseEmailStr] | ||
owner: LowerCaseEmailStr | None | ||
|
||
class Config: | ||
allow_population_by_field_name = True | ||
extra = Extra.ignore | ||
schema_extra = { | ||
schema_extra: ClassVar[dict[str, Any]] = { | ||
"example": { | ||
"name": "File Picker", | ||
"thumbnail": None, | ||
"description": "File Picker", | ||
"description": "description", | ||
"classifiers": [], | ||
"quality": {}, | ||
"accessRights": { | ||
|
@@ -109,32 +108,4 @@ class Config: | |
} | ||
|
||
|
||
# TODO: prototype for next iteration | ||
# Items are non-detailed version of resources listed | ||
class ServiceItem(BaseModel): | ||
class Config: | ||
extra = Extra.ignore | ||
schema_extra = { | ||
"example": { | ||
"title": "File Picker", # NEW: rename 'name' as title (so it is not confused with an identifier!) | ||
"thumbnail": None, # optional | ||
"description": "File Picker", | ||
"classifiers_url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/classifiers", | ||
"quality": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/quality", | ||
"access_rights_url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/access_rights", | ||
"key_id": "simcore/services/frontend/file-picker", # NEW: renames key -> key_id | ||
"version": "1.0.0", | ||
"id": "a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4", # NEW: alternative identifier to key_id:version | ||
"integration-version": "1.0.0", | ||
"type": "dynamic", | ||
"badges_url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/badges", | ||
"authors_url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/authors", | ||
"inputs_url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/inputs", | ||
"outputs_url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4/outputs", | ||
"owner": "[email protected]", # NEW, replaces "contact": "[email protected]" | ||
"url": "https://catalog:8080/services/a8f5a503-01d5-40bc-b416-f5b7cc5d1fa4", # NEW self | ||
} | ||
} | ||
|
||
|
||
ServiceResourcesGet = ServiceResourcesDict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 4 additions & 7 deletions
11
...models/schemas/services_specifications.py → ...chemas_catalog/services_specifications.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
packages/models-library/src/models_library/api_schemas_webserver/resource_usage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.