Claus Ibsen created CAMEL-24840:
-----------------------------------

             Summary: camel validate yaml: say how a key/value property list 
item is written (restConfiguration dataFormatProperty and friends) instead of 
'property is not defined in the schema'
                 Key: CAMEL-24840
                 URL: https://issues.apache.org/jira/browse/CAMEL-24840
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang, camel-yaml-dsl
            Reporter: Claus Ibsen


{{restConfiguration}} carries several lists of key/value properties: 
{{dataFormatProperty}}, {{componentProperty}}, {{endpointProperty}}, 
{{consumerProperty}}, {{apiProperty}}, {{corsHeaders}}. In YAML each item is 
{{- key: prettyPrint}} followed by {{value: "true"}}. What people (and models) 
write first is the natural map form:

{code:yaml}
- restConfiguration:
    component: platform-http
    bindingMode: json
    dataFormatProperty:
      - prettyPrint: "true"
{code}

{{camel validate yaml}} answers

{code}
/0/restConfiguration/dataFormatProperty/0: property 'prettyPrint' is not 
defined in the schema and the schema does not allow additional properties
{code}

and {{camel run}} answers {{Error constructing YAML node id: 
org.apache.camel.model.rest.RestPropertyDefinition: unsupported field: 
prettyPrint}}. Neither says what to write. The step before it, 
{{dataFormatProperty: prettyPrint: true}} as a map, already gets a hint ("write 
it as a list: each item starts with - "), so the list form is where the reader 
lands next, and then stops.

Suggested hint, for every property of type RestPropertyDefinition list (and the 
same shape elsewhere, e.g. {{corsHeaders}}): "an item of dataFormatProperty is 
a key and a value: - key: prettyPrint followed by value: \"true\" (indented 
under the -)".

Found in the round-2 local-model benchmark on the camel-jbang-examples ladder 
(stock-api): two of three attempts ended on this message.



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

Reply via email to