Skip to content

[BUG] Boolean not allowed for additionalProperties in spec validation #2905

@samarthgupta437

Description

@samarthgupta437

I have an api spec which successfully generated server stub using "openapi-generator-gradle-plugin" version 3.3.4, however it gives spec validation error with plugin version 4.0.0

Spec is having "additionalProperties: false" in data models, and when I try to generate source i get below error :

`* What went wrong:
Execution failed for task ':openApiGenerate'.

There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 1, Warning count: 2
Errors:
-attribute components.schemas.Home.additionalProperties is not of type object
Warnings:
-attribute components.schemas.Home.additionalProperties is not of type object
`

part of model below
schemas: Home: type: object additionalProperties: false properties: name: type: string

Plugin task configuration:
openApiGenerate { generatorName = "jaxrs-jersey" inputSpec = "$rootDir/src/main/resources/home.yml".toString() outputDir = "$rootDir".toString() apiPackage = "com.home.rest.resources" invokerPackage = "com.home.rest" modelPackage = "com.home.rest.model" modelFilesConstrainedTo = [] configOptions = [ dateLibrary: "java8" ] }

As per documentation here boolean should be allowed:
https://swagger.io/docs/specification/data-models/data-types/#additionalProperties

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions