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(openapi): support components #2921

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

OskarLebuda
Copy link

@OskarLebuda OskarLebuda commented Dec 5, 2024

πŸ”— Linked issue

Fixes #2920

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Add components support for OpenAPI module.

Usage:

defineRouteMeta({
  openAPI: {
    responses: {
      200: { description: 'OK ', content: { 'application/json': { schema: { $ref: '#/components/schemas/User' } } } },
    },
    components: {
      User: {
        type: 'object',
        properties: {
          id: { type: 'integer' },
          name: { type: 'string' },
        },
      }
    },
  },
});

Result:

image

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@OskarLebuda OskarLebuda requested a review from pi0 as a code owner December 5, 2024 07:33
@OskarLebuda
Copy link
Author

@pi0 what do you think about it?

@OskarLebuda OskarLebuda changed the title openapi - add components fix(openapi): fix open api components Dec 5, 2024
@pi0 pi0 changed the title fix(openapi): fix open api components feat(openapi): support components Dec 5, 2024
@pi0
Copy link
Member

pi0 commented Dec 5, 2024

Quickly looking, seems lovely1

@OskarLebuda
Copy link
Author

Can we merge this? πŸ˜„

@OskarLebuda
Copy link
Author

@pi0 Can you merge this PR please? πŸ˜„

@pi0
Copy link
Member

pi0 commented Dec 9, 2024

Dear @OskarLebuda it still needs proper testing before merge (or further change requests). reading this might be good.

@OskarLebuda
Copy link
Author

Great! Didn't know about that! I'll check that and get back to you soon! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Components Section in OpenAPI Standard
2 participants