Skip to content

Commit

Permalink
Fix wrong usage of fastapi endpoint docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jotare committed May 6, 2024
1 parent 396eb14 commit 9e3d22d
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 117 deletions.
16 changes: 8 additions & 8 deletions nucliadb/nucliadb/reader/api/v1/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DownloadType(Enum):
f"/{KB_PREFIX}/{{kbid}}/{RSLUG_PREFIX}/{{rslug}}/{{field_type}}/{{field_id}}/download/extracted/{{download_field:path}}", # noqa
tags=["Resource fields"],
status_code=200,
name="Download extracted binary file (by slug)",
summary="Download extracted binary file (by slug)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand All @@ -71,7 +71,7 @@ async def download_extract_file_rslug_prefix(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}/{{field_type}}/{{field_id}}/download/extracted/{{download_field:path}}", # noqa
tags=["Resource fields"],
status_code=200,
name="Download extracted binary file (by id)",
summary="Download extracted binary file (by id)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand Down Expand Up @@ -113,7 +113,7 @@ async def _download_extract_file(
f"/{KB_PREFIX}/{{kbid}}/{RSLUG_PREFIX}/{{rslug}}/file/{{field_id}}/download/field",
tags=["Resource fields"],
status_code=200,
name="Download field binary field (by slug)",
summary="Download field binary field (by slug)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand All @@ -133,7 +133,7 @@ async def download_field_file_rslug_prefix(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}/file/{{field_id}}/download/field",
tags=["Resource fields"],
status_code=200,
name="Download field binary field (by id)",
summary="Download field binary field (by id)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand Down Expand Up @@ -168,7 +168,7 @@ async def _download_field_file(
f"/{KB_PREFIX}/{{kbid}}/{RSLUG_PREFIX}/{{rslug}}/layout/{{field_id}}/download/field/{{download_field}}",
tags=["Resource fields"],
status_code=200,
name="Download layout binary field (by slug)",
summary="Download layout binary field (by slug)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand All @@ -188,7 +188,7 @@ async def download_field_layout_rslug_prefix(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}/layout/{{field_id}}/download/field/{{download_field}}",
tags=["Resource fields"],
status_code=200,
name="Download layout binary field (by id)",
summary="Download layout binary field (by id)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand Down Expand Up @@ -225,7 +225,7 @@ async def _download_field_layout(
f"/{KB_PREFIX}/{{kbid}}/{RSLUG_PREFIX}/{{rslug}}/conversation/{{field_id}}/download/field/{{message_id}}/{{file_num}}", # noqa
tags=["Resource fields"],
status_code=200,
name="Download conversation binary field (by slug)",
summary="Download conversation binary field (by slug)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand All @@ -246,7 +246,7 @@ async def download_field_conversation_rslug_prefix(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}/conversation/{{field_id}}/download/field/{{message_id}}/{{file_num}}", # noqa
tags=["Resource fields"],
status_code=200,
name="Download conversation binary field (by id)",
summary="Download conversation binary field (by id)",
)
@requires_one([NucliaDBRoles.READER])
@version(1)
Expand Down
6 changes: 3 additions & 3 deletions nucliadb/nucliadb/reader/api/v1/export_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@api.get(
f"/{KB_PREFIX}/{{kbid}}/export/{{export_id}}",
status_code=200,
name="Download a Knowledge Box export",
summary="Download a Knowledge Box export",
tags=["Knowledge Boxes"],
response_class=StreamingResponse,
)
Expand Down Expand Up @@ -100,7 +100,7 @@ async def download_export_and_delete(
@api.get(
f"/{KB_PREFIX}/{{kbid}}/export/{{export_id}}/status",
status_code=200,
name="Get the status of a Knowledge Box Export",
summary="Get the status of a Knowledge Box Export",
response_model=StatusResponse,
tags=["Knowledge Boxes"],
)
Expand All @@ -119,7 +119,7 @@ async def get_export_status_endpoint(
@api.get(
f"/{KB_PREFIX}/{{kbid}}/import/{{import_id}}/status",
status_code=200,
name="Get the status of a Knowledge Box Import",
summary="Get the status of a Knowledge Box Import",
response_model=StatusResponse,
tags=["Knowledge Boxes"],
)
Expand Down
6 changes: 3 additions & 3 deletions nucliadb/nucliadb/reader/api/v1/knowledgebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@api.get(
f"/{KBS_PREFIX}",
status_code=200,
name="List Knowledge Boxes",
summary="List Knowledge Boxes",
response_model=KnowledgeBoxList,
tags=["Knowledge Boxes"],
include_in_schema=False,
Expand All @@ -56,7 +56,7 @@ async def get_kbs(request: Request, prefix: str = "") -> KnowledgeBoxList:
@api.get(
f"/{KB_PREFIX}/{{kbid}}",
status_code=200,
name="Get Knowledge Box",
summary="Get Knowledge Box",
response_model=KnowledgeBoxObj,
tags=["Knowledge Boxes"],
)
Expand All @@ -79,7 +79,7 @@ async def get_kb(request: Request, kbid: str) -> KnowledgeBoxObj:
@api.get(
f"/{KB_PREFIX}/s/{{slug}}",
status_code=200,
name="Get Knowledge Box (by slug)",
summary="Get Knowledge Box (by slug)",
response_model=KnowledgeBoxObj,
tags=["Knowledge Boxes"],
)
Expand Down
4 changes: 2 additions & 2 deletions nucliadb/nucliadb/reader/api/v1/learning_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/feedback/{{month}}",
status_code=200,
name="Download feedback of a Knowledge Box",
summary="Download feedback of a Knowledge Box",
description="Download the feedback of a particular month in a Knowledge Box", # noqa
response_model=None,
tags=["Knowledge Boxes"],
Expand All @@ -49,7 +49,7 @@ async def feedback_download(
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/feedback",
status_code=200,
name="Feedback avalaible months",
summary="Feedback avalaible months",
description="List of months within the last year with feedback data",
response_model=None,
tags=["Knowledge Boxes"],
Expand Down
12 changes: 6 additions & 6 deletions nucliadb/nucliadb/reader/api/v1/learning_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/models/{{model_id}}/{{filename:path}}",
status_code=200,
name="Download the Knowledege Box model",
summary="Download the Knowledege Box model",
description="Download the trained model or any other generated file as a result of a training task on a Knowledge Box.", # noqa
response_model=None,
tags=["Models"],
Expand All @@ -52,7 +52,7 @@ async def download_model(
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/configuration",
status_code=200,
name="Get Knowledge Box models configuration",
summary="Get Knowledge Box models configuration",
description="Current configuration of models assigned to a Knowledge Box",
response_model=None,
tags=["Models"],
Expand All @@ -74,7 +74,7 @@ async def get_configuration(
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/models",
status_code=200,
name="Get available models",
summary="Get available models",
description="Get available models",
response_model=None,
tags=["Models"],
Expand All @@ -91,7 +91,7 @@ async def get_models(
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/model/{{model_id}}",
status_code=200,
name="Get model metadata",
summary="Get model metadata",
description="Get metadata for a particular model",
response_model=None,
tags=["Models"],
Expand All @@ -114,7 +114,7 @@ async def get_model(
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/schema",
status_code=200,
name="Learning configuration schema",
summary="Learning configuration schema",
description="Get jsonschema definition to update the `learning_configuration` of your Knowledge Box",
response_model=None,
tags=["Models"],
Expand All @@ -131,7 +131,7 @@ async def get_schema_for_configuration_updates(
@api.get(
path=f"/nua/schema",
status_code=200,
name="Learning configuration schema for Knowledge Box creation",
summary="Learning configuration schema for Knowledge Box creation",
description="Get jsonschema definition for `learning_configuration` field for the Knowledge Box creation payload",
response_model=None,
tags=["Models"],
Expand Down
8 changes: 4 additions & 4 deletions nucliadb/nucliadb/reader/api/v1/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async def list_resources(
@api.get(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}",
status_code=200,
name="Get Resource (by id)",
summary="Get Resource (by id)",
response_model=Resource,
response_model_exclude_unset=True,
tags=["Resources"],
Expand Down Expand Up @@ -181,7 +181,7 @@ async def get_resource_by_uuid(
@api.get(
f"/{KB_PREFIX}/{{kbid}}/{RSLUG_PREFIX}/{{rslug}}",
status_code=200,
name="Get Resource (by slug)",
summary="Get Resource (by slug)",
response_model=Resource,
response_model_exclude_unset=True,
tags=["Resources"],
Expand Down Expand Up @@ -254,7 +254,7 @@ async def _get_resource(
@api.get(
f"/{KB_PREFIX}/{{kbid}}/{RSLUG_PREFIX}/{{rslug}}/{{field_type}}/{{field_id}}",
status_code=200,
name="Get Resource field (by slug)",
summary="Get Resource field (by slug)",
response_model=ResourceField,
response_model_exclude_unset=True,
tags=["Resource fields"],
Expand Down Expand Up @@ -294,7 +294,7 @@ async def get_resource_field_rslug_prefix(
@api.get(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}/{{field_type}}/{{field_id}}",
status_code=200,
name="Get Resource field (by id)",
summary="Get Resource field (by id)",
response_model=ResourceField,
response_model_exclude_unset=True,
tags=["Resource fields"],
Expand Down
14 changes: 7 additions & 7 deletions nucliadb/nucliadb/reader/api/v1/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
@api.get(
f"/{KB_PREFIX}/{{kbid}}/entitiesgroups",
status_code=200,
name="Get Knowledge Box Entities",
summary="Get Knowledge Box Entities",
response_model=KnowledgeBoxEntities,
tags=["Knowledge Box Services"],
)
Expand Down Expand Up @@ -108,7 +108,7 @@ async def list_entities_groups(kbid: str):
@api.get(
f"/{KB_PREFIX}/{{kbid}}/entitiesgroup/{{group}}",
status_code=200,
name="Get a Knowledge Box Entities Group",
summary="Get a Knowledge Box Entities Group",
response_model=EntitiesGroup,
tags=["Knowledge Box Services"],
)
Expand Down Expand Up @@ -141,7 +141,7 @@ async def get_entity(request: Request, kbid: str, group: str) -> EntitiesGroup:
@api.get(
f"/{KB_PREFIX}/{{kbid}}/labelsets",
status_code=200,
name="Get Knowledge Box Label Sets",
summary="Get Knowledge Box Label Sets",
response_model=KnowledgeBoxLabels,
tags=["Knowledge Box Services"],
)
Expand Down Expand Up @@ -176,7 +176,7 @@ async def get_labelsets(request: Request, kbid: str) -> KnowledgeBoxLabels:
@api.get(
f"/{KB_PREFIX}/{{kbid}}/labelset/{{labelset}}",
status_code=200,
name="Get a Knowledge Box Label Set",
summary="Get a Knowledge Box Label Set",
response_model=LabelSet,
tags=["Knowledge Box Services"],
)
Expand Down Expand Up @@ -209,7 +209,7 @@ async def get_labelset(request: Request, kbid: str, labelset: str) -> LabelSet:
@api.get(
f"/{KB_PREFIX}/{{kbid}}/custom-synonyms",
status_code=200,
name="Get Knowledge Box Custom Synonyms",
summary="Get Knowledge Box Custom Synonyms",
tags=["Knowledge Box Services"],
response_model=KnowledgeBoxSynonyms,
openapi_extra={"x-operation_order": 2},
Expand All @@ -233,7 +233,7 @@ async def get_custom_synonyms(request: Request, kbid: str):
@api.get(
f"/{KB_PREFIX}/{{kbid}}/notifications",
status_code=200,
name="Knowledge Box Notifications Stream",
summary="Knowledge Box Notifications Stream",
description="Provides a stream of activity notifications for the given Knowledge Box. The stream will be automatically closed after 2 minutes.", # noqa: E501
tags=["Knowledge Box Services"],
response_description="Each line of the response is a Base64-encoded JSON object representing a notification. Refer to [the internal documentation](https://github.com/nuclia/nucliadb/blob/main/docs/tutorials/KB_NOTIFICATIONS.md) for a more detailed explanation of each notification type.", # noqa: E501
Expand Down Expand Up @@ -273,7 +273,7 @@ async def exists_kb(kbid: str) -> bool:
@api.get(
f"/{KB_PREFIX}/{{kbid}}/processing-status",
status_code=200,
name="Knowledge Box Processing Status",
summary="Knowledge Box Processing Status",
description="Provides the status of the processing of the given Knowledge Box.",
tags=["Knowledge Box Services"],
response_model=processing.RequestsResults,
Expand Down
1 change: 0 additions & 1 deletion nucliadb/nucliadb/search/api/v1/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class SyncChatResponse(pydantic.BaseModel):
@api.post(
f"/{KB_PREFIX}/{{kbid}}/chat",
status_code=200,
name="Chat Knowledge Box",
summary="Chat on a Knowledge Box",
description="Chat on a Knowledge Box",
tags=["Search"],
Expand Down
2 changes: 1 addition & 1 deletion nucliadb/nucliadb/search/api/v1/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@api.post(
f"/{KB_PREFIX}/{{kbid}}/feedback",
status_code=200,
name="Send Feedback",
summary="Send Feedback",
description="Send feedback for a search operation in a Knowledge Box",
tags=["Search"],
)
Expand Down
4 changes: 2 additions & 2 deletions nucliadb/nucliadb/search/api/v1/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
@api.get(
f"/{KB_PREFIX}/{{kbid}}/find",
status_code=200,
name="Find Knowledge Box",
summary="Find Knowledge Box",
description="Find on a Knowledge Box",
response_model=KnowledgeboxFindResults,
response_model_exclude_unset=True,
Expand Down Expand Up @@ -170,7 +170,7 @@ async def find_knowledgebox(
@api.post(
f"/{KB_PREFIX}/{{kbid}}/find",
status_code=200,
name="Find Knowledge Box",
summary="Find Knowledge Box",
description="Find on a Knowledge Box",
response_model=KnowledgeboxFindResults,
response_model_exclude_unset=True,
Expand Down
4 changes: 2 additions & 2 deletions nucliadb/nucliadb/search/api/v1/predict_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
@api.get(
path=f"/{KB_PREFIX}/{{kbid}}/predict/{{endpoint}}",
status_code=200,
name="Predict API Proxy",
summary="Predict API Proxy",
description=DESCRIPTION,
response_model=None,
tags=["Search"],
)
@api.post(
path=f"/{KB_PREFIX}/{{kbid}}/predict/{{endpoint}}",
status_code=200,
name="Predict API Proxy",
summary="Predict API Proxy",
description=DESCRIPTION,
response_model=None,
tags=["Search"],
Expand Down
1 change: 0 additions & 1 deletion nucliadb/nucliadb/search/api/v1/resource/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
@api.post(
f"/{KB_PREFIX}/{{kbid}}/resource/{{rid}}/ask",
status_code=200,
name="Ask a Resource",
summary="Ask a question to a resource",
description="Ask to the complete content of the resource",
tags=["Search"],
Expand Down
6 changes: 2 additions & 4 deletions nucliadb/nucliadb/search/api/v1/resource/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
@api.post(
f"/{KB_PREFIX}/{{kbid}}/resource/{{rid}}/chat",
status_code=200,
name="Chat with a Resource (by id)",
summary="Chat with a resource",
summary="Chat with a resource (by id)",
description="Chat with a resource",
tags=["Search"],
response_model=None,
Expand Down Expand Up @@ -79,8 +78,7 @@ async def resource_chat_endpoint_by_uuid(
@api.post(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_SLUG_PREFIX}/{{slug}}/chat",
status_code=200,
name="Chat with a Resource (by slug)",
summary="Chat with a resource",
summary="Chat with a resource (by slug)",
description="Chat with a resource",
tags=["Search"],
response_model=None,
Expand Down
4 changes: 2 additions & 2 deletions nucliadb/nucliadb/search/api/v1/resource/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
@api.get(
f"/{KB_PREFIX}/{{kbid}}/{RESOURCE_PREFIX}/{{rid}}/search",
status_code=200,
name="Search on Resource",
description="Search on a Resource",
summary="Search on Resource",
description="Search on a single resource",
tags=["Search"],
response_model_exclude_unset=True,
response_model=ResourceSearchResults,
Expand Down
Loading

0 comments on commit 9e3d22d

Please sign in to comment.