davsclaus commented on PR #23926:
URL: https://github.com/apache/camel/pull/23926#issuecomment-4677840720
## Suggestion: Add `oauthProfile` as a first-class `@UriParam` on
`RestOpenApiEndpoint`
The `rest-openapi` endpoint is already lenient at runtime
(`isLenientProperties()` returns `true` on `main`), so the `lenientProperties =
true` annotation addition is metadata alignment rather than a behavioral
change. However, `oauthProfile` would be better served as a proper `@UriParam`
— it would appear in catalog metadata, endpoint DSL builders, IDE
auto-complete, and component docs, rather than being a silent pass-through.
### Proposed changes
**1. `RestOpenApiEndpoint.java`** — add the field, getter/setter, and inject
into delegate parameters:
```java
// Add field (alongside the other @UriParam fields, e.g. after
apiContextPath)
@UriParam(label = "consumer,security", displayName = "OAuth Profile",
description = "OAuth profile name passed to the HTTP consumer
delegate for validating incoming "
+ "Authorization: Bearer tokens. The selected
consumer component must support the "
+ "oauthProfile option; delegates that ignore
unknown options will start without "
+ "endpoint protection.")
private String oauthProfile;
// Add getter/setter
public String getOauthProfile() {
return oauthProfile;
}
public void setOauthProfile(String oauthProfile) {
this.oauthProfile = oauthProfile;
}
```
In `createConsumerFor()`, inject it into the parameters copy sent to the
delegate factory — after `Map<String, Object> copy = new HashMap<>(parameters)`
(line 325) and before the factory call (line 330):
```java
Map<String, Object> copy = new HashMap<>(parameters); // existing line
// pass oauthProfile to the delegate consumer
if (ObjectHelper.isNotEmpty(oauthProfile)) {
copy.put("oauthProfile", oauthProfile);
}
```
**2. `@UriEndpoint` annotation** — revert the `lenientProperties = true`
addition. The existing `isLenientProperties()` method override already handles
runtime leniency for path/query parameter pass-through. No annotation change
needed.
```java
// Keep the existing annotation without lenientProperties:
@UriEndpoint(firstVersion = "3.1.0", scheme = "rest-openapi", title = "REST
OpenApi",
syntax = "rest-openapi:specificationUri#operationId", category
= { Category.REST, Category.API })
```
**3. Regenerate** — run `mvn clean install -DskipTests` in
`components/camel-rest-openapi` so the generated URI factory, configurer,
catalog JSON, and endpoint DSL builder pick up the new `@UriParam`.
**4. Upgrade guide** — the existing text about `rest-openapi` pass-through
and lenient URIs can be simplified since `oauthProfile` is now a documented
option. The caveat about verifying delegate support is still relevant and
should stay.
### Why this is better
- `oauthProfile` appears in `rest-openapi` component docs, catalog JSON, and
endpoint DSL builders
- IDE auto-complete works for the option
- No metadata change to lenient properties — avoids confusion about whether
`rest-openapi` silently swallows typos (it already does via the method
override, but the annotation didn't advertise it before)
_Claude Code on behalf of Claus Ibsen_
--
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]