This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push: new a2e22fda81c Regen a2e22fda81c is described below commit a2e22fda81c7e668ceb297ee8376bef9834f2948 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Mar 28 16:59:45 2024 +0100 Regen --- .../catalog/components/platform-http.json | 4 +- .../catalog/components/rest-openapi.json | 62 +++--- .../camel-core-starter/src/main/docs/core.json | 2 +- .../RestConfigurationDefinitionProperties.java | 6 +- .../src/main/docs/rest-openapi.json | 44 +++- .../RestOpenApiComponentConfiguration.java | 221 +++++++++++++++------ .../springboot/RestOpenApiComponentConverter.java | 2 + 7 files changed, 245 insertions(+), 96 deletions(-) diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/platform-http.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/platform-http.json index 1c02f064c7d..ea6c4fbe378 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/platform-http.json +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/platform-http.json @@ -41,8 +41,8 @@ "matchOnUriPrefix": { "index": 9, "kind": "parameter", "displayName": "Match On Uri Prefix", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found." }, "muteException": { "index": 10, "kind": "parameter", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." }, "produces": { "index": 11, "kind": "parameter", "displayName": "Produces", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The content type this endpoint produces, such as application\/xml or application\/json." }, - "useCookieHandler": { "index": 12, "kind": "parameter", "displayName": "Use Cookie Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval (currently only supported by camel-platform-http-vertx)" }, - "useStreaming": { "index": 13, "kind": "parameter", "displayName": "Use Streaming", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)" }, + "useCookieHandler": { "index": 12, "kind": "parameter", "displayName": "Use Cookie Handler", "group": "consumer", "label": "advanced,consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval (currently only supported by camel-platform-http-vertx)" }, + "useStreaming": { "index": 13, "kind": "parameter", "displayName": "Use Streaming", "group": "consumer", "label": "advanced,consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)" }, "bridgeErrorHandler": { "index": 14, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] "exceptionHandler": { "index": 15, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...] "exchangePattern": { "index": 16, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest-openapi.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest-openapi.json index 70973de8a1f..c007e2c7172 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest-openapi.json +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest-openapi.json @@ -18,35 +18,49 @@ "async": false, "api": false, "consumerOnly": false, - "producerOnly": true, + "producerOnly": false, "lenientProperties": false, "remote": true }, "componentProperties": { - "basePath": { "index": 0, "kind": "property", "displayName": "Base Path", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "API basePath, for example \/v2. Default is unset, if set overrides the value present in OpenApi specification." }, - "componentName": { "index": 1, "kind": "property", "displayName": "Component Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the Camel component that will perform the requests. The component must be present in Camel registry and it must implement RestProducerFactory service provider interface. If not set CLASSPATH is searched for sing [...] - "consumes": { "index": 2, "kind": "property", "displayName": "Consumes", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component capable of consuming. Could be one type, like application\/json or multiple types as application\/json, application\/xml; q=0.5 according to the RFC7231. This equates to the value of Accept HTTP he [...] - "host": { "index": 3, "kind": "property", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Scheme hostname and port to direct the HTTP requests to in the form of https:\/\/hostname:port. Can be configured at the endpoint, component or in the corresponding REST configuration in the Camel Context. If you give this component a nam [...] - "lazyStartProducer": { "index": 4, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] - "produces": { "index": 5, "kind": "property", "displayName": "Produces", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component is producing. For example application\/json according to the RFC7231. This equates to the value of Content-Type HTTP header. If set overrides any value present in the OpenApi specification. Can be [...] - "requestValidationCustomizer": { "index": 6, "kind": "property", "displayName": "Request Validation Customizer", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "org.apache.camel.component.rest.openapi.validator.DefaultRequestValidationCustomizer", "description": "If request validation is enabled, [...] - "requestValidationEnabled": { "index": 7, "kind": "property", "displayName": "Request Validation Enabled", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable validation of requests against the configured OpenAPI specification" }, - "specificationUri": { "index": 8, "kind": "property", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "openapi.json", "description": "Path to the OpenApi specification file. The scheme, host base path are taken from this specification, but these can be overridden with properties on the component or endpoint level. If [...] - "autowiredEnabled": { "index": 9, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] - "sslContextParameters": { "index": 10, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "Customize TLS parameters used by the component. If not set defaults to the TLS parameters set in the Camel context" }, - "useGlobalSslContextParameters": { "index": 11, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } + "basePath": { "index": 0, "kind": "property", "displayName": "Base Path", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "API basePath, for example \/v2. Default is unset, if set overrides the value present in OpenApi specification." }, + "requestValidationEnabled": { "index": 1, "kind": "property", "displayName": "Request Validation Enabled", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable validation of requests against the configured OpenAPI specification" }, + "specificationUri": { "index": 2, "kind": "property", "displayName": "Specification Uri", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "openapi.json", "description": "Path to the OpenApi specification file. The scheme, host base path are taken from this specification, but these can be overridden with properties on the component or endpoint level. If [...] + "requestValidationCustomizer": { "index": 3, "kind": "property", "displayName": "Request Validation Customizer", "group": "common (advanced)", "label": "common,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer", "deprecated": false, "autowired": false, "secret": false, "description": "If request validation is enabled, this option provides the capability to customize the creation of OpenApiInterac [...] + "apiContextPath": { "index": 4, "kind": "property", "displayName": "Api Context Path", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the context-path to use for servicing the OpenAPI specification" }, + "bridgeErrorHandler": { "index": 5, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] + "missingOperation": { "index": 6, "kind": "property", "displayName": "Missing Operation", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fail", "description": "Whether the consumer should fail,ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route." }, + "consumerComponentName": { "index": 7, "kind": "property", "displayName": "Consumer Component Name", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the Camel component that will service the requests. The component must be present in Camel registry and it must implement RestOpenApiConsumerFactory service provider interfac [...] + "mockIncludePattern": { "index": 8, "kind": "property", "displayName": "Mock Include Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified sepa [...] + "restOpenapiProcessorStrategy": { "index": 9, "kind": "property", "displayName": "Rest Openapi Processor Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom strategy for how to process Rest DSL requests" }, + "host": { "index": 10, "kind": "property", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Scheme hostname and port to direct the HTTP requests to in the form of https:\/\/hostname:port. Can be configured at the endpoint, component or in the corresponding REST configuration in the Camel Context. If you give this component a na [...] + "lazyStartProducer": { "index": 11, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...] + "componentName": { "index": 12, "kind": "property", "displayName": "Component Name", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the Camel component that will perform the requests. The component must be present in Camel registry and it must implement RestProducerFactory service provider interface. If not set CLASSPATH [...] + "consumes": { "index": 13, "kind": "property", "displayName": "Consumes", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component capable of consuming. Could be one type, like application\/json or multiple types as application\/json, application\/xml; q=0.5 according to the RFC7231. This equates to the va [...] + "produces": { "index": 14, "kind": "property", "displayName": "Produces", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component is producing. For example application\/json according to the RFC7231. This equates to the value of Content-Type HTTP header. If set overrides any value present in the OpenApi s [...] + "autowiredEnabled": { "index": 15, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...] + "sslContextParameters": { "index": 16, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "Customize TLS parameters used by the component. If not set defaults to the TLS parameters set in the Camel context" }, + "useGlobalSslContextParameters": { "index": 17, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } }, "properties": { - "specificationUri": { "index": 0, "kind": "path", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "openapi.json", "description": "Path to the OpenApi specification file. The scheme, host base path are taken from this specification, but these can be overridden with properties on the component or endpoint level. If not [...] - "operationId": { "index": 1, "kind": "path", "displayName": "Operation Id", "group": "producer", "label": "producer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ID of the operation from the OpenApi specification." }, - "basePath": { "index": 2, "kind": "parameter", "displayName": "Base Path", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "API basePath, for example \/v3. Default is unset, if set overrides the value present in OpenApi specification and in the component configuration." }, - "componentName": { "index": 3, "kind": "parameter", "displayName": "Component Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the Camel component that will perform the requests. The component must be present in Camel registry and it must implement RestProducerFactory service provider interface. If not set CLASSPATH is searched for sin [...] - "consumes": { "index": 4, "kind": "parameter", "displayName": "Consumes", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component capable of consuming. Could be one type, like application\/json or multiple types as application\/json, application\/xml; q=0.5 according to the RFC7231. This equates to the value of Accept HTTP h [...] - "host": { "index": 5, "kind": "parameter", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Scheme hostname and port to direct the HTTP requests to in the form of https:\/\/hostname:port. Can be configured at the endpoint, component or in the corresponding REST configuration in the Camel Context. If you give this component a na [...] - "produces": { "index": 6, "kind": "parameter", "displayName": "Produces", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component is producing. For example application\/json according to the RFC7231. This equates to the value of Content-Type HTTP header. If set overrides any value present in the OpenApi specification. Overri [...] - "requestValidationCustomizer": { "index": 7, "kind": "parameter", "displayName": "Request Validation Customizer", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "org.apache.camel.component.rest.openapi.validator.DefaultRequestValidationCustomizer", "description": "If request validation is enabled [...] - "requestValidationEnabled": { "index": 8, "kind": "parameter", "displayName": "Request Validation Enabled", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable validation of requests against the configured OpenAPI specification" }, - "requestValidationLevels": { "index": 9, "kind": "parameter", "displayName": "Request Validation Levels", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "Levels for specific OpenAPI request validation options. Multiple options can be specified as URI options prefixed by 'validatio [...] - "lazyStartProducer": { "index": 10, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...] + "specificationUri": { "index": 0, "kind": "path", "displayName": "Specification Uri", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "openapi.json", "description": "Path to the OpenApi specification file. The scheme, host base path are taken from this specification, but these can be overridden with properties on the component or endpoint level. If not [...] + "operationId": { "index": 1, "kind": "path", "displayName": "Operation Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "ID of the operation from the OpenApi specification. This is required when using producer" }, + "requestValidationEnabled": { "index": 2, "kind": "parameter", "displayName": "Request Validation Enabled", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable validation of requests against the configured OpenAPI specification" }, + "apiContextPath": { "index": 3, "kind": "parameter", "displayName": "Api Context Path", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the context-path to use for servicing the OpenAPI specification" }, + "missingOperation": { "index": 4, "kind": "parameter", "displayName": "Missing Operation", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fail", "description": "Whether the consumer should fail,ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route." }, + "bridgeErrorHandler": { "index": 5, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] + "consumerComponentName": { "index": 6, "kind": "parameter", "displayName": "Consumer Component Name", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the Camel component that will service the requests. The component must be present in Camel registry and it must implement RestOpenApiConsumerFactory service provider interfa [...] + "exceptionHandler": { "index": 7, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] + "exchangePattern": { "index": 8, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, + "mockIncludePattern": { "index": 9, "kind": "parameter", "displayName": "Mock Include Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified sep [...] + "restOpenapiProcessorStrategy": { "index": 10, "kind": "parameter", "displayName": "Rest Openapi Processor Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom strategy for how to process Rest DSL requests" }, + "basePath": { "index": 11, "kind": "parameter", "displayName": "Base Path", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "API basePath, for example \/v3. Default is unset, if set overrides the value present in OpenApi specification and in the component configuration." }, + "consumes": { "index": 12, "kind": "parameter", "displayName": "Consumes", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component capable of consuming. Could be one type, like application\/json or multiple types as application\/json, application\/xml; q=0.5 according to the RFC7231. This equates to the value of Accept HTTP [...] + "host": { "index": 13, "kind": "parameter", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Scheme hostname and port to direct the HTTP requests to in the form of https:\/\/hostname:port. Can be configured at the endpoint, component or in the corresponding REST configuration in the Camel Context. If you give this component a n [...] + "produces": { "index": 14, "kind": "parameter", "displayName": "Produces", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "What payload type this component is producing. For example application\/json according to the RFC7231. This equates to the value of Content-Type HTTP header. If set overrides any value present in the OpenApi specification. Overr [...] + "componentName": { "index": 15, "kind": "parameter", "displayName": "Component Name", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the Camel component that will perform the requests. The component must be present in Camel registry and it must implement RestProducerFactory service provider interface. If not set CLASSPAT [...] + "lazyStartProducer": { "index": 16, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...] + "requestValidationCustomizer": { "index": 17, "kind": "parameter", "displayName": "Request Validation Customizer", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer", "deprecated": false, "autowired": false, "secret": false, "description": "If request validation is enabled, this option provides the capability to customize the creation of OpenApiInteractionValidator [...] + "requestValidationLevels": { "index": 18, "kind": "parameter", "displayName": "Request Validation Levels", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "Levels for specific OpenAPI request validation options. Multiple options can be specified as URI options prefixed by ' [...] } } diff --git a/components-starter/camel-core-starter/src/main/docs/core.json b/components-starter/camel-core-starter/src/main/docs/core.json index d476859b9fd..4b7a966705e 100644 --- a/components-starter/camel-core-starter/src/main/docs/core.json +++ b/components-starter/camel-core-starter/src/main/docs/core.json @@ -710,7 +710,7 @@ { "name": "camel.rest.api-context-path", "type": "java.lang.String", - "description": "Sets a leading API context-path the REST API services will be using. This can be used when using components such as camel-servlet where the deployed web application is deployed using a context-path.", + "description": "Sets a leading context-path the REST API will be using. This can be used when using components such as camel-servlet where the deployed web application is deployed using a context-path.", "sourceType": "org.apache.camel.model.rest.springboot.RestConfigurationDefinitionProperties" }, { diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java index a32bda86e4f..6970e1b89b1 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java @@ -102,9 +102,9 @@ public class RestConfigurationDefinitionProperties { */ private String contextPath; /** - * Sets a leading API context-path the REST API services will be using. This - * can be used when using components such as camel-servlet where the - * deployed web application is deployed using a context-path. + * Sets a leading context-path the REST API will be using. This can be used + * when using components such as camel-servlet where the deployed web + * application is deployed using a context-path. */ private String apiContextPath; /** diff --git a/components-starter/camel-rest-openapi-starter/src/main/docs/rest-openapi.json b/components-starter/camel-rest-openapi-starter/src/main/docs/rest-openapi.json index 519a1f96cb1..1941d99aeb4 100644 --- a/components-starter/camel-rest-openapi-starter/src/main/docs/rest-openapi.json +++ b/components-starter/camel-rest-openapi-starter/src/main/docs/rest-openapi.json @@ -13,6 +13,12 @@ } ], "properties": [ + { + "name": "camel.component.rest-openapi.api-context-path", + "type": "java.lang.String", + "description": "Sets the context-path to use for servicing the OpenAPI specification", + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration" + }, { "name": "camel.component.rest-openapi.autowired-enabled", "type": "java.lang.Boolean", @@ -26,12 +32,25 @@ "description": "API basePath, for example \/v2. Default is unset, if set overrides the value present in OpenApi specification.", "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration" }, + { + "name": "camel.component.rest-openapi.bridge-error-handler", + "type": "java.lang.Boolean", + "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is n [...] + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration", + "defaultValue": false + }, { "name": "camel.component.rest-openapi.component-name", "type": "java.lang.String", "description": "Name of the Camel component that will perform the requests. The component must be present in Camel registry and it must implement RestProducerFactory service provider interface. If not set CLASSPATH is searched for single component that implements RestProducerFactory SPI. Can be overridden in endpoint configuration.", "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration" }, + { + "name": "camel.component.rest-openapi.consumer-component-name", + "type": "java.lang.String", + "description": "Name of the Camel component that will service the requests. The component must be present in Camel registry and it must implement RestOpenApiConsumerFactory service provider interface. If not set CLASSPATH is searched for single component that implements RestOpenApiConsumerFactory SPI. Can be overridden in endpoint configuration.", + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration" + }, { "name": "camel.component.rest-openapi.consumes", "type": "java.lang.String", @@ -62,6 +81,20 @@ "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration", "defaultValue": false }, + { + "name": "camel.component.rest-openapi.missing-operation", + "type": "java.lang.String", + "description": "Whether the consumer should fail,ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route.", + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration", + "defaultValue": "fail" + }, + { + "name": "camel.component.rest-openapi.mock-include-pattern", + "type": "java.lang.String", + "description": "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma.", + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration", + "defaultValue": "classpath:camel-mock\/**" + }, { "name": "camel.component.rest-openapi.produces", "type": "java.lang.String", @@ -81,11 +114,18 @@ "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration", "defaultValue": false }, + { + "name": "camel.component.rest-openapi.rest-openapi-processor-strategy", + "type": "org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy", + "description": "To use a custom strategy for how to process Rest DSL requests. The option is a org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy type.", + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration" + }, { "name": "camel.component.rest-openapi.specification-uri", - "type": "java.net.URI", + "type": "java.lang.String", "description": "Path to the OpenApi specification file. The scheme, host base path are taken from this specification, but these can be overridden with properties on the component or endpoint level. If not given the component tries to load openapi.json resource. Note that the host defined on the component and endpoint of this Component should contain the scheme, hostname and optionally the port in the URI syntax (i.e. https:\/\/api.example.com:8080). Can be overridden in endpoint co [...] - "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration" + "sourceType": "org.apache.camel.component.rest.openapi.springboot.RestOpenApiComponentConfiguration", + "defaultValue": "openapi.json" }, { "name": "camel.component.rest-openapi.ssl-context-parameters", diff --git a/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConfiguration.java b/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConfiguration.java index d4c3f7d08fb..4966cb750a8 100644 --- a/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConfiguration.java +++ b/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConfiguration.java @@ -16,7 +16,7 @@ */ package org.apache.camel.component.rest.openapi.springboot; -import java.net.URI; +import org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy; import org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer; import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; import org.apache.camel.support.jsse.SSLContextParameters; @@ -43,21 +43,72 @@ public class RestOpenApiComponentConfiguration */ private String basePath; /** - * Name of the Camel component that will perform the requests. The component + * Enable validation of requests against the configured OpenAPI + * specification + */ + private Boolean requestValidationEnabled = false; + /** + * Path to the OpenApi specification file. The scheme, host base path are + * taken from this specification, but these can be overridden with + * properties on the component or endpoint level. If not given the component + * tries to load openapi.json resource. Note that the host defined on the + * component and endpoint of this Component should contain the scheme, + * hostname and optionally the port in the URI syntax (i.e. + * https://api.example.com:8080). Can be overridden in endpoint + * configuration. + */ + private String specificationUri = "openapi.json"; + /** + * If request validation is enabled, this option provides the capability to + * customize the creation of OpenApiInteractionValidator used to validate + * requests. The option is a + * org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer type. + */ + private RequestValidationCustomizer requestValidationCustomizer; + /** + * Sets the context-path to use for servicing the OpenAPI specification + */ + private String apiContextPath; + /** + * Allows for bridging the consumer to the Camel routing Error Handler, + * which mean any exceptions (if possible) occurred while the Camel consumer + * is trying to pickup incoming messages, or the likes, will now be + * processed as a message and handled by the routing Error Handler. + * Important: This is only possible if the 3rd party component allows Camel + * to be alerted if an exception was thrown. Some components handle this + * internally only, and therefore bridgeErrorHandler is not possible. In + * other situations we may improve the Camel component to hook into the 3rd + * party component and make this possible for future releases. By default + * the consumer will use the org.apache.camel.spi.ExceptionHandler to deal + * with exceptions, that will be logged at WARN or ERROR level and ignored. + */ + private Boolean bridgeErrorHandler = false; + /** + * Whether the consumer should fail,ignore or return a mock response for + * OpenAPI operations that are not mapped to a corresponding route. + */ + private String missingOperation = "fail"; + /** + * Name of the Camel component that will service the requests. The component * must be present in Camel registry and it must implement - * RestProducerFactory service provider interface. If not set CLASSPATH is - * searched for single component that implements RestProducerFactory SPI. - * Can be overridden in endpoint configuration. + * RestOpenApiConsumerFactory service provider interface. If not set + * CLASSPATH is searched for single component that implements + * RestOpenApiConsumerFactory SPI. Can be overridden in endpoint + * configuration. */ - private String componentName; + private String consumerComponentName; /** - * What payload type this component capable of consuming. Could be one type, - * like application/json or multiple types as application/json, - * application/xml; q=0.5 according to the RFC7231. This equates to the - * value of Accept HTTP header. If set overrides any value found in the - * OpenApi specification. Can be overridden in endpoint configuration + * Used for inclusive filtering of mock data from directories. The pattern + * is using Ant-path style pattern. Multiple patterns can be specified + * separated by comma. */ - private String consumes; + private String mockIncludePattern = "classpath:camel-mock/**"; + /** + * To use a custom strategy for how to process Rest DSL requests. The option + * is a org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy + * type. + */ + private RestOpenapiProcessorStrategy restOpenapiProcessorStrategy; /** * Scheme hostname and port to direct the HTTP requests to in the form of * https://hostname:port. Can be configured at the endpoint, component or in @@ -79,6 +130,22 @@ public class RestOpenApiComponentConfiguration * and prolong the total processing time of the processing. */ private Boolean lazyStartProducer = false; + /** + * Name of the Camel component that will perform the requests. The component + * must be present in Camel registry and it must implement + * RestProducerFactory service provider interface. If not set CLASSPATH is + * searched for single component that implements RestProducerFactory SPI. + * Can be overridden in endpoint configuration. + */ + private String componentName; + /** + * What payload type this component capable of consuming. Could be one type, + * like application/json or multiple types as application/json, + * application/xml; q=0.5 according to the RFC7231. This equates to the + * value of Accept HTTP header. If set overrides any value found in the + * OpenApi specification. Can be overridden in endpoint configuration + */ + private String consumes; /** * What payload type this component is producing. For example * application/json according to the RFC7231. This equates to the value of @@ -86,29 +153,6 @@ public class RestOpenApiComponentConfiguration * OpenApi specification. Can be overridden in endpoint configuration. */ private String produces; - /** - * If request validation is enabled, this option provides the capability to - * customize the creation of OpenApiInteractionValidator used to validate - * requests. The option is a - * org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer type. - */ - private RequestValidationCustomizer requestValidationCustomizer; - /** - * Enable validation of requests against the configured OpenAPI - * specification - */ - private Boolean requestValidationEnabled = false; - /** - * Path to the OpenApi specification file. The scheme, host base path are - * taken from this specification, but these can be overridden with - * properties on the component or endpoint level. If not given the component - * tries to load openapi.json resource. Note that the host defined on the - * component and endpoint of this Component should contain the scheme, - * hostname and optionally the port in the URI syntax (i.e. - * https://api.example.com:8080). Can be overridden in endpoint - * configuration. - */ - private URI specificationUri; /** * Whether autowiring is enabled. This is used for automatic autowiring * options (the option must be marked as autowired) by looking up in the @@ -137,20 +181,78 @@ public class RestOpenApiComponentConfiguration this.basePath = basePath; } - public String getComponentName() { - return componentName; + public Boolean getRequestValidationEnabled() { + return requestValidationEnabled; } - public void setComponentName(String componentName) { - this.componentName = componentName; + public void setRequestValidationEnabled(Boolean requestValidationEnabled) { + this.requestValidationEnabled = requestValidationEnabled; } - public String getConsumes() { - return consumes; + public String getSpecificationUri() { + return specificationUri; } - public void setConsumes(String consumes) { - this.consumes = consumes; + public void setSpecificationUri(String specificationUri) { + this.specificationUri = specificationUri; + } + + public RequestValidationCustomizer getRequestValidationCustomizer() { + return requestValidationCustomizer; + } + + public void setRequestValidationCustomizer( + RequestValidationCustomizer requestValidationCustomizer) { + this.requestValidationCustomizer = requestValidationCustomizer; + } + + public String getApiContextPath() { + return apiContextPath; + } + + public void setApiContextPath(String apiContextPath) { + this.apiContextPath = apiContextPath; + } + + public Boolean getBridgeErrorHandler() { + return bridgeErrorHandler; + } + + public void setBridgeErrorHandler(Boolean bridgeErrorHandler) { + this.bridgeErrorHandler = bridgeErrorHandler; + } + + public String getMissingOperation() { + return missingOperation; + } + + public void setMissingOperation(String missingOperation) { + this.missingOperation = missingOperation; + } + + public String getConsumerComponentName() { + return consumerComponentName; + } + + public void setConsumerComponentName(String consumerComponentName) { + this.consumerComponentName = consumerComponentName; + } + + public String getMockIncludePattern() { + return mockIncludePattern; + } + + public void setMockIncludePattern(String mockIncludePattern) { + this.mockIncludePattern = mockIncludePattern; + } + + public RestOpenapiProcessorStrategy getRestOpenapiProcessorStrategy() { + return restOpenapiProcessorStrategy; + } + + public void setRestOpenapiProcessorStrategy( + RestOpenapiProcessorStrategy restOpenapiProcessorStrategy) { + this.restOpenapiProcessorStrategy = restOpenapiProcessorStrategy; } public String getHost() { @@ -169,37 +271,28 @@ public class RestOpenApiComponentConfiguration this.lazyStartProducer = lazyStartProducer; } - public String getProduces() { - return produces; - } - - public void setProduces(String produces) { - this.produces = produces; - } - - public RequestValidationCustomizer getRequestValidationCustomizer() { - return requestValidationCustomizer; + public String getComponentName() { + return componentName; } - public void setRequestValidationCustomizer( - RequestValidationCustomizer requestValidationCustomizer) { - this.requestValidationCustomizer = requestValidationCustomizer; + public void setComponentName(String componentName) { + this.componentName = componentName; } - public Boolean getRequestValidationEnabled() { - return requestValidationEnabled; + public String getConsumes() { + return consumes; } - public void setRequestValidationEnabled(Boolean requestValidationEnabled) { - this.requestValidationEnabled = requestValidationEnabled; + public void setConsumes(String consumes) { + this.consumes = consumes; } - public URI getSpecificationUri() { - return specificationUri; + public String getProduces() { + return produces; } - public void setSpecificationUri(URI specificationUri) { - this.specificationUri = specificationUri; + public void setProduces(String produces) { + this.produces = produces; } public Boolean getAutowiredEnabled() { diff --git a/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConverter.java b/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConverter.java index e728c968a32..29ca77e2f38 100644 --- a/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConverter.java +++ b/components-starter/camel-rest-openapi-starter/src/main/java/org/apache/camel/component/rest/openapi/springboot/RestOpenApiComponentConverter.java @@ -40,6 +40,7 @@ public class RestOpenApiComponentConverter implements GenericConverter { public Set<ConvertiblePair> getConvertibleTypes() { Set<ConvertiblePair> answer = new LinkedHashSet<>(); answer.add(new ConvertiblePair(String.class, org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer.class)); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy.class)); answer.add(new ConvertiblePair(String.class, org.apache.camel.support.jsse.SSLContextParameters.class)); return answer; } @@ -58,6 +59,7 @@ public class RestOpenApiComponentConverter implements GenericConverter { ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); switch (targetType.getName()) { case "org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer": return applicationContext.getBean(ref, org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer.class); + case "org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy": return applicationContext.getBean(ref, org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy.class); case "org.apache.camel.support.jsse.SSLContextParameters": return applicationContext.getBean(ref, org.apache.camel.support.jsse.SSLContextParameters.class); } return null;