Skip to content

Commit

Permalink
Merge pull request #265 from swagger-api/add_validation_issue_8772
Browse files Browse the repository at this point in the history
add validation extension
  • Loading branch information
HugoMario authored Dec 18, 2018
2 parents 3e35161 + d52384b commit 6425283
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import java.util.Map;

import static io.swagger.codegen.v3.CodegenConstants.HAS_VALIDATION_EXT_NAME;

public class OpenAPIUtil {

private OpenAPI openAPI;
Expand All @@ -27,6 +29,9 @@ public void addPropertiesFromRef(Schema refSchema, CodegenProperty codegenProper
codegenProperty.pattern = schema.getPattern();
codegenProperty.minLength = schema.getMinLength();
codegenProperty.maxLength = schema.getMaxLength();
if (codegenProperty.pattern != null || codegenProperty.minLength != null || codegenProperty.maxLength != null) {
codegenProperty.getVendorExtensions().put(HAS_VALIDATION_EXT_NAME, Boolean.TRUE);
}
}

public static String getSimpleRef(String ref) {
Expand Down

0 comments on commit 6425283

Please sign in to comment.