OpenAPITools / OpenAPITools/openapi-generator
cannot import remap annotations since they use wildcard import
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? - Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I had the glorious idea recently to attempt "typed Strings" (an extendable delegate class that just holds one string) - gave it a custom jsonde/serializer so it also works with requests
unfortunately when i try to use it the openapi generator the generator create an @Pattern annotation without a specific import so i cant remap it to my own and that by default only works with String.class
alternatively:
remap via typeMapping (Pattern=my.own.Pattern) also didnt get applied
if im just missing a property to remap annotations that would also be helpful 😅
expected:
import javax.validation.constraints.Pattern;
import javax.validation.constraints.NotNull;
...
actual:
import javax.validation.constraints.*;
openapi-generator version
6.3.0
Steps to reproduce
spec file with pattern
Related issues/PRs
Suggest a fix
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 by reproducing the Java generation case with an OpenAPI spec containing a pattern constraint, then trace how validation annotation imports are collected. Done means the generated output uses explicit imports such as Pattern and NotNull instead of a wildcard, and the reported annotation remapping behavior is addressed or clearly characterized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100