Skip to content

[BUG][jaxrs-spec] disallowAdditionalPropertiesIfNotPresent leads to compilation errors #23573

@Philipp-Borchert-ISH

Description

@Philipp-Borchert-ISH

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Using the generator option:
disallowAdditionalPropertiesIfNotPresent=false
... with the jaxrs-spec generator leads to invalid POJOs being generated.

Seems to be a regression introduced by #22366 (found during openapi-generator-maven-plugin from 7.17 to 7.21).

This part of the change assumes that this.put / this.get methods are present - which is NOT the case when the mentioned generator option is set while "additionalProperties" is not defined on the model - hence the POJO doesn't extend Map<> --> compiler error.

openapi-generator version

7.20, 7.21

OpenAPI declaration file content or url

reproducer repo: https://github.com/Philipp-Borchert-ISH/jaxrs-spec-repro

plain old petstore.yaml https://github.com/Philipp-Borchert-ISH/jaxrs-spec-repro/blob/main/src/main/resources/petstore.yaml

Generation Details

see https://github.com/Philipp-Borchert-ISH/jaxrs-spec-repro/blob/8e8761881dbd8ed264e5839466e6be424c73c6fd/pom.xml#L102-L121

Steps to reproduce
  1. run mvn compile or ./mvnw compile
  2. observe compilation errors due to missing "extends Map<>" on several POJOs
Suggest a fix

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