Skip to content

fix(#2364): Add support for passing parameters to @ApiOperation #2365

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

Merged
merged 2 commits into from
Aug 11, 2025

Conversation

spamshaker
Copy link
Contributor

@spamshaker spamshaker commented Jun 29, 2025

This commit introduces the ability to pass parameters directly to the @apioperation decorator, allowing developers to define path parameters within the decorator itself. This simplifies OpenAPI schema generation and improves developer experience by reducing boilerplate code.

Changes include:

  • Added parameters option to ApiOperationOptions type
  • Updated OperationMetadata to include parameters property
  • Modified @apioperation decorator to accept and store parameter metadata
  • Added tests to verify parameter handling

This change aligns with common usage patterns for OpenAPI specifications and provides a more intuitive way to define API operations with required parameters.

Changes

closes #2364

How to Review

How can a reviewer review your changes? What should be kept in mind for this review?

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

…tion

This commit introduces the ability to pass parameters directly to the @apioperation decorator, allowing developers to define path parameters within the decorator itself. This simplifies OpenAPI schema generation and improves developer experience by reducing boilerplate code.

Changes include:
- Added `parameters` option to ApiOperationOptions type
- Updated OperationMetadata to include parameters property
- Modified @apioperation decorator to accept and store parameter metadata
- Added tests to verify parameter handling

This change aligns with common usage patterns for OpenAPI specifications and provides a more intuitive way to define API operations with required parameters.

#closes openapi-ts#2364
@spamshaker spamshaker requested a review from a team as a code owner June 29, 2025 15:48
@spamshaker spamshaker requested a review from duncanbeevers June 29, 2025 15:48
Copy link

netlify bot commented Jun 29, 2025

Deploy Preview for openapi-ts ready!

Name Link
🔨 Latest commit 3539d83
🔍 Latest deploy log https://app.netlify.com/projects/openapi-ts/deploys/6861614dc82a79000800f14b
😎 Deploy Preview https://deploy-preview-2365--openapi-ts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

changeset-bot bot commented Jun 29, 2025

🦋 Changeset detected

Latest commit: 3539d83

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-metadata Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This commit fixes issue openapi-ts#2364 by enabling developers to specify parameters directly within the @apioperation decorator. This streamlines OpenAPI schema generation and improves developer experience with a more concise syntax for defining API operations that require specific input parameters.
Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition, and good tests! Thank you!

@drwpow drwpow merged commit b419aee into openapi-ts:main Aug 11, 2025
11 checks passed
@openapi-ts-bot openapi-ts-bot mentioned this pull request Aug 11, 2025
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.

Parameters storage is not fulfilled by parameters provided in ApiOperation
2 participants