Skip to content

Commit 51d6df3

Browse files
authored
✨ Is686/apiserver api 0.4.2: studies ports (ITISFoundation#3623)
1 parent c1d30ff commit 51d6df3

File tree

16 files changed

+293
-29
lines changed

16 files changed

+293
-29
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
<!-- NOTE: when branched replace `master` in urls -->
99
[![Code style: black]](https://github.com/psf/black)
10-
[![Requires.io]](https://requires.io/github/ITISFoundation/osparc-simcore/requirements/?branch=master "State of third party python dependencies")
1110
[![CI](https://github.com/ITISFoundation/osparc-simcore/actions/workflows/ci-testing-deploy.yml/badge.svg)](https://github.com/ITISFoundation/osparc-simcore/actions/workflows/ci-testing-deploy.yml)
1211
[![codecov](https://codecov.io/gh/ITISFoundation/osparc-simcore/branch/master/graph/badge.svg?token=h1rOE8q7ic)](https://codecov.io/gh/ITISFoundation/osparc-simcore)
1312
[![github.io]](https://itisfoundation.github.io/)
@@ -17,7 +16,6 @@
1716

1817
<!-- ADD HERE ALL BADGE URLS. Use https://shields.io/ -->
1918
[Code style: black]:https://img.shields.io/badge/code%20style-black-000000.svg
20-
[Requires.io]:https://requires.io/github/ITISFoundation/osparc-simcore/requirements.svg?branch=master
2119
[github.io]:https://img.shields.io/website-up-down-green-red/https/itisfoundation.github.io.svg?label=documentation
2220
[itis.dockerhub]:https://img.shields.io/website/https/hub.docker.com/u/itisfoundation.svg?down_color=red&label=dockerhub%20repos&up_color=green
2321
[license]:https://img.shields.io/github/license/ITISFoundation/osparc-simcore
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from typing import Any, Final
2+
3+
# Web-server API responses of /projects/{project_id}/metadata/ports
4+
# as reponses in this mock. SEE services/web/server/tests/unit/with_dbs/02/test_projects_ports_handlers.py
5+
# NOTE: this could be added as examples in the OAS but for the moment we want to avoid overloading openapi.yml
6+
# in the web-server.
7+
PROJECTS_METADATA_PORTS_RESPONSE_BODY_DATA: Final[list[dict[str, Any]]] = [
8+
{
9+
"key": "38a0d401-af4b-4ea7-ab4c-5005c712a546",
10+
"kind": "input",
11+
"content_schema": {
12+
"description": "Parameter of type integer",
13+
"title": "X",
14+
"type": "integer",
15+
},
16+
},
17+
{
18+
"key": "fc48252a-9dbb-4e07-bf9a-7af65a18f612",
19+
"kind": "input",
20+
"content_schema": {
21+
"description": "Parameter of type integer",
22+
"title": "Z",
23+
"type": "integer",
24+
},
25+
},
26+
{
27+
"key": "7bf0741f-bae4-410b-b662-fc34b47c27c9",
28+
"kind": "input",
29+
"content_schema": {
30+
"description": "Parameter of type boolean",
31+
"title": "on",
32+
"type": "boolean",
33+
},
34+
},
35+
{
36+
"key": "09fd512e-0768-44ca-81fa-0cecab74ec1a",
37+
"kind": "output",
38+
"content_schema": {
39+
"default": 0,
40+
"description": "Captures integer values attached to it",
41+
"title": "Random sleep interval_2",
42+
"type": "integer",
43+
},
44+
},
45+
{
46+
"key": "76f607b4-8761-4f96-824d-cab670bc45f5",
47+
"kind": "output",
48+
"content_schema": {
49+
"default": 0,
50+
"description": "Captures integer values attached to it",
51+
"title": "Random sleep interval",
52+
"type": "integer",
53+
},
54+
},
55+
]

services/api-server/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.1
1+
0.4.2

services/api-server/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"info": {
44
"title": "osparc.io web API",
55
"description": "osparc-simcore public web API specifications",
6-
"version": "0.4.1",
6+
"version": "0.4.2",
77
"x-logo": {
88
"url": "https://raw.githubusercontent.com/ITISFoundation/osparc-manual/b809d93619512eb60c827b7e769c6145758378d0/_media/osparc-logo.svg",
99
"altText": "osparc-simcore logo"

services/api-server/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.4.1
2+
current_version = 0.4.2
33
commit = True
44
message = services/api-server version: {current_version} → {new_version}
55
tag = False

services/api-server/src/simcore_service_api_server/api/root.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from fastapi import APIRouter
22

33
from ..core.settings import ApplicationSettings
4-
from .routes import files, health, meta, solvers, solvers_jobs, users
4+
from .routes import files, health, meta, solvers, solvers_jobs, studies, users
55

66

77
def create_router(settings: ApplicationSettings):
@@ -17,6 +17,7 @@ def create_router(settings: ApplicationSettings):
1717
router.include_router(files.router, tags=["files"], prefix="/files")
1818
router.include_router(solvers.router, tags=["solvers"], prefix="/solvers")
1919
router.include_router(solvers_jobs.router, tags=["solvers"], prefix="/solvers")
20+
router.include_router(studies.router, tags=["studies"], prefix="/studies")
2021

2122
# NOTE: multiple-files upload is currently disabled
2223
# Web form to upload files at http://localhost:8000/v0/upload-form-view
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import logging
2+
from typing import Any
3+
4+
from fastapi import APIRouter, Depends
5+
6+
from ...core.settings import BasicSettings
7+
from ...models.schemas.studies import StudyID, StudyPort
8+
from ..dependencies.webserver import AuthSession, get_webserver_session
9+
10+
logger = logging.getLogger(__name__)
11+
router = APIRouter()
12+
settings = BasicSettings.create_from_envs()
13+
14+
15+
@router.get(
16+
"/{study_id}/ports",
17+
response_model=list[StudyPort],
18+
include_in_schema=settings.API_SERVER_DEV_FEATURES_ENABLED,
19+
)
20+
async def list_study_ports(
21+
study_id: StudyID,
22+
webserver_api: AuthSession = Depends(get_webserver_session),
23+
):
24+
"""Lists metadata on ports of a given study
25+
26+
New in *version 0.5.0* (only with API_SERVER_DEV_FEATURES_ENABLED=1)
27+
"""
28+
project_ports: list[
29+
dict[str, Any]
30+
] = await webserver_api.get_project_metadata_ports(project_id=study_id)
31+
return project_ports
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from models_library.projects import ProjectID
2+
from models_library.projects_nodes_io import NodeID
3+
from pydantic import Field
4+
5+
from .solvers import SolverPort
6+
7+
StudyID = ProjectID
8+
9+
10+
class StudyPort(SolverPort):
11+
key: NodeID = Field(
12+
...,
13+
description="port identifier name."
14+
"Correponds to the UUID of the parameter/probe node in the study",
15+
title="Key name",
16+
)

0 commit comments

Comments
 (0)