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
Consider minLength, maxLength and pattern in referenced schema #45
Conversation
@FatCash: I wanted to give my fix a try on a real use case. Which generator are you using? Where do you expect the annotation to be present? |
I have tested it with OAS3:
With OAS2 there is a parser issue:
I have filed swagger-api/swagger-parser#708 for this parser issue. |
There is an other issue with the pattern. The parser does not read the value with OAS2 and OAS3. see swagger-api/swagger-parser#709 |
Hi, thank you for looking into this issue! Tried with the latest openapi-generator with petstore OAS3 and OAS2. Got mixed results: |
Reverts: Consider minLength, maxLength and pattern in referenced schema (OpenAPITools#45) This reverts commit 6b80798.
@FatCash: Thank you for your feedback.
My change produce too many side effects, I needed to revert it with #82. Sorry about it. |
Well... Now that the swagger-parser issues are fixed (swagger-api/swagger-parser#708 and swagger-api/swagger-parser#709) we need to integrate them. See discussion in #123. But since I have reverted the changes, there is in parallel also work to do in the "OpenAPI Generator" project. In order to solve the case correctly we need #83 as prerequisite. Then we can solve your case and uncomment the corresponding tests: Lines 944 to 948 in 9040f49
I did not forget you ;-) |
When they are defined in a in referenced schema Originally introduced with OpenAPITools#45, reverted with OpenAPITools#82
Thank to the changes made by @wing328 on branch The Unit-Test that were developed in this PR are restored with PR #401. @FatCash: maybe you can give |
Sorry been on vacation. Thank you very much for fixing this issue! |
@FatCash thank you a lot for the feedback. |
Could you close this issue since your fix addresses it: |
@FatCash: this project is a fork of swagger-api/swagger-codegen due to some disagreements with:
Swagger-Codegen-v3 and OpenAPI-Generator are both based on Swagger-Codegen-v2, but they now live separately. I never got permission to triage issues in Swagger-Codegen so there is nothing I can do there. |
Okay, I see. |
Some cleanup of properties in docs, pom template and generator
Reported by @FatCash on swagger-api/swagger-codegen#8001
OAS2 example:
The solution proposed here is really temporary. When we will work on #20, I think that a lot of the methods in
DefaultCodegen
will be refactored. For example the OpenAPI instance will be propagated everywhere instead ofMap<String, Schema>
. This way we can useModelUtils
to resolve referenced Schema consistently.