You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With OpenAPI 3.1, a closed schema (additionalProperties: false) that has an inline object property gets the additional-properties accessors from JavaJaxRS/spec/additional_properties.mustache, but the class does not extend HashMap. The generated model does not compile:
Expected: no accessors for a closed schema, as with OpenAPI 3.0.3.
Observations:
The same spec with openapi: 3.0.3 compiles and has no accessors.
Without additionalProperties: false on PatchRequest it compiles and has no accessors.
A $ref to a named local schema instead of the inline object does not trigger it. A $ref into another file does (seen in our real spec, not reduced further).
additionalProperties: true works as expected (extends HashMap<String, Object>).
Workaround in a custom template directory: wrap the partial in {{#parent}}…{{/parent}}, so the accessors are only rendered for models that extend a map. The root cause seems to be that the model is flagged with additionalProperties without getting the map parent.
It is a regression in 7.20.0. 7.19.0 generates a compiling model for the spec below, and 7.20.0 through 7.27.0 do not. The model state may already have been wrong before, but it only became visible when JavaJaxRS/spec/additional_properties.mustache was added and included from pojo.mustache in 7.20.0.
An inline object property is not required to trigger it. A single schema with only scalar properties is enough:
Cookie.java:[60,9] cannot find symbol
Cookie.java:[70,12] incompatible types: org.openapitools.model.Cookie cannot be converted to java.util.Map<java.lang.String,java.lang.Object>
Cookie.java:[79,16] cannot find symbol
Version
openapi: 3.1.0
openapi: 3.0.3
7.19.0
compiles
compiles
7.20.0
fails
7.26.0
fails
compiles
7.27.0
fails
Which schema is affected seems to depend on more than the schema itself:
With a second, identical schema (Other) added to the spec above, only Cookie is affected; Other compiles.
In our real spec (17 schemas, all additionalProperties: false), only the one schema not referenced by any operation is affected. That schema has only scalar properties and a type: [array, "null"] list.
In a spec with one referenced and one unreferenced schema, both with a single string property, neither is affected; adding required: [x] to the unreferenced one makes it affected.
That fits the explanation in #25470 that swagger-parser sometimes represents additionalProperties: false as a boolean false schema, so the fix there probably covers these cases as well. I have not tested the PR branch.
Workaround on our side: removing additionalProperties: false from the affected schema (or removing the unused schema) makes it compile again.
Activity
jsteenbeeke commentedon Nov 3, 2026
We hit this too. Two things that may help:
It is a regression in 7.20.0. 7.19.0 generates a compiling model for the spec below, and 7.20.0 through 7.27.0 do not. The model state may already have been wrong before, but it only became visible when
JavaJaxRS/spec/additional_properties.mustachewas added and included frompojo.mustachein 7.20.0.An inline object property is not required to trigger it. A single schema with only scalar properties is enough:
mvn compileon the generated project fails:openapi: 3.1.0openapi: 3.0.3Which schema is affected seems to depend on more than the schema itself:
Other) added to the spec above, onlyCookieis affected;Othercompiles.additionalProperties: false), only the one schema not referenced by any operation is affected. That schema has only scalar properties and atype: [array, "null"]list.stringproperty, neither is affected; addingrequired: [x]to the unreferenced one makes it affected.That fits the explanation in #25470 that swagger-parser sometimes represents
additionalProperties: falseas a booleanfalseschema, so the fix there probably covers these cases as well. I have not tested the PR branch.Workaround on our side: removing
additionalProperties: falsefrom the affected schema (or removing the unused schema) makes it compile again.