OpenAPITools / OpenAPITools/openapi-generator
[QUESTION] How can I add CrossOrigin annotation to the controller generated by OpenAPI Generator?
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
How can I tell openapi generator to add this annotation to the controller definition:
@CrossOrigin(
methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE},
exposedHeaders = {
"Access-Control-Allow-Origin",
"Access-Control-Allow-Credentials"
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced sample file, samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/PetApiController.java, and inspect the OpenAPI Generator Spring Boot templates and configuration options that produce it. Determine whether the requested annotation can be configured; done means identifying a supported configuration or clearly scoping the generator change required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100