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

Unable to set operationId using the OpenApiOperation annotation. #556

Open
marcdebus opened this issue Sep 27, 2024 · 6 comments
Open

Unable to set operationId using the OpenApiOperation annotation. #556

marcdebus opened this issue Sep 27, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@marcdebus
Copy link

marcdebus commented Sep 27, 2024

The default output in swagger.json is generated like this:

get:
  operationId: actors:index:get
  summary: operation title
  description: a description
  tags:
    - Internal API
    - External API
  externalDocs:
    url: https://github.com/cnizzardini/cakephp-swagger-bake
    description: Check out the documentation

Using the #[OpenApiOperation(...)] attribute/annotation, you cannot set the operationId. A generation tool like NSwagStudio produces a C# class with errors, as ":" is not allowed in identifiers.

Invalid token ':' in class ....

@cnizzardini
Copy link
Owner

Interesting, as a workaround, have you tried altering the operationId's using event listeners?

https://github.com/cnizzardini/cakephp-swagger-bake/blob/master/docs/events.md

@marcdebus
Copy link
Author

No, but I'll try that. Thanks.

@marcdebus
Copy link
Author

It works, thank you!

@cnizzardini cnizzardini reopened this Sep 30, 2024
@cnizzardini
Copy link
Owner

Re-opening to determine if this should be added into the core feature set.

@cnizzardini cnizzardini added the enhancement New feature or request label Sep 30, 2024
@cnizzardini
Copy link
Owner

What version of the library are you using?

@marcdebus
Copy link
Author

I’m currently using version 2.5.9 because I’m working with CakePHP 4.x, but I plan to upgrade to version 5 soon.

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

No branches or pull requests

2 participants