-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[issues#976] Fix
api.qute
condition to include jakarta constraint a…
…nnotations to all endpoint parameters (#978) * [issues#964] Fix beanValidationCore.qute condition to include the jakarta.validation.Valid annotation * [issues#976] Fix api.qute condition to include constraint annotations to all endpoint params
- Loading branch information
1 parent
fedd161
commit 2eabcb2
Showing
6 changed files
with
126 additions
and
6 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
1 change: 1 addition & 0 deletions
1
...loyment/src/main/resources/templates/libraries/microprofile/beanValidationInlineCore.qute
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 @@ | ||
{#if p.required}@jakarta.validation.constraints.NotNull {/if}{#if p.pattern}@jakarta.validation.constraints.Pattern(regexp = "{p.pattern}") {/if}{#if p.minLength || p.minItems}@jakarta.validation.constraints.Size(min = {p.minLength}{p.minItems}) {/if}{#if p.maxLength || p.maxItems}@jakarta.validation.constraints.Size(max = {p.maxLength}{p.maxItems}) {/if}{#if p.isInteger}{#if p.minimum}@jakarta.validation.constraints.Min({p.minimum}) {/if}{#if p.maximum}@jakarta.validation.constraints.Max({p.maximum}) {/if}{/if}{#if p.isLong}{#if p.minimum}@jakarta.validation.constraints.Min({p.minimum}L) {/if}{#if p.maximum}@jakarta.validation.constraints.Max({p.maximum}L) {/if}{/if}{#if !p.isInteger && !p.isLong}{#if p.minimum}@jakarta.validation.constraints.DecimalMin("{p.minimum}") {/if}{#if p.maximum}@jakarta.validation.constraints.DecimalMax("{p.maximum}") {/if}{/if}{#if use-bean-validation}@jakarta.validation.Valid {/if} |
80 changes: 80 additions & 0 deletions
80
client/integration-tests/bean-validation/src/main/openapi/issue-976.yaml
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,80 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: Test API | ||
version: "1.0" | ||
paths: | ||
/{pathParam}: | ||
post: | ||
tags: | ||
- ValidatedEndpointIssue976 | ||
operationId: test | ||
parameters: | ||
- name: queryParam | ||
in: query | ||
schema: | ||
$ref: '#/components/schemas/ValidatedObjectIssue976' | ||
- name: pathParam | ||
in: path | ||
description: pathParam description | ||
required: true | ||
schema: | ||
type: string | ||
maxLength: 14 | ||
minLength: 14 | ||
pattern: '^[0-9]{14}$' | ||
example: '19318085994179' | ||
- name: headerParam | ||
in: header | ||
description: 'Header description' | ||
required: false | ||
schema: | ||
maxLength: 32 | ||
minLength: 32 | ||
pattern: '^[a-z0-9]{32}$' | ||
type: string | ||
example: 3cfdad6e03c24d0ab7112dce75cdba35 | ||
- name: cookieParam | ||
in: cookie | ||
required: true | ||
schema: | ||
type: string | ||
minLength: 10 | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ValidatedObjectIssue976' | ||
responses: | ||
"200": | ||
description: OK | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
components: | ||
schemas: | ||
ValidatedObjectIssue976: | ||
type: object | ||
description: Some object to be validated | ||
required: | ||
- id | ||
- name | ||
- secondName | ||
- size | ||
properties: | ||
id: | ||
type: integer | ||
minimum: 1 | ||
maximum: 100 | ||
name: | ||
type: string | ||
pattern: "[a-zA-Z]*" | ||
minLength: 1 | ||
maxLength: 10 | ||
secondName: | ||
type: string | ||
size: | ||
type: number | ||
minimum: 1.0 | ||
maximum: 10.0 |
1 change: 1 addition & 0 deletions
1
client/integration-tests/bean-validation/src/main/resources/application.properties
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,3 +1,4 @@ | ||
quarkus.openapi-generator.codegen.spec.bean_validation_true_yaml.use-bean-validation = true | ||
quarkus.openapi-generator.codegen.spec.issue_976_yaml.use-bean-validation = true | ||
quarkus.openapi-generator.codegen.spec.bean_validation_false_yaml.use-bean-validation = false | ||
quarkus.keycloak.devservices.enabled=false |
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