Skip to content

Commit

Permalink
updates OAS
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Jul 11, 2023
1 parent 27e566d commit e174d79
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 1 deletion.
79 changes: 79 additions & 0 deletions api/specs/webserver/openapi-announcements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
paths:
/announcements:
get:
tags:
- announcements
summary: List Announcements
operationId: list_announcements
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Envelope_list_simcore_service_webserver.announcements._models.Announcement__'
components:
schemas:
Announcement:
properties:
id:
type: string
title: Id
products:
items:
type: string
enum:
- osparc
- s4l
- s4llite
- tis
type: array
title: Products
start:
type: string
format: date-time
title: Start
end:
type: string
format: date-time
title: End
title:
type: string
title: Title
description:
type: string
title: Description
link:
type: string
title: Link
widgets:
items:
type: string
enum:
- login
- ribbon
- user-menu
type: array
title: Widgets
type: object
required:
- id
- products
- start
- end
- title
- description
- link
- widgets
title: Announcement
Envelope_list_simcore_service_webserver.announcements._models.Announcement__:
properties:
data:
items:
$ref: '#/components/schemas/Announcement'
type: array
title: Data
error:
title: Error
type: object
title: Envelope[list[simcore_service_webserver.announcements._models.Announcement]]
4 changes: 4 additions & 0 deletions api/specs/webserver/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ paths:
/email:test:
$ref: "./openapi-admin.yaml#/paths/~1email:test"

# ANNOUNCEMENTS ---------------------------------------------------------
/announcements:
$ref: "./openapi-announcements.yaml#/paths/~1announcements"

# DIAGNOSTICS ---------------------------------------------------------
/:
$ref: "./openapi-diagnostics.yaml#/paths/~1"
Expand Down
36 changes: 36 additions & 0 deletions api/specs/webserver/scripts/openapi_announcements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
""" Helper script to generate OAS automatically
"""

# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments


from enum import Enum

from fastapi import FastAPI
from models_library.generics import Envelope
from simcore_service_webserver.announcements._handlers import Announcement

app = FastAPI(redoc_url=None)

TAGS: list[str | Enum] = [
"announcements",
]


@app.get(
"/announcements",
response_model=Envelope[list[Announcement]],
tags=TAGS,
operation_id="list_announcements",
)
async def list_announcements():
...


if __name__ == "__main__":
from _common import CURRENT_DIR, create_openapi_specs

create_openapi_specs(app, CURRENT_DIR.parent / "openapi-announcements.yaml")
2 changes: 1 addition & 1 deletion api/specs/webserver/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Extra reqs, besides webserver's

fastapi
fastapi<0.100
jsonref

0 comments on commit e174d79

Please sign in to comment.