- Create a new or modify YAML OpenAPI spec for Label Studio endpoints.
For example,
./fern/openapi/resources/comments.yaml
:paths: /api/comments: get: ... post: ... components: schemas: Comments: ... requestBodies: api_comments_create: ...
paths
: contain API pathcomponents
(optional): components to reuse inresponses
requestBodies
(optional): request bodies specification to reuse in requests’requestBody
- Add
$ref
references inoverrides.yaml
:this will define the public methods calledpaths: /api/comments/: get: $ref: "./resources/comments.yaml#/paths/~1api~1comments/get" x-fern-sdk-group-name: comments x-fern-sdk-method-name: list x-fern-audiences: - public post: $ref: "./resources/comments.yaml#/paths/~1api~1comments/post" x-fern-sdk-group-name: comments x-fern-sdk-method-name: create x-fern-audiences: - public
client.comments.list()
andclient.comments.create()
. Read more about Fern's OpenAPI extensions - Create a PR in
label-studio-client-generator
using Follow-Merge workflow. For example, push a branch calledfb-PRJ-123-update-comments-api
- Ensure PR is created in
label-studio-sdk
and Label Studio repo - Update added endpoints in Django code.
- Add integration tests with newly added functions in LS:
https://github.com/HumanSignal/label-studio/tree/develop/label_studio/tests/sdk
swagger2openapi --yaml --outfile ./fern/openapi/openapi.yaml http://localhost:8080/docs/api?format=openapi
fern generate --docs
fern docs dev
Go to fern/openapi/overrides.yaml
and modify fields keeping the structure as in fern/openapi/openapi.yaml
. For example
paths:
/api/projects/:
post:
summary: List of Projects
-->
paths:
/api/projects/:
post:
summary: A new title to be replaced
get:
description: and another update in description `/get` endpoint.