Claus Ibsen created CAMEL-25762:
-----------------------------------

             Summary: camel-jbang - the validator learns the OpenAPI operations 
and the REST binding mode beside a route, so parsed data sent by rest-openapi 
or returned by a REST route is reported
                 Key: CAMEL-25762
                 URL: https://issues.apache.org/jira/browse/CAMEL-25762
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang, camel-yaml-dsl
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The validator reports parsed data (a Map or a List from unmarshal) where a step 
needs text (CAMEL-24844, PR 28047): a to: file, an http producer that sends it 
with POST, the reply of a platform-http route. In the r17 series of the 
local-model benchmark, it still misses 9 of the 14 parsed-data collisions, 
because the facts it needs are not in the route file:

* *rest-openapi calls (6):* whether {{to: 
rest-openapi:stock-api.json#reserveStock}} sends the body depends on the verb 
of the operation, which is in the specification. The rest-openapi producer 
calls with that verb, whatever the headers say.
* *REST replies (3):* the body at the end of a route of a REST verb ({{rest: 
get: ... to: direct:x}}), or of an operation of a contract-first binding 
({{rest: openApi:}} routes each operation to {{direct:<operationId>}}), is the 
reply. A Map there fails unless the REST binding writes it, and the binding 
mode can be set in application.properties ({{camel.rest.bindingMode}}), which 
the validator does not see.

camel-jbang already reads the specification beside a route, to tell the 
validator which operations carry no body (CAMEL-24844 phase B, 
{{OpenApiVerbs}}).

h3. Proposal

camel-jbang passes the validator the facts of the project, read from the files 
beside the route:
* the operations of the OpenAPI specifications the file uses (contract-first, 
and rest-openapi calls): the verb of each operationId;
* the REST binding mode the project's properties set (off when they set none).

The validator then reports:
* a rest-openapi call to a POST, PUT or PATCH operation that is given parsed 
data;
* the end of a REST route (a verb's route, or a contract-first operation's) 
that is parsed data.

Both only when nothing can write the data: no binding mode in the file 
(restConfiguration, rest, verb) or in the properties. When the facts are not 
known (another caller, no directory), it says nothing, as today.

_Filed by Claude Code on behalf of davsclaus_



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

Reply via email to