[ 
https://issues.apache.org/jira/browse/CAMEL-24649?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pontus Ullgren updated CAMEL-24649:
-----------------------------------
    Description: 
When using the REST OpenApi to publish rest services from a OAS (as a consumer) 
there is currently no way to set 
the body returned when a client calls a operation (unmatched path or method) 
that is not in the OAS file.

It is hardcoded to be a 404 or 405 with an empty body.

[https://github.com/apache/camel/blob/main/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java#L128-L142]

It would be useful to allow the developer to add a custom handler for this. 
Much like how `RestClientRequestValidator` works.

The changes made in CAMEL-22971 introduced fine-grained web routes, making 
vert.x handled calls to 
endpoints not found in the contract. So to make it possible for camel to 
respond it is needed to introduce a new `unmatchedRequestHandling` parameter 
that can take the values:
 * `platform` - default and will keep the current behavior where unmatched 
requests are handled by the platform
 * `camel` - will bind a catch-all route so that unmatched requests are send to 
camel (so that they can be picked up by the new handler) 

  was:
When using the REST OpenApi to publish rest services from a OAS (as
a consumer) there is currently no way to set the body returned when a client 
calls a operation (unmatched path or method) that is not in the OAS file.

It is hardcoded to be a 404 or 405 with an empty body.



https://github.com/apache/camel/blob/main/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java#L128-L142


It would be useful to allow the developer to add a custom handler for this. 
Much like how `RestClientRequestValidator` works.


> Customize 404/405 response body when using REST OpenApi componentc
> ------------------------------------------------------------------
>
>                 Key: CAMEL-24649
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24649
>             Project: Camel
>          Issue Type: New Feature
>          Components: rest
>    Affects Versions: 4.22.0
>            Reporter: Pontus Ullgren
>            Priority: Major
>
> When using the REST OpenApi to publish rest services from a OAS (as a 
> consumer) there is currently no way to set 
> the body returned when a client calls a operation (unmatched path or method) 
> that is not in the OAS file.
> It is hardcoded to be a 404 or 405 with an empty body.
> [https://github.com/apache/camel/blob/main/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java#L128-L142]
> It would be useful to allow the developer to add a custom handler for this. 
> Much like how `RestClientRequestValidator` works.
> The changes made in CAMEL-22971 introduced fine-grained web routes, making 
> vert.x handled calls to 
> endpoints not found in the contract. So to make it possible for camel to 
> respond it is needed to introduce a new `unmatchedRequestHandling` parameter 
> that can take the values:
>  * `platform` - default and will keep the current behavior where unmatched 
> requests are handled by the platform
>  * `camel` - will bind a catch-all route so that unmatched requests are send 
> to camel (so that they can be picked up by the new handler) 



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

Reply via email to