cnizzardini / cakephp-swagger-bake

Automatically generate OpenAPI, Swagger, and Redoc documentation from your existing CakePHP code.
http://cakephpswaggerbake.cnizz.com/
MIT License
60 stars 20 forks source link

Unable to set operationId using the OpenApiOperation annotation. #556

Open marcdebus opened 1 month ago

marcdebus commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

No, but I'll try that. Thanks.

marcdebus commented 1 month ago

It works, thank you!

cnizzardini commented 1 month ago

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

cnizzardini commented 1 month ago

What version of the library are you using?

marcdebus commented 1 month ago

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.