openapi-processor / openapi-processor-spring

an OpenAPI 3.0 & 3.1 interface & model java code generator for Spring Boot
https://docs.openapiprocessor.io
Apache License 2.0
40 stars 9 forks source link

bean validation broken in 2023.1.1 #157

Closed aburmeis closed 1 year ago

aburmeis commented 1 year ago

I am sorry, but the version 2023.1.1 still does not work for bean validation:

when enabled (regardless of javax or jakarta), I get the following error for the same api definition working with version 2022.3: [ERROR] processing failed! java.lang.NullPointerException at io.openapiprocessor.core.writer.java.BeanValidationFactoryKt.shouldHaveValid (BeanValidationFactory.kt:157) at io.openapiprocessor.core.writer.java.BeanValidationFactoryKt.access$shouldHaveValid (BeanValidationFactory.kt:1) at io.openapiprocessor.core.writer.java.BeanValidationFactory.collectAnnotations (BeanValidationFactory.kt:44) at io.openapiprocessor.core.writer.java.BeanValidationFactory.validate (BeanValidationFactory.kt:36) at io.openapiprocessor.core.writer.java.InterfaceWriter.addImports (InterfaceWriter.kt:85) at io.openapiprocessor.core.writer.java.InterfaceWriter.collectImports (InterfaceWriter.kt:66) at io.openapiprocessor.core.writer.java.InterfaceWriter.write (InterfaceWriter.kt:33) at io.openapiprocessor.core.writer.java.ApiWriter.writeInterface (ApiWriter.kt:89) at io.openapiprocessor.core.writer.java.ApiWriter.writeInterfaces$lambda$0 (ApiWriter.kt:58) at java.util.ArrayList.forEach (ArrayList.java:1511) at io.openapiprocessor.core.model.Api.forEachInterface (Api.kt:38) at io.openapiprocessor.core.writer.java.ApiWriter.writeInterfaces (ApiWriter.kt:56) at io.openapiprocessor.core.writer.java.ApiWriter.write (ApiWriter.kt:43) at io.openapiprocessor.spring.processor.SpringProcessor.run (SpringProcessor.kt:79) at io.openapiprocessor.spring.processor.SpringService.run (SpringService.kt:29)

hauner commented 1 year ago

That's strange. It should never be null at that location. The bean validation (v2) integration test (it contains all validations) doesn't throw if I change it to jakarta.

I will test this on some production code. It would be great If you could share a piece of api & mapping that triggers the issue.

vhschlenker commented 1 year ago

To reproduce the problem, one can do the following changes: In the src\testInt\resources\tests\params-pageable-mapping\inputs\mapping.yaml-File, add the following:

hauner commented 1 year ago

@vhschlenker Thanks, can reproduce it now.

hauner commented 1 year ago

fixed in 2023.1.2