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

Co-authored-by: Michael Hoennig <michael@hoennig.de>
Reviewed-on: #45
Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net>
This commit is contained in:
Michael Hoennig 2024-04-17 08:27:08 +02:00
parent 65a4647af9
commit 5b18681e96
6 changed files with 32 additions and 30 deletions

View File

@ -115,7 +115,7 @@ tasks.named('test') {
openapiProcessor {
springRoot {
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"
mapping "$projectDir/src/main/resources/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax"
@ -124,7 +124,7 @@ openapiProcessor {
}
springRbac {
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"
mapping "$projectDir/src/main/resources/api-definition/rbac/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax"
@ -133,7 +133,7 @@ openapiProcessor {
}
springTest {
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"
mapping "$projectDir/src/main/resources/api-definition/test/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax"
@ -142,7 +142,7 @@ openapiProcessor {
}
springHsOffice {
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"
mapping "$projectDir/src/main/resources/api-definition/hs-office/api-mappings.yaml"
targetDir "$buildDir/generated/sources/openapi-javax"
@ -151,7 +151,7 @@ openapiProcessor {
}
springHsBooking {
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"
mapping "$projectDir/src/main/resources/api-definition/hs-booking/api-mappings.yaml"
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
// 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) {
from "$buildDir/generated/sources/openapi-javax"
into "$buildDir/generated/sources/openapi"

View File

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

View File

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

View File

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

View File

@ -3,8 +3,8 @@ get:
- testPackages
operationId: listPackages
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- $ref: 'auth.yaml#/components/parameters/currentUser'
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
- name: name
in: query
required: false
@ -18,8 +18,8 @@ get:
schema:
type: array
items:
$ref: './test-package-schemas.yaml#/components/schemas/TestPackage'
$ref: 'test-package-schemas.yaml#/components/schemas/TestPackage'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
$ref: 'error-responses.yaml#/components/responses/Unauthorized'
"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()
.matches(mandate -> {
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");
return true;
});