-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #623 from Backbase/patternValidation
Add validation on request params and map types
- Loading branch information
Showing
11 changed files
with
323 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 20 additions & 1 deletion
21
boat-scaffold/src/main/templates/boat-spring/collectionDataType.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
{{#openApiNullable}}{{#isNullable}}JsonNullable<{{/isNullable}}{{/openApiNullable}}{{{baseType}}}<{{#items}}{{#isPrimitiveType}}{{>beanValidationCore}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{/isPrimitiveType}}{{/items}}{{{items.datatypeWithEnum}}}>{{#openApiNullable}}{{#isNullable}}>{{/isNullable}}{{/openApiNullable}} | ||
{{#openApiNullable}} | ||
{{#isNullable}}JsonNullable<{{/isNullable}} | ||
{{/openApiNullable}} | ||
{{! apply collection type e.g. Set, List }} | ||
{{{baseType}}}< | ||
{{#useBeanValidation}} | ||
{{#items}} | ||
{{#isPrimitiveType}} | ||
{{>beanValidationCore}} | ||
{{/isPrimitiveType}} | ||
{{^isPrimitiveType}} | ||
@Valid | ||
{{/isPrimitiveType}} | ||
{{/items}} | ||
{{/useBeanValidation}} | ||
{{! apply collection item type }} | ||
{{{items.datatypeWithEnum}}}> | ||
{{#openApiNullable}} | ||
{{#isNullable}}>{{/isNullable}} | ||
{{/openApiNullable}} |
23 changes: 23 additions & 0 deletions
23
boat-scaffold/src/main/templates/boat-spring/collectionDataTypeParam.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{#isArray}} | ||
{{#useBeanValidation}} | ||
{{#uniqueItems}}java.util.Set{{/uniqueItems}} | ||
{{^uniqueItems}}java.util.List{{/uniqueItems}}< | ||
{{#items}} | ||
{{#isPrimitiveType}} | ||
{{>beanValidationCore}} | ||
{{/isPrimitiveType}} | ||
{{^isPrimitiveType}} | ||
@Valid | ||
{{/isPrimitiveType}} | ||
{{/items}} | ||
{{{items.datatypeWithEnum}}}> | ||
{{/useBeanValidation}} | ||
{{^useBeanValidation}} | ||
{{#uniqueItems}}java.util.Set{{/uniqueItems}} | ||
{{^uniqueItems}}java.util.List{{/uniqueItems}} | ||
<{{{dataType}}}> | ||
{{/useBeanValidation}} | ||
{{/isArray}} | ||
{{^isArray}} | ||
{{{dataType}}} | ||
{{/isArray}} |
21 changes: 21 additions & 0 deletions
21
boat-scaffold/src/main/templates/boat-spring/mapDataType.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{#openApiNullable}} | ||
{{#isNullable}}JsonNullable<{{/isNullable}} | ||
{{/openApiNullable}} | ||
{{! apply map type with String as key type }} | ||
{{{baseType}}}<String, | ||
{{! apply validation on map values }} | ||
{{#useBeanValidation}} | ||
{{#items}} | ||
{{#isPrimitiveType}} | ||
{{>beanValidationCore}} | ||
{{/isPrimitiveType}} | ||
{{^isPrimitiveType}} | ||
@Valid | ||
{{/isPrimitiveType}} | ||
{{/items}} | ||
{{/useBeanValidation}} | ||
{{! apply map value type with closing bracket }} | ||
{{{items.datatypeWithEnum}}}> | ||
{{#openApiNullable}} | ||
{{#isNullable}}>{{/isNullable}} | ||
{{/openApiNullable}} |
14 changes: 13 additions & 1 deletion
14
boat-scaffold/src/main/templates/boat-spring/optionalDataType.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
{{#useOptional}}{{#required}}{{{dataType}}}{{/required}}{{^required}}Optional<{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{{dataType}}}>{{/required}}{{/useOptional}}{{^useOptional}}{{{dataType}}}{{/useOptional}} | ||
{{#toOneLine}} | ||
{{#useOptional}} | ||
{{#required}} | ||
{{>collectionDataTypeParam}} | ||
{{/required}} | ||
{{^required}} | ||
Optional<{{>collectionDataTypeParam}}> | ||
{{/required}} | ||
{{/useOptional}} | ||
{{^useOptional}} | ||
{{>collectionDataTypeParam}} | ||
{{/useOptional}} | ||
{{/toOneLine}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.