Skip to content

Commit e570beb

Browse files
open api specs
1 parent f2113ec commit e570beb

File tree

3 files changed

+246
-0
lines changed

3 files changed

+246
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
""" Helper script to generate OAS automatically
2+
"""
3+
4+
# pylint: disable=redefined-outer-name
5+
# pylint: disable=unused-argument
6+
# pylint: disable=unused-variable
7+
# pylint: disable=too-many-arguments
8+
9+
from typing import Annotated
10+
11+
from _common import as_query
12+
from fastapi import APIRouter, Depends, status
13+
from models_library.api_schemas_webserver.license_goods import LicenseGoodGet
14+
from models_library.generics import Envelope
15+
from models_library.rest_error import EnvelopedError
16+
from simcore_service_webserver._meta import API_VTAG
17+
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
18+
from simcore_service_webserver.licenses._models import (
19+
LicenseGoodsBodyParams,
20+
LicenseGoodsListQueryParams,
21+
LicenseGoodsPathParams,
22+
)
23+
24+
router = APIRouter(
25+
prefix=f"/{API_VTAG}",
26+
tags=[
27+
"licenses",
28+
],
29+
responses={
30+
i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values()
31+
},
32+
)
33+
34+
35+
@router.get(
36+
"/license-goods",
37+
response_model=Envelope[list[LicenseGoodGet]],
38+
)
39+
async def list_workspaces(
40+
_query: Annotated[as_query(LicenseGoodsListQueryParams), Depends()],
41+
):
42+
...
43+
44+
45+
@router.get(
46+
"/license-goods/{license_good_id}",
47+
response_model=Envelope[LicenseGoodGet],
48+
)
49+
async def get_workspace(
50+
_path: Annotated[LicenseGoodsPathParams, Depends()],
51+
):
52+
...
53+
54+
55+
@router.post("/license-goods/{license_good_id}", status_code=status.HTTP_204_NO_CONTENT)
56+
async def create_workspace_group(
57+
_path: Annotated[LicenseGoodsPathParams, Depends()],
58+
_body: LicenseGoodsBodyParams,
59+
):
60+
...

api/specs/web-server/openapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"_exporter",
3636
"_folders",
3737
"_long_running_tasks",
38+
"_license_goods",
3839
"_metamodeling",
3940
"_nih_sparc",
4041
"_nih_sparc_redirections",

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,6 +2915,106 @@ paths:
29152915
content:
29162916
application/json:
29172917
schema: {}
2918+
/v0/license-goods:
2919+
get:
2920+
tags:
2921+
- licenses
2922+
summary: List Workspaces
2923+
operationId: list_workspaces
2924+
parameters:
2925+
- name: order_by
2926+
in: query
2927+
required: false
2928+
schema:
2929+
type: string
2930+
contentMediaType: application/json
2931+
contentSchema: {}
2932+
default: '{"field":"modified","direction":"desc"}'
2933+
title: Order By
2934+
- name: limit
2935+
in: query
2936+
required: false
2937+
schema:
2938+
type: integer
2939+
default: 20
2940+
title: Limit
2941+
- name: offset
2942+
in: query
2943+
required: false
2944+
schema:
2945+
type: integer
2946+
default: 0
2947+
title: Offset
2948+
responses:
2949+
'200':
2950+
description: Successful Response
2951+
content:
2952+
application/json:
2953+
schema:
2954+
$ref: '#/components/schemas/Envelope_list_LicenseGoodGet__'
2955+
'404':
2956+
content:
2957+
application/json:
2958+
schema:
2959+
$ref: '#/components/schemas/EnvelopedError'
2960+
description: Not Found
2961+
/v0/license-goods/{license_good_id}:
2962+
get:
2963+
tags:
2964+
- licenses
2965+
summary: Get Workspace
2966+
operationId: get_workspace
2967+
parameters:
2968+
- name: license_good_id
2969+
in: path
2970+
required: true
2971+
schema:
2972+
type: integer
2973+
exclusiveMinimum: true
2974+
title: License Good Id
2975+
minimum: 0
2976+
responses:
2977+
'200':
2978+
description: Successful Response
2979+
content:
2980+
application/json:
2981+
schema:
2982+
$ref: '#/components/schemas/Envelope_LicenseGoodGet_'
2983+
'404':
2984+
content:
2985+
application/json:
2986+
schema:
2987+
$ref: '#/components/schemas/EnvelopedError'
2988+
description: Not Found
2989+
post:
2990+
tags:
2991+
- licenses
2992+
summary: Create Workspace Group
2993+
operationId: create_workspace_group
2994+
parameters:
2995+
- name: license_good_id
2996+
in: path
2997+
required: true
2998+
schema:
2999+
type: integer
3000+
exclusiveMinimum: true
3001+
title: License Good Id
3002+
minimum: 0
3003+
requestBody:
3004+
required: true
3005+
content:
3006+
application/json:
3007+
schema:
3008+
$ref: '#/components/schemas/LicenseGoodsBodyParams'
3009+
responses:
3010+
'204':
3011+
description: Successful Response
3012+
'404':
3013+
content:
3014+
application/json:
3015+
schema:
3016+
$ref: '#/components/schemas/EnvelopedError'
3017+
description: Not Found
29183018
/v0/projects/{project_uuid}/checkpoint/{ref_id}/iterations:
29193019
get:
29203020
tags:
@@ -7710,6 +7810,19 @@ components:
77107810
title: Error
77117811
type: object
77127812
title: Envelope[InvitationInfo]
7813+
Envelope_LicenseGoodGet_:
7814+
properties:
7815+
data:
7816+
anyOf:
7817+
- $ref: '#/components/schemas/LicenseGoodGet'
7818+
- type: 'null'
7819+
error:
7820+
anyOf:
7821+
- {}
7822+
- type: 'null'
7823+
title: Error
7824+
type: object
7825+
title: Envelope[LicenseGoodGet]
77137826
Envelope_Log_:
77147827
properties:
77157828
data:
@@ -8483,6 +8596,22 @@ components:
84838596
title: Error
84848597
type: object
84858598
title: Envelope[list[GroupUserGet]]
8599+
Envelope_list_LicenseGoodGet__:
8600+
properties:
8601+
data:
8602+
anyOf:
8603+
- items:
8604+
$ref: '#/components/schemas/LicenseGoodGet'
8605+
type: array
8606+
- type: 'null'
8607+
title: Data
8608+
error:
8609+
anyOf:
8610+
- {}
8611+
- type: 'null'
8612+
title: Error
8613+
type: object
8614+
title: Envelope[list[LicenseGoodGet]]
84868615
Envelope_list_OsparcCreditsAggregatedByServiceGet__:
84878616
properties:
84888617
data:
@@ -9878,6 +10007,62 @@ components:
987810007
additionalProperties: false
987910008
type: object
988010009
title: InvitationInfo
10010+
LicenseGoodGet:
10011+
properties:
10012+
licenseGoodId:
10013+
type: integer
10014+
exclusiveMinimum: true
10015+
title: Licensegoodid
10016+
minimum: 0
10017+
name:
10018+
type: string
10019+
title: Name
10020+
licenseResourceType:
10021+
$ref: '#/components/schemas/LicenseResourceType'
10022+
pricingPlanId:
10023+
type: integer
10024+
exclusiveMinimum: true
10025+
title: Pricingplanid
10026+
minimum: 0
10027+
createdAt:
10028+
type: string
10029+
format: date-time
10030+
title: Createdat
10031+
modifiedAt:
10032+
type: string
10033+
format: date-time
10034+
title: Modifiedat
10035+
type: object
10036+
required:
10037+
- licenseGoodId
10038+
- name
10039+
- licenseResourceType
10040+
- pricingPlanId
10041+
- createdAt
10042+
- modifiedAt
10043+
title: LicenseGoodGet
10044+
LicenseGoodsBodyParams:
10045+
properties:
10046+
wallet_id:
10047+
type: integer
10048+
exclusiveMinimum: true
10049+
title: Wallet Id
10050+
minimum: 0
10051+
num_of_seeds:
10052+
type: integer
10053+
title: Num Of Seeds
10054+
additionalProperties: false
10055+
type: object
10056+
required:
10057+
- wallet_id
10058+
- num_of_seeds
10059+
title: LicenseGoodsBodyParams
10060+
LicenseResourceType:
10061+
type: string
10062+
enum:
10063+
- VIP_MODEL
10064+
const: VIP_MODEL
10065+
title: LicenseResourceType
988110066
Limits:
988210067
properties:
988310068
cpus:

0 commit comments

Comments
 (0)