Dhairya-007 opened a new pull request, #30043:
URL: https://github.com/apache/camel/pull/30043

   ## Problem
   
   `CamelJsonataResourceUri` is the header that lets a route pick the JSONata 
expression per exchange, and it is annotated for the catalog:
   
   ```java
   @Metadata(description = "A URI for the template resource to load and use 
instead of the endpoint configured.",
             javaType = "String")
   public static final String JSONATA_RESOURCE_URI = "CamelJsonataResourceUri";
   ```
   
   It is read by the endpoint when `allowTemplateFromHeader` is on:
   
   ```java
   if (allowTemplateFromHeader) {
       String newResourceUri = 
exchange.getIn().getHeader(JsonataConstants.JSONATA_RESOURCE_URI, String.class);
   ```
   
   But `jsonata.json` has no `headers` section at all, so the header appears 
neither in the catalog nor in the component's generated header table.
   
   The reason is that the generator finds header constants through 
`headersClass` on `@UriEndpoint`, and `JsonataEndpoint` never declared one:
   
   ```java
   @UriEndpoint(firstVersion = "3.5.0", scheme = "jsonata", title = "JSONata", 
syntax = "jsonata:resourceUri",
                producerOnly = true, remote = false,
                category = { Category.TRANSFORMATION })
   ```
   
   323 component sources declare `headersClass`; this one is the only component 
left whose annotated header constants are dropped because of its absence. So 
the `@Metadata` on `JSONATA_RESOURCE_URI` has never had any effect - it reads 
as though the header were documented, which is probably why it went unnoticed.
   
   ## Fix
   
   Name the constants class on the annotation, as every other component does:
   
   ```java
   category = { Category.TRANSFORMATION }, headersClass = 
JsonataConstants.class)
   ```
   
   The regenerated `jsonata.json` files are included; they gain the one 
`headers` entry.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to