Claus Ibsen created CAMEL-24992:
-----------------------------------

             Summary: camel-yaml-dsl-validator: say when a rest-openapi call 
has no value for a path parameter of its operation
                 Key: CAMEL-24992
                 URL: https://issues.apache.org/jira/browse/CAMEL-24992
             Project: Camel
          Issue Type: Improvement
          Components: camel-yaml-dsl
            Reporter: Claus Ibsen


Split from CAMEL-24986, whose runtime half is merged. This is the half that 
prevents the mistake rather than explaining it.

A {{rest-openapi}} producer calls an operation whose path holds a parameter:

{code:yaml}
- to:
    uri: rest-openapi
    parameters:
      specificationUri: stock-api.json
      operationId: reserveStock
{code}

The specification says {{/stock/\{sku\}/reserve}}, so the call needs a header 
named {{sku}}. When no step before the call sets it, the request goes out with 
{{\{sku\}}} in the path and the service answers 404. CAMEL-24986 makes the 
runtime say which parameter it was; this issue is about saying it before the 
route runs.

The validator already reads the specification beside the route: 
{{OpenApiVerbs}} parses it for CAMEL-24844 phase B, to know which operations 
are a GET and therefore carry no body. The same parse gives the path parameters 
of each operation, and the walk that phase A does over the steps of a route can 
see whether any step before the call sets a header of that name.

h3. Why it is worth doing

The runtime message arrives after the route has run, and a model's loop is 
read, write, validate, fix - it does not run the application between edits. The 
measured effect of moving a message from the runtime to the validator is large: 
the rung that phase A and B targeted went from 0/5 in four consecutive 
benchmark series to 4/5 in the first series after the check landed.

h3. Where it should stay quiet

Only when the specification is read and the operation is known. A header set by 
something the walk cannot follow - a bean, a processor, a route that calls this 
one - has to leave the check silent, the way the body flow walk already stops 
at anything it cannot prove.




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

Reply via email to