Hi Okay you can use a custom RestOpenapiProcessorStrategy (extend default) and do your custom code in the process method. But yeah we may want to make this easier in rest-dsl directly or something like that. You are welcome to create a JIRA.
On Tue, Aug 13, 2024 at 10:53 AM <med...@volny.cz> wrote: > Hello Claus, > > i have added both interceptFrom and interceptTo to my routeBuilder, but it > has no effect. My code looks like following: > > @Component > public class GopSenderRoute extends EndpointRouteBuilder { > @Override > public void configure() throws Exception { > > interceptFrom().process(e -> {throw new > RuntimeException("intercept from");}); > interceptSendToEndpoint("direct-*").process(e -> {throw new > RuntimeException("intercept to");}); > > restConfiguration() > .contextPath("/") // specified in OpenAPI > .apiContextPath("/api-doc/gop"); > > rest() > .openApi() > .specification("/openapi/gop/sender/camelGOP-openapi-v1.json") > .missingOperation("ignore"); > > > } > } > > > ______________________________________________________________ > > Od: "Claus Ibsen" <claus.ib...@gmail.com> > > Komu: users@camel.apache.org > > Datum: 13.08.2024 08:55 > > Předmět: Re: [QUESTION] Open API REST DSL with contract first OpenAPI > > > >Hi > > > >You can take a look at interceptFrom or interceptSendTo > > > >However some kind of advanced configuration in rest-dsl to call a custom > >processor is not supported. > >It may be something we could consider. > > > > > > > > > >On Tue, Aug 13, 2024 at 8:31 AM <med...@volny.cz> wrote: > > > >> Hello comunity, > >> > >> we have migrated out Camel Spring Boot Project to v 4.7 and started to > use > >> the new Documentation first approach as described here > >> https://camel.apache.org/manual/rest-dsl-openapi.html. That helped us > >> simplify out prooject quite a bit. > >> > >> My question is: Is it possible to inject some code (processor, bean, > >> route) before the the exchange is routed to the direct endpoint? In > >> particular I would like to perform authorization check and some basic > >> header validation. > >> > >> I can do that by some shared processor or route called at the beginning > of > >> each direct route but having it centralized in the rest consumer would > be > >> lighter and cleaner. > >> > >> Best regards > >> > >> Jiri Medved > >> > > > > > >-- > >Claus Ibsen > >----------------- > >@davsclaus > >Camel in Action 2: https://www.manning.com/ibsen2 > > > > > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2