revert-upgrade-openapiprocessor-spring-back-to-2022-5 and fix bookingItem.validFrom assertion #45

Merged
hsh-michaelhoennig merged 4 commits from revert-upgrade-openapiprocessor-spring-back-to-2022-5 into master 2024-04-17 08:27:08 +02:00
6 changed files with 32 additions and 30 deletions

View File

@ -115,7 +115,7 @@ tasks.named('test') {
openapiProcessor { openapiProcessor {
springRoot { springRoot {
processorName 'spring' processorName 'spring'
processor 'io.openapiprocessor:openapi-processor-spring:2024.2' processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
apiPath "$projectDir/src/main/resources/api-definition.yaml" apiPath "$projectDir/src/main/resources/api-definition.yaml"
mapping "$projectDir/src/main/resources/api-mappings.yaml" mapping "$projectDir/src/main/resources/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax" targetDir "$buildDir/generated/sources/openapi-javax"
@ -124,7 +124,7 @@ openapiProcessor {
} }
springRbac { springRbac {
processorName 'spring' processorName 'spring'
processor 'io.openapiprocessor:openapi-processor-spring:2024.2' processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
apiPath "$projectDir/src/main/resources/api-definition/rbac/rbac.yaml" apiPath "$projectDir/src/main/resources/api-definition/rbac/rbac.yaml"
mapping "$projectDir/src/main/resources/api-definition/rbac/api-mappings.yaml" mapping "$projectDir/src/main/resources/api-definition/rbac/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax" targetDir "$buildDir/generated/sources/openapi-javax"
@ -133,7 +133,7 @@ openapiProcessor {
} }
springTest { springTest {
processorName 'spring' processorName 'spring'
processor 'io.openapiprocessor:openapi-processor-spring:2024.2' processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
apiPath "$projectDir/src/main/resources/api-definition/test/test.yaml" apiPath "$projectDir/src/main/resources/api-definition/test/test.yaml"
mapping "$projectDir/src/main/resources/api-definition/test/api-mappings.yaml" mapping "$projectDir/src/main/resources/api-definition/test/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax" targetDir "$buildDir/generated/sources/openapi-javax"
@ -142,7 +142,7 @@ openapiProcessor {
} }
springHsOffice { springHsOffice {
processorName 'spring' processorName 'spring'
processor 'io.openapiprocessor:openapi-processor-spring:2024.2' processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
apiPath "$projectDir/src/main/resources/api-definition/hs-office/hs-office.yaml" apiPath "$projectDir/src/main/resources/api-definition/hs-office/hs-office.yaml"
mapping "$projectDir/src/main/resources/api-definition/hs-office/api-mappings.yaml" mapping "$projectDir/src/main/resources/api-definition/hs-office/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax" targetDir "$buildDir/generated/sources/openapi-javax"
@ -151,7 +151,7 @@ openapiProcessor {
} }
springHsBooking { springHsBooking {
processorName 'spring' processorName 'spring'
processor 'io.openapiprocessor:openapi-processor-spring:2024.2' processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
apiPath "$projectDir/src/main/resources/api-definition/hs-booking/hs-booking.yaml" apiPath "$projectDir/src/main/resources/api-definition/hs-booking/hs-booking.yaml"
mapping "$projectDir/src/main/resources/api-definition/hs-booking/api-mappings.yaml" mapping "$projectDir/src/main/resources/api-definition/hs-booking/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax" targetDir "$buildDir/generated/sources/openapi-javax"
@ -175,6 +175,8 @@ project.tasks.compileJava.dependsOn processSpring
// Rename javax to jakarta in OpenApi generated java files because // Rename javax to jakarta in OpenApi generated java files because
// io.openapiprocessor.openapi-processor 2022.2 does not yet support the openapiprocessor useSpringBoot3 config option. // io.openapiprocessor.openapi-processor 2022.2 does not yet support the openapiprocessor useSpringBoot3 config option.
// TODO.impl: Upgrade to io.openapiprocessor.openapi-processor >= 2024.2
// and use either `bean-validation: true` in api-mapping.yaml or `useSpringBoot3 true` (not sure where exactly).
task openApiGenerate(type: Copy) { task openApiGenerate(type: Copy) {
from "$buildDir/generated/sources/openapi-javax" from "$buildDir/generated/sources/openapi-javax"
into "$buildDir/generated/sources/openapi" into "$buildDir/generated/sources/openapi"

View File

@ -5,8 +5,8 @@ get:
- testCustomers - testCustomers
operationId: listCustomers operationId: listCustomers
parameters: parameters:
- $ref: './auth.yaml#/components/parameters/currentUser' - $ref: 'auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles' - $ref: 'auth.yaml#/components/parameters/assumedRoles'
- name: prefix - name: prefix
in: query in: query
required: false required: false
@ -21,11 +21,11 @@ get:
schema: schema:
type: array type: array
items: items:
$ref: './test-customer-schemas.yaml#/components/schemas/TestCustomer' $ref: 'test-customer-schemas.yaml#/components/schemas/TestCustomer'
"401": "401":
$ref: './error-responses.yaml#/components/responses/Unauthorized' $ref: 'error-responses.yaml#/components/responses/Unauthorized'
"403": "403":
$ref: './error-responses.yaml#/components/responses/Forbidden' $ref: 'error-responses.yaml#/components/responses/Forbidden'
post: post:
summary: Adds a new customer. summary: Adds a new customer.
@ -33,13 +33,13 @@ post:
- testCustomers - testCustomers
operationId: addCustomer operationId: addCustomer
parameters: parameters:
- $ref: './auth.yaml#/components/parameters/currentUser' - $ref: 'auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles' - $ref: 'auth.yaml#/components/parameters/assumedRoles'
requestBody: requestBody:
content: content:
'application/json': 'application/json':
schema: schema:
$ref: './test-customer-schemas.yaml#/components/schemas/TestCustomer' $ref: 'test-customer-schemas.yaml#/components/schemas/TestCustomer'
required: true required: true
responses: responses:
"201": "201":
@ -47,10 +47,10 @@ post:
content: content:
'application/json': 'application/json':
schema: schema:
$ref: './test-customer-schemas.yaml#/components/schemas/TestCustomer' $ref: 'test-customer-schemas.yaml#/components/schemas/TestCustomer'
"401": "401":
$ref: './error-responses.yaml#/components/responses/Unauthorized' $ref: 'error-responses.yaml#/components/responses/Unauthorized'
"403": "403":
$ref: './error-responses.yaml#/components/responses/Forbidden' $ref: 'error-responses.yaml#/components/responses/Forbidden'
"409": "409":
$ref: './error-responses.yaml#/components/responses/Conflict' $ref: 'error-responses.yaml#/components/responses/Conflict'

View File

@ -10,7 +10,7 @@ components:
type: string type: string
format: uuid format: uuid
customer: customer:
$ref: './test-customer-schemas.yaml#/components/schemas/TestCustomer' $ref: 'test-customer-schemas.yaml#/components/schemas/TestCustomer'
name: name:
type: string type: string
description: description:

View File

@ -3,8 +3,8 @@ patch:
- testPackages - testPackages
operationId: updatePackage operationId: updatePackage
parameters: parameters:
- $ref: './auth.yaml#/components/parameters/currentUser' - $ref: 'auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles' - $ref: 'auth.yaml#/components/parameters/assumedRoles'
- name: packageUUID - name: packageUUID
in: path in: path
required: true required: true
@ -15,15 +15,15 @@ patch:
content: content:
'application/json': 'application/json':
schema: schema:
$ref: './test-package-schemas.yaml#/components/schemas/TestPackageUpdate' $ref: 'test-package-schemas.yaml#/components/schemas/TestPackageUpdate'
responses: responses:
"200": "200":
description: OK description: OK
content: content:
'application/json': 'application/json':
schema: schema:
$ref: './test-package-schemas.yaml#/components/schemas/TestPackage' $ref: 'test-package-schemas.yaml#/components/schemas/TestPackage'
"401": "401":
$ref: './error-responses.yaml#/components/responses/Unauthorized' $ref: 'error-responses.yaml#/components/responses/Unauthorized'
"403": "403":
$ref: './error-responses.yaml#/components/responses/Forbidden' $ref: 'error-responses.yaml#/components/responses/Forbidden'

View File

@ -3,8 +3,8 @@ get:
- testPackages - testPackages
operationId: listPackages operationId: listPackages
parameters: parameters:
- $ref: './auth.yaml#/components/parameters/currentUser' - $ref: 'auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles' - $ref: 'auth.yaml#/components/parameters/assumedRoles'
- name: name - name: name
in: query in: query
required: false required: false
@ -18,8 +18,8 @@ get:
schema: schema:
type: array type: array
items: items:
$ref: './test-package-schemas.yaml#/components/schemas/TestPackage' $ref: 'test-package-schemas.yaml#/components/schemas/TestPackage'
"401": "401":
$ref: './error-responses.yaml#/components/responses/Unauthorized' $ref: 'error-responses.yaml#/components/responses/Unauthorized'
"403": "403":
$ref: './error-responses.yaml#/components/responses/Forbidden' $ref: 'error-responses.yaml#/components/responses/Forbidden'

View File

@ -273,7 +273,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
assertThat(bookingItemRepo.findByUuid(givenBookingItem.getUuid())).isPresent().get() assertThat(bookingItemRepo.findByUuid(givenBookingItem.getUuid())).isPresent().get()
.matches(mandate -> { .matches(mandate -> {
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(D-1000111: rel(anchor='LP First GmbH', type='DEBITOR', holder='LP First GmbH'), fir)"); assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(D-1000111: rel(anchor='LP First GmbH', type='DEBITOR', holder='LP First GmbH'), fir)");
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05"); assertThat(mandate.getValidFrom()).isEqualTo("2022-11-01");
assertThat(mandate.getValidTo()).isEqualTo("2022-12-31"); assertThat(mandate.getValidTo()).isEqualTo("2022-12-31");
return true; return true;
}); });