micronaut-projects / micronaut-openapi

Generates OpenAPI / Swagger Documentation for Micronaut projects
https://micronaut-projects.github.io/micronaut-openapi/latest/guide/index.html
Apache License 2.0
79 stars 95 forks source link

additionalProperties must be either a Boolean or a Schema instance #1856

Closed sdelamo closed 2 weeks ago

sdelamo commented 2 weeks ago

Issue description

There is a regression in the latest version of OpenAPI. It broke starter build:

clone: https://github.com/micronaut-projects/micronaut-starter 4.7.x branch

starter has the following openapi.properties file

micronaut.openapi.expand.api.version=2.3.2-SNAPSHOT
rapidoc.bg-color=\#14191f
rapidoc.enabled=true
rapidoc.sort-endpoints-by=method
rapidoc.text-color=\#aec2e0
redoc.enabled=true
swagger-ui.enabled=true
./gradlew :starter-api:compileJava
Task :starter-api:compileJava
Note: Generating OpenAPI Documentation
Note: Expanding properties: [\$\{api.version}->4.7.0-SNAPSHOT]
warning: Error:
  additionalProperties must be either a Boolean or a Schema instance
   at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: io.swagger.v3.oas.models.media.ComposedSchema["additionalProperties"]) (through reference chain: io.swagger.v3.oas.models.media.ObjectSchema["properties"]->java.util.LinkedHashMap["_links"]) (through reference chain: io.swagger.v3.oas.models.OpenAPI["components"]->io.swagger.v3.oas.models.Components["schemas"]->java.util.LinkedHashMap["Linkable"])
  java.lang.IllegalArgumentException: additionalProperties must be either a Boolean or a Schema instance
   at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: io.swagger.v3.oas.models.media.ComposedSchema["additionalProperties"]) (through reference chain: io.swagger.v3.oas.models.media.ObjectSchema["properties"]->java.util.LinkedHashMap["_links"]) (through reference chain: io.swagger.v3.oas.models.OpenAPI["components"]->io.swagger.v3.oas.models.Components["schemas"]->java.util.LinkedHashMap["Linkable"])
sdelamo commented 2 weeks ago

@altro3 can you check this?

altro3 commented 2 weeks ago

in progress... trying to understand, what is wrong

sdelamo commented 2 weeks ago

@altro3 I am not sure the fix is working. I still reproduce the failure in starter.

altro3 commented 2 weeks ago

ok, start checking it again...

altro3 commented 2 weeks ago

@sdelamo checked it - all works fine. I understand, why you have a problem. You still use version 6.13.0. You use snapshot of platform bom - it's cached for 24 hours by default in gradle. To check for updates for each build, add these lines to file io.micronaut.internal.starter.base-module.gradle:

configurations.configureEach {
    resolutionStrategy {
        cacheDynamicVersionsFor 0, 'minutes'
        cacheChangingModulesFor 0, 'minutes'
    }
}

like this:

{2339C86F-4FBF-4095-A247-E5270F043C8E}

After it all must be ok

altro3 commented 2 weeks ago

@sdelamo ping

altro3 commented 2 weeks ago

Or you can set micronaut-openapi version directly:

annotationProcessor("io.micronaut.openapi:micronaut-openapi:6.13.1!!")