-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Validation Contraints of $ref (JSON Reference) components are not generated #8772
Validation Contraints of $ref (JSON Reference) components are not generated #8772
Comments
Hi, I see the same problem. However, the format seems to be ignored as well. Is there anything we can do to help you resoplve this? |
thank you for your commit. but it is not working yet. if (propertySchema.get$ref() != null) {
openAPIUtil.addPropertiesFromRef(propertySchema, cp);
}
//NEED TO BE ADDED
if (cp.pattern != null || cp.minLength != null || cp.maxLength != null) {
codegenModel.getVendorExtensions().put(HAS_VALIDATION_EXT_NAME, Boolean.TRUE);
}
boolean hasRequired = getBooleanValue(codegenModel, HAS_REQUIRED_EXT_NAME) || cp. |
not working yet! |
hey @wrssmi, i just added a new PR adding the validation. can you please check this version and let me know if it works as expected? |
going to close this issue but if there is something wrong, please let me know. |
Description
When generating from an openapi 3.0.0 yaml the Validation-Contraints for Java Beans are not generated correctly if $ref ((JSON Reference) is used.
Swagger-codegen version
3.0.0
generatorName: jaxrs-spec
Swagger declaration file content or url
Command line used for generation
java -jar swagger-codegen-cli-3.0.0.jar generate -i test.yaml -l jaxrs-spec --api-package=api --model-package=model
Steps to reproduce
Execute command line above. Beside 2 java empty JavaBeans (Iban and CurrrencyCode) the AccountReferenceIban Bean looks like this:
Expected Result
iban should have: @pattern(regexp="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}")
currencyCode should have: @pattern(regexp="[A-Z]{3}")
if input.yaml looks like the following the output is correct:
java bean output:
The text was updated successfully, but these errors were encountered: