oscerd opened a new pull request, #29138:
URL: https://github.com/apache/camel/pull/29138

   Fixes [CAMEL-26560](https://issues.apache.org/jira/browse/CAMEL-26560). 
Documentation only.
   
   The YAML DSL hands every bean property over as a string, the entries of a 
map included, so a `conditionContext` written in YAML (inline on an 
`OpenFgaSecurityPolicy` bean, or as a map bean referenced with 
`conditionContext=#myContext`) reaches OpenFGA with string values. OpenFGA 
converts a string for an `int`, `uint`, `double`, `duration`, `timestamp` or 
`ipaddress` condition parameter, but rejects one for a `bool` parameter, and a 
`list` or `map` parameter cannot be written inline at all. The page said none 
of this and had no example of building the `#myContext` map.
   
   The "Contextual tuples and condition context" section now:
   
   - says which parameter types need care when the value comes from YAML or a 
properties file;
   - shows a condition context in Java and YAML: `#valueAs(boolean):true` for a 
`bool` parameter and a `java.util.ArrayList` bean referenced with `#bean:` for 
a `list` one;
   - shows the map given inline on an `OpenFgaSecurityPolicy`;
   - says that a value of the wrong type fails with an HTTP 400 naming the 
parameter, and is refused even with `failOpen` set.
   
   The catalog copy of the page is updated to match (byte-identical). The 
component cannot convert the values itself: it does not know the parameter 
types the model declares, and turning the string `"true"` into a boolean would 
break a `string` parameter whose value happens to be `true`.
   
   ### Verification
   
   Against OpenFGA v1.22.1 (the image `camel-test-infra-openfga` pins), with 
`camel run --camel-version=4.23.0 --dep=camel:openfga`, a model whose `reader` 
relation is conditioned on `trusted && region in allowed_regions` (`bool`, 
`string`, `list<string>`) and on `trusted && max_amount >= 50` (`bool`, `int`):
   
   - the two YAML blocks the page adds, run as they are: the endpoint check is 
allowed, and the policy lets the exchange through;
   - the same with a plain `trusted: true`: HTTP 400 `failed to convert context 
parameter 'trusted': expected type value 'bool', but found 'string'`, and the 
exchange is refused by both the endpoint and the policy even with `failOpen: 
true`;
   - an inline YAML list for `allowed_regions` fails at load with `Unsupported 
type: SEQUENCE`.
   
   Both YAML blocks also pass the YAML DSL schema validation. Related YAML work 
on these components: CAMEL-26559, CAMEL-26561, CAMEL-26562.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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