Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RND-72: Add vendor extensions support in openapi autoschema #5908

Merged
merged 3 commits into from
May 22, 2024

Conversation

niklub
Copy link
Collaborator

@niklub niklub commented May 21, 2024

drf-yasg default SwaggerAutoSchema doesn’t provide a way to include custom extensions in the generated openapi.json.

For example, we need to produce the following path to be able to use idiomatic method naming with fern

paths:
  "/api/annotations/{id}/":
    get:
      x-fern-sdk-group-name: annotations
      x-fern-sdk-method-name: get
      operationId: api_annotations_read
      summary: Get annotation by its ID
      description: Retrieve a specific annotation for a task using the annotation result ID.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Annotation"
      tags:
        - Annotations

Proposed solution:

  • Extend SwaggerAutoSchema to include extra operation without modifying the names

  • Allow base settings config to specify vendor extensions prefixes

Additional changes

  • openapi 3.0 incompatible namings in some paths
  • example of using x-fern in annotations.get

@github-actions github-actions bot added the feat label May 21, 2024
Copy link

netlify bot commented May 21, 2024

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit c216587
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/664d155f2107570009ff016c

Copy link

netlify bot commented May 21, 2024

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit c216587
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/664d155f77527a0007768ffd

@niklub niklub requested a review from jombooth May 21, 2024 21:10
Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.97%. Comparing base (c7b4b98) to head (c216587).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5908      +/-   ##
===========================================
+ Coverage    75.96%   75.97%   +0.01%     
===========================================
  Files          159      160       +1     
  Lines        13385    13396      +11     
===========================================
+ Hits         10168    10178      +10     
- Misses        3217     3218       +1     
Flag Coverage Δ
pytests 75.97% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@niklub niklub merged commit f2bd1d3 into develop May 22, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants