Claus Ibsen created CAMEL-24004:
-----------------------------------

             Summary: camel-restdsl-openapi-plugin - Generated YAML REST DSL 
omits required type field on param definitions
                 Key: CAMEL-24004
                 URL: https://issues.apache.org/jira/browse/CAMEL-24004
             Project: Camel
          Issue Type: Bug
          Components: rest
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen


The {{camel-restdsl-openapi-plugin}} generates YAML REST DSL from OpenAPI 
specifications, but omits the {{type}} field on some {{param}} definitions.

The {{ParamDefinition.type}} field has {{@XmlAttribute(required = true)}} in 
the model, meaning it is a required attribute. The OpenAPI plugin knows the 
parameter type (path, query, header, body) from the OpenAPI spec but does not 
always emit it in the generated YAML.

This was previously masked because the YAML DSL schema generator had a bug 
(CAMEL-23983) where {{withRequired(isDeprecated(field))}} was overwriting the 
required flag, so {{type}} was never enforced as required in the schema. Now 
that CAMEL-23983 is fixed, the schema correctly marks {{type}} as required and 
the generated YAML fails validation.

The failing test is {{RestTest.load rest (generated)}} in 
{{dsl/camel-yaml-dsl/camel-yaml-dsl}} which loads a YAML file generated from 
{{src/test/resources/openapi.json}} — 9 param entries are missing the {{type}} 
field.

Fix: update the OpenAPI-to-YAML-DSL generator to always emit the {{type}} field 
on param definitions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to