This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch openapi3 in repository https://gitbox.apache.org/repos/asf/camel.git
commit a86767187366098dd0731a7e058d2ad7dd2165cb Author: Claus Ibsen <[email protected]> AuthorDate: Thu Feb 29 09:31:22 2024 +0100 CAMEL-20488: Drop support for old swagger v2 spec (openapi v2) --- .../src/main/docs/openapi-java.adoc | 2 + components/camel-rest-openapi/pom.xml | 31 +- .../src/main/docs/rest-openapi-component.adoc | 2 + .../camel/component/rest/openapi/HttpsTest.java | 186 ---- .../camel/component/rest/openapi/HttpsV3Test.java | 2 +- .../rest/openapi/RestOpenApiComponentTest.java | 299 ------ .../rest/openapi/RestOpenApiComponentYamlTest.java | 269 ----- .../rest/openapi/RestOpenApiDelegateHttpsTest.java | 48 - .../rest/openapi/RestOpenApiGlobalHttpsTest.java | 33 - .../openapi/RestOpenApiGlobalHttpsV31Test.java | 2 +- .../openapi/RestOpenApiRequestValidationTest.java | 10 +- .../src/test/resources/alt-petstore.json | 1039 -------------------- .../src/test/resources/alt-petstore.yaml | 716 -------------- .../src/test/resources/fruits-2.0.yaml | 146 --- 14 files changed, 27 insertions(+), 2758 deletions(-) diff --git a/components/camel-openapi-java/src/main/docs/openapi-java.adoc b/components/camel-openapi-java/src/main/docs/openapi-java.adoc index bfe1a7e9a49..cc022a3a8f7 100644 --- a/components/camel-openapi-java/src/main/docs/openapi-java.adoc +++ b/components/camel-openapi-java/src/main/docs/openapi-java.adoc @@ -15,6 +15,8 @@ The Rest DSL can be integrated with the `camel-openapi-java` module which is used for exposing the REST services and their APIs using https://www.openapis.org/[OpenApi]. +IMPORTANT: Only OpenAPI spec version 3.x is supported. You cannot use the old Swagger 2.0 spec. + Maven users will need to add the following dependency to their `pom.xml` for this component: diff --git a/components/camel-rest-openapi/pom.xml b/components/camel-rest-openapi/pom.xml index 497e1a11724..47b7d883b14 100644 --- a/components/camel-rest-openapi/pom.xml +++ b/components/camel-rest-openapi/pom.xml @@ -65,21 +65,19 @@ <version>${swagger-openapi3-java-parser-version}</version> <exclusions> <exclusion> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-core</artifactId> + <groupId>io.swagger.parser.v3</groupId> + <artifactId>swagger-parser-v2-converter</artifactId> </exclusion> <exclusion> <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-models</artifactId> </exclusion> + <exclusion> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-core</artifactId> + </exclusion> </exclusions> </dependency> - <!-- swagger requires javax.xml.bind.annotation.XmlElement --> - <dependency> - <groupId>javax.xml.bind</groupId> - <artifactId>jaxb-api</artifactId> - <version>2.3.1</version> - </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> @@ -102,17 +100,24 @@ <artifactId>jackson-dataformat-yaml</artifactId> <version>${jackson2-version}</version> </dependency> - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jdk8</artifactId> - <version>${jackson2-version}</version> - </dependency> <dependency> <groupId>com.atlassian.oai</groupId> <artifactId>swagger-request-validator-core</artifactId> <version>${swagger-request-validator-version}</version> <exclusions> + <exclusion> + <groupId>io.swagger.parser.v3</groupId> + <artifactId>swagger-parser-v2-converter</artifactId> + </exclusion> + <exclusion> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-models</artifactId> + </exclusion> + <exclusion> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-core</artifactId> + </exclusion> <exclusion> <groupId>com.google.code.findbugs</groupId> <artifactId>findbugs</artifactId> diff --git a/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc b/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc index 8bb91aa9547..903dab2155b 100644 --- a/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc +++ b/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc @@ -25,6 +25,8 @@ interface. Currently, known working components are: * xref:undertow-component.adoc[undertow] * xref:vertx-http-component.adoc[vertx-http] +IMPORTANT: Only OpenAPI spec version 3.x is supported. You cannot use the old Swagger 2.0 spec. + Maven users will need to add the following dependency to their `pom.xml` for this component: diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsTest.java deleted file mode 100644 index d1b9734643e..00000000000 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsTest.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rest.openapi; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.KeyStore; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.Marshaller; - -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; - -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.common.HttpsSettings; -import com.google.common.io.Resources; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.rest.RestEndpoint; -import org.apache.camel.converter.jaxb.JaxbDataFormat; -import org.apache.camel.support.jsse.CipherSuitesParameters; -import org.apache.camel.support.jsse.SSLContextParameters; -import org.apache.camel.support.jsse.TrustManagersParameters; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.util.security.CertificateUtils; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public abstract class HttpsTest extends CamelTestSupport { - - protected static WireMockServer petstore = new WireMockServer( - wireMockConfig().httpServerFactory(new WireMockJettyServerFactory()).containerThreads(13).dynamicPort() - .dynamicHttpsPort().keystorePath(Resources.getResource("localhost.p12").toString()).keystoreType("PKCS12") - .keystorePassword("changeit").keyManagerPassword("changeit")); - - static final Object NO_BODY = null; - - public String componentName; - - @BeforeAll - public static void startWireMockServer() { - petstore.start(); - } - - @AfterAll - public static void stopWireMockServer() { - petstore.stop(); - } - - @Override - public void setUp() { - } - - @BeforeEach - public void resetWireMock() { - petstore.resetRequests(); - } - - public void doSetUp(String componentName) throws Exception { - this.componentName = componentName; - super.setUp(); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeConfiguredForHttps(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = template.requestBodyAndHeader("direct:getPetById", NO_BODY, "petId", 14, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @Override - protected CamelContext createCamelContext() throws Exception { - final CamelContext camelContext = super.createCamelContext(); - - final RestOpenApiComponent component = new RestOpenApiComponent(); - component.setComponentName(componentName); - component.setHost("https://localhost:" + petstore.httpsPort()); - - camelContext.addComponent("petStore", component); - - return camelContext; - } - - @Override - protected RoutesBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - final JAXBContext jaxbContext = JAXBContext.newInstance(Pet.class, Pets.class); - - final JaxbDataFormat jaxb = new JaxbDataFormat(jaxbContext); - - jaxb.setJaxbProviderProperties(Collections.singletonMap(Marshaller.JAXB_FORMATTED_OUTPUT, false)); - - from("direct:getPetById").to("petStore:getPetById").unmarshal(jaxb); - } - }; - } - - public static Iterable<String> knownProducers() { - final List<String> producers = new ArrayList<>(Arrays.asList(RestEndpoint.DEFAULT_REST_PRODUCER_COMPONENTS)); - // skip http due security certificate testing problems - producers.remove("undertow"); - producers.remove("vertx-http"); - producers.remove("http"); - return producers; - } - - @BeforeAll - public static void setupStubs() throws IOException, URISyntaxException { - petstore.stubFor(get(urlEqualTo("/openapi.json")).willReturn(aResponse().withBody( - Files.readAllBytes(Paths.get(RestOpenApiGlobalHttpsTest.class.getResource("/openapi.json").toURI()))))); - - petstore.stubFor( - get(urlEqualTo("/v2/pet/14")).willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id><name>Olafur Eliason Arnalds</name></Pet>"))); - } - - static SSLContextParameters createHttpsParameters(final CamelContext camelContext) throws Exception { - final TrustManagersParameters trustManagerParameters = new TrustManagersParameters(); - trustManagerParameters.setCamelContext(camelContext); - final TrustManagerFactory trustManagerFactory - = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - final HttpsSettings httpsSettings = petstore.getOptions().httpsSettings(); - final KeyStore trustStore = CertificateUtils.getKeyStore(Resource.newResource(httpsSettings.keyStorePath()), - httpsSettings.keyStoreType(), null, httpsSettings.keyStorePassword()); - trustManagerFactory.init(trustStore); - final TrustManager trustManager = trustManagerFactory.getTrustManagers()[0]; - trustManagerParameters.setTrustManager(trustManager); - - final SSLContextParameters sslContextParameters = new SSLContextParameters(); - sslContextParameters.setCamelContext(camelContext); - sslContextParameters.setTrustManagers(trustManagerParameters); - final CipherSuitesParameters cipherSuites = new CipherSuitesParameters(); - cipherSuites.setCipherSuite(Collections.singletonList("TLS_DHE_RSA_WITH_AES_128_GCM_SHA256")); - sslContextParameters.setCipherSuites(cipherSuites); - sslContextParameters.setSecureSocketProtocol("TLSv1.3"); - return sslContextParameters; - } - -} diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java index 9ad312ff2aa..3c2078401fe 100644 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java +++ b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java @@ -166,7 +166,7 @@ public abstract class HttpsV3Test extends CamelTestSupport { @BeforeAll public static void setupStubs() throws IOException, URISyntaxException { petstore.stubFor(get(urlEqualTo("/openapi-v3.json")).willReturn(aResponse().withBody( - Files.readAllBytes(Paths.get(RestOpenApiGlobalHttpsTest.class.getResource("/openapi-v3.json").toURI()))))); + Files.readAllBytes(Paths.get(RestOpenApiGlobalHttpsV3Test.class.getResource("/openapi-v3.json").toURI()))))); petstore.stubFor( get(urlEqualTo("/api/v3/pet/14")).willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id><name>Olafur Eliason Arnalds</name></Pet>"))); diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentTest.java deleted file mode 100644 index 2d6d6f11d12..00000000000 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentTest.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rest.openapi; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.Marshaller; - -import com.github.tomakehurst.wiremock.WireMockServer; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.rest.RestEndpoint; -import org.apache.camel.converter.jaxb.JaxbDataFormat; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.junit.jupiter.params.provider.ValueSource; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class RestOpenApiComponentTest extends CamelTestSupport { - - public static WireMockServer petstore = new WireMockServer(wireMockConfig().dynamicPort()); - - static final Object NO_BODY = null; - - public String componentName; - - @BeforeAll - public static void startWireMockServer() { - petstore.start(); - } - - @AfterAll - public static void stopWireMockServer() { - petstore.stop(); - } - - @Override - public void setUp() { - } - - @BeforeEach - public void resetWireMock() { - petstore.resetRequests(); - } - - public void doSetUp(String componentName) throws Exception { - this.componentName = componentName; - super.setUp(); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeAddingPets(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = new Pet(); - pet.setName("Jean-Luc Picard"); - - final Pet created = template.requestBody("direct:addPet", pet, Pet.class); - - assertNotNull(created); - - assertEquals(14, created.getId()); - - petstore.verify( - postRequestedFor(urlEqualTo("/v2/pet")) - // Swagger V2 converted to V3 ignores "produces" if there is no associated response schema - //.withHeader("Accept", equalTo("application/xml, application/json")) - .withHeader("Content-Type", equalTo("application/xml"))); - } - - @ParameterizedTest - @ValueSource(strings = { "Classpath", "Bean", "File" }) - public void shouldBeAddingPetsDifferentLookup(String startPath) throws Exception { - doSetUp("http"); - - final Pet pet = new Pet(); - pet.setName("Jean-Luc Picard"); - - final Pet created = template.requestBody("direct:addPetVia" + startPath, pet, Pet.class); - - assertNotNull(created); - - assertEquals(14, created.getId()); - - petstore.verify( - postRequestedFor(urlEqualTo("/v2/pet")) - // Swagger V2 converted to V3 ignores "produces" if there is no associated response schema - //.withHeader("Accept", equalTo("application/xml, application/json")) - .withHeader("Content-Type", equalTo("application/xml"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsById(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = template.requestBodyAndHeader("direct:getPetById", NO_BODY, "petId", 14, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByIdSpecifiedInEndpointParameters(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = template.requestBody("direct:getPetByIdWithEndpointParams", NO_BODY, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByIdWithApiKeysInHeader(String componentName) throws Exception { - doSetUp(componentName); - - final Map<String, Object> headers = new HashMap<>(); - headers.put("petId", 14); - headers.put("api_key", "dolphins"); - final Pet pet = template.requestBodyAndHeaders("direct:getPetById", NO_BODY, headers, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify( - getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", equalTo("application/xml, application/json")) - .withHeader("api_key", equalTo("dolphins"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByIdWithApiKeysInQueryParameter(String componentName) throws Exception { - doSetUp(componentName); - - final Map<String, Object> headers = new HashMap<>(); - headers.put("petId", 14); - headers.put("api_key", "dolphins"); - final Pet pet = template.requestBodyAndHeaders("altPetStore:getPetById", NO_BODY, headers, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14?api_key=dolphins")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByStatus(String componentName) throws Exception { - doSetUp(componentName); - - final Pets pets = template.requestBodyAndHeader("direct:findPetsByStatus", NO_BODY, "status", "available", - Pets.class); - - assertNotNull(pets); - assertNotNull(pets.pets); - assertEquals(2, pets.pets.size()); - - petstore.verify( - getRequestedFor(urlPathEqualTo("/v2/pet/findByStatus")).withQueryParam("status", equalTo("available")) - .withHeader("Accept", equalTo("application/xml, application/json"))); - } - - @Override - protected CamelContext createCamelContext() throws Exception { - final CamelContext camelContext = super.createCamelContext(); - - final RestOpenApiComponent component = new RestOpenApiComponent(); - component.setComponentName(componentName); - component.setHost("http://localhost:" + petstore.port()); - - camelContext.addComponent("petStore", component); - - final RestOpenApiComponent altPetStore = new RestOpenApiComponent(); - altPetStore.setComponentName(componentName); - altPetStore.setHost("http://localhost:" + petstore.port()); - altPetStore.setSpecificationUri(RestOpenApiComponentTest.class.getResource("/alt-petstore.json").toURI()); - - camelContext.addComponent("altPetStore", altPetStore); - - camelContext.getRegistry().bind("openapiBean", new RestOpenApiBean()); - - return camelContext; - } - - @Override - protected RoutesBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - final JAXBContext jaxbContext = JAXBContext.newInstance(Pet.class, Pets.class); - - final JaxbDataFormat jaxb = new JaxbDataFormat(jaxbContext); - - jaxb.setJaxbProviderProperties(Collections.singletonMap(Marshaller.JAXB_FORMATTED_OUTPUT, false)); - - from("direct:getPetById").to("petStore:getPetById").unmarshal(jaxb); - - from("direct:getPetByIdWithEndpointParams").to("petStore:getPetById?petId=14").unmarshal(jaxb); - - from("direct:addPet").marshal(jaxb).to("petStore:addPet?specificationUri=classpath:openapi.json") - .unmarshal(jaxb); - from("direct:addPetViaClasspath").marshal(jaxb).to("petStore:addPet?specificationUri=classpath:openapi.json") - .unmarshal(jaxb); - from("direct:addPetViaBean").marshal(jaxb) - .to("petStore:addPet?specificationUri=bean:openapiBean.getOpenApiJson").unmarshal(jaxb); - from("direct:addPetViaFile").marshal(jaxb) - .to("petStore:addPet?specificationUri=file:target/test-classes/openapi.json").unmarshal(jaxb); - - from("direct:findPetsByStatus").to("petStore:findPetsByStatus").unmarshal(jaxb); - } - }; - } - - public static Iterable<String> knownProducers() { - return Arrays.asList(RestEndpoint.DEFAULT_REST_PRODUCER_COMPONENTS); - } - - @BeforeAll - public static void setupStubs() throws IOException, URISyntaxException { - petstore.stubFor(get(urlEqualTo("/openapi.json")).willReturn(aResponse().withBody( - Files.readAllBytes(Paths.get(RestOpenApiComponentTest.class.getResource("/openapi.json").toURI()))))); - - petstore.stubFor(post(urlEqualTo("/v2/pet")) - .withRequestBody(equalTo( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><name>Jean-Luc Picard</name></Pet>")) - .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_CREATED) - .withBody("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id></Pet>"))); - - petstore.stubFor( - get(urlEqualTo("/v2/pet/14")).willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id><name>Olafur Eliason Arnalds</name></Pet>"))); - - petstore.stubFor(get(urlPathEqualTo("/v2/pet/findByStatus")).withQueryParam("status", equalTo("available")) - .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><pets><Pet><id>1</id><name>Olafur Eliason Arnalds</name></Pet><Pet><name>Jean-Luc Picard</name></Pet></pets>"))); - - petstore.stubFor(get(urlEqualTo("/v2/pet/14?api_key=dolphins")) - .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id><name>Olafur Eliason Arnalds</name></Pet>"))); - } - -} diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentYamlTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentYamlTest.java deleted file mode 100644 index 4156a57cd8f..00000000000 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentYamlTest.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rest.openapi; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.Marshaller; - -import com.github.tomakehurst.wiremock.WireMockServer; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.rest.RestEndpoint; -import org.apache.camel.converter.jaxb.JaxbDataFormat; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class RestOpenApiComponentYamlTest extends CamelTestSupport { - - public static WireMockServer petstore = new WireMockServer(wireMockConfig().dynamicPort()); - - static final Object NO_BODY = null; - - public String componentName; - - @BeforeAll - public static void startWireMockServer() { - petstore.start(); - } - - @AfterAll - public static void stopWireMockServer() { - petstore.stop(); - } - - @Override - public void setUp() { - } - - @BeforeEach - public void resetWireMock() { - petstore.resetRequests(); - } - - public void doSetUp(String componentName) throws Exception { - this.componentName = componentName; - super.setUp(); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeAddingPets(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = new Pet(); - pet.setName("Jean-Luc Picard"); - - final Pet created = template.requestBody("direct:addPet", pet, Pet.class); - - assertNotNull(created); - - assertEquals(14, created.getId()); - - petstore.verify( - postRequestedFor(urlEqualTo("/v2/pet")) - // Swagger V2 converted to V3 ignores "produces" if there is no associated response schema - //.withHeader("Accept", equalTo("application/xml, application/json")) - .withHeader("Content-Type", equalTo("application/xml"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsById(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = template.requestBodyAndHeader("direct:getPetById", NO_BODY, "petId", 14, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByIdSpecifiedInEndpointParameters(String componentName) throws Exception { - doSetUp(componentName); - - final Pet pet = template.requestBody("direct:getPetByIdWithEndpointParams", NO_BODY, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByIdWithApiKeysInHeader(String componentName) throws Exception { - doSetUp(componentName); - - final Map<String, Object> headers = new HashMap<>(); - headers.put("petId", 14); - headers.put("api_key", "dolphins"); - final Pet pet = template.requestBodyAndHeaders("direct:getPetById", NO_BODY, headers, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify( - getRequestedFor(urlEqualTo("/v2/pet/14")).withHeader("Accept", equalTo("application/xml, application/json")) - .withHeader("api_key", equalTo("dolphins"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByIdWithApiKeysInQueryParameter(String componentName) throws Exception { - doSetUp(componentName); - - final Map<String, Object> headers = new HashMap<>(); - headers.put("petId", 14); - headers.put("api_key", "dolphins"); - final Pet pet = template.requestBodyAndHeaders("altPetStore:getPetById", NO_BODY, headers, Pet.class); - - assertNotNull(pet); - - assertEquals(14, pet.getId()); - assertEquals("Olafur Eliason Arnalds", pet.getName()); - - petstore.verify(getRequestedFor(urlEqualTo("/v2/pet/14?api_key=dolphins")).withHeader("Accept", - equalTo("application/xml, application/json"))); - } - - @ParameterizedTest - @MethodSource("knownProducers") - public void shouldBeGettingPetsByStatus(String componentName) throws Exception { - doSetUp(componentName); - - final Pets pets = template.requestBodyAndHeader("direct:findPetsByStatus", NO_BODY, "status", "available", - Pets.class); - - assertNotNull(pets); - assertNotNull(pets.pets); - assertEquals(2, pets.pets.size()); - - petstore.verify( - getRequestedFor(urlPathEqualTo("/v2/pet/findByStatus")).withQueryParam("status", equalTo("available")) - .withHeader("Accept", equalTo("application/xml, application/json"))); - } - - @Override - protected CamelContext createCamelContext() throws Exception { - final CamelContext camelContext = super.createCamelContext(); - - final RestOpenApiComponent component = new RestOpenApiComponent(); - component.setComponentName(componentName); - component.setHost("http://localhost:" + petstore.port()); - component.setSpecificationUri(RestOpenApiComponentYamlTest.class.getResource("/openapi.yaml").toURI()); - - camelContext.addComponent("petStore", component); - - final RestOpenApiComponent altPetStore = new RestOpenApiComponent(); - altPetStore.setComponentName(componentName); - altPetStore.setHost("http://localhost:" + petstore.port()); - altPetStore.setSpecificationUri(RestOpenApiComponentYamlTest.class.getResource("/alt-petstore.yaml").toURI()); - - camelContext.addComponent("altPetStore", altPetStore); - - return camelContext; - } - - @Override - protected RoutesBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - final JAXBContext jaxbContext = JAXBContext.newInstance(Pet.class, Pets.class); - - final JaxbDataFormat jaxb = new JaxbDataFormat(jaxbContext); - - jaxb.setJaxbProviderProperties(Collections.singletonMap(Marshaller.JAXB_FORMATTED_OUTPUT, false)); - - from("direct:getPetById").to("petStore:getPetById").unmarshal(jaxb); - - from("direct:getPetByIdWithEndpointParams").to("petStore:getPetById?petId=14").unmarshal(jaxb); - - from("direct:addPet").marshal(jaxb).to("petStore:addPet").unmarshal(jaxb); - - from("direct:findPetsByStatus").to("petStore:findPetsByStatus").unmarshal(jaxb); - } - }; - } - - public static Iterable<String> knownProducers() { - return Arrays.asList(RestEndpoint.DEFAULT_REST_PRODUCER_COMPONENTS); - } - - @BeforeAll - public static void setupStubs() throws IOException, URISyntaxException { - petstore.stubFor(get(urlEqualTo("/openapi.yaml")).willReturn(aResponse().withBody( - Files.readAllBytes(Paths.get(RestOpenApiComponentYamlTest.class.getResource("/openapi.yaml").toURI()))))); - - petstore.stubFor(post(urlEqualTo("/v2/pet")) - .withRequestBody(equalTo( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><name>Jean-Luc Picard</name></Pet>")) - .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_CREATED) - .withBody("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id></Pet>"))); - - petstore.stubFor( - get(urlEqualTo("/v2/pet/14")).willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id><name>Olafur Eliason Arnalds</name></Pet>"))); - - petstore.stubFor(get(urlPathEqualTo("/v2/pet/findByStatus")).withQueryParam("status", equalTo("available")) - .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><pets><Pet><id>1</id><name>Olafur Eliason Arnalds</name></Pet><Pet><name>Jean-Luc Picard</name></Pet></pets>"))); - - petstore.stubFor(get(urlEqualTo("/v2/pet/14?api_key=dolphins")) - .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody( - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Pet><id>14</id><name>Olafur Eliason Arnalds</name></Pet>"))); - } - -} diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java deleted file mode 100644 index 6bd4da5204c..00000000000 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rest.openapi; - -import org.apache.camel.CamelContext; -import org.apache.camel.Component; -import org.apache.camel.support.PluginHelper; -import org.apache.camel.support.PropertyBindingSupport; - -public class RestOpenApiDelegateHttpsTest extends HttpsTest { - - @Override - protected CamelContext createCamelContext() throws Exception { - final CamelContext camelContext = super.createCamelContext(); - - // since camel context is not started, then we need to manually initialize the delegate - final Component delegate = PluginHelper.getComponentResolver(camelContext) - .resolveComponent(componentName, camelContext); - delegate.setCamelContext(camelContext); - delegate.init(); - - // and configure the ssl context parameters via binding - new PropertyBindingSupport.Builder() - .withCamelContext(camelContext) - .withProperty("sslContextParameters", createHttpsParameters(camelContext)) - .withTarget(delegate) - .withConfigurer(delegate.getComponentPropertyConfigurer()) - .bind(); - camelContext.addComponent(componentName, delegate); - - return camelContext; - } - -} diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsTest.java deleted file mode 100644 index 064b0cb701d..00000000000 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rest.openapi; - -import org.apache.camel.CamelContext; - -public class RestOpenApiGlobalHttpsTest extends HttpsTest { - - @Override - protected CamelContext createCamelContext() throws Exception { - CamelContext camelContext = super.createCamelContext(); - camelContext.setSSLContextParameters(createHttpsParameters(camelContext)); - - RestOpenApiComponent component = camelContext.getComponent("petStore", RestOpenApiComponent.class); - component.setUseGlobalSslContextParameters(true); - - return camelContext; - } -} diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsV31Test.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsV31Test.java index 88888a52bf3..50acc2d2213 100644 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsV31Test.java +++ b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiGlobalHttpsV31Test.java @@ -34,7 +34,7 @@ public class RestOpenApiGlobalHttpsV31Test extends HttpsV3Test { public static void setupStubForSpec() throws IOException, URISyntaxException { petstore.stubFor(get(urlEqualTo("/petstore-3.1-ssl.yaml")).willReturn(aResponse().withBody( Files.readAllBytes( - Paths.get(RestOpenApiGlobalHttpsTest.class.getResource("/petstore-3.1-ssl.yaml").toURI()))))); + Paths.get(RestOpenApiGlobalHttpsV3Test.class.getResource("/petstore-3.1-ssl.yaml").toURI()))))); } @Override diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java index 369ead0a0ca..82593e6c461 100644 --- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java +++ b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java @@ -78,10 +78,8 @@ public class RestOpenApiRequestValidationTest extends CamelTestSupport { @BeforeAll public static void startWireMockServer() throws Exception { wireMockServer.start(); - setUpPetStoreStubs("/openapi.json", "/v2/pet"); setUpPetStoreStubs("/openapi-v3.json", "/api/v3/pet"); setUpPetStoreStubs("/petstore-3.1.yaml", "/api/v31/pet"); - setUpFruitsApiStubs("/fruits-2.0.yaml"); setUpFruitsApiStubs("/fruits-3.0.yaml"); } @@ -348,7 +346,7 @@ public class RestOpenApiRequestValidationTest extends CamelTestSupport { } @ParameterizedTest - @ValueSource(strings = { "petStoreV2", "petStoreV3" }) + @ValueSource(strings = { "petStoreV3" }) void requestValidationWithBinaryBody(String petStoreVersion) throws IOException { Map<String, Object> headers = Map.of( "petId", 1, @@ -460,10 +458,8 @@ public class RestOpenApiRequestValidationTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); - camelContext.addComponent("petStoreV2", createRestOpenApiComponent("openapi.json")); camelContext.addComponent("petStoreV3", createRestOpenApiComponent("openapi-v3.json")); camelContext.addComponent("petStoreV31", createRestOpenApiComponent("petstore-3.1.yaml")); - camelContext.addComponent("fruitsV2", createRestOpenApiComponent("fruits-2.0.yaml")); camelContext.addComponent("fruitsV3", createRestOpenApiComponent("fruits-3.0.yaml")); camelContext.getGlobalOptions().put("CamelJacksonEnableTypeConverter", "true"); camelContext.getGlobalOptions().put("CamelJacksonTypeConverterToPojo", "true"); @@ -471,11 +467,11 @@ public class RestOpenApiRequestValidationTest extends CamelTestSupport { } public static Iterable<String> petStoreVersions() { - return List.of("petStoreV2", "petStoreV3", "petStoreV31"); + return List.of("petStoreV3", "petStoreV31"); } public static Iterable<String> fruitsApiVersions() { - return List.of("fruitsV2", "fruitsV3"); + return List.of("fruitsV3"); } @Override diff --git a/components/camel-rest-openapi/src/test/resources/alt-petstore.json b/components/camel-rest-openapi/src/test/resources/alt-petstore.json deleted file mode 100644 index 12cd770dfbb..00000000000 --- a/components/camel-rest-openapi/src/test/resources/alt-petstore.json +++ /dev/null @@ -1,1039 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "This is a sample server Petstore server. You can find out more about OpenApi at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", - "version": "1.0.0", - "title": "OpenApi Petstore", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "email": "[email protected]" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "host": "petstore.swagger.io", - "basePath": "/v2", - "tags": [ - { - "name": "pet", - "description": "Everything about your Pets", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - }, - { - "name": "store", - "description": "Access to Petstore orders" - }, - { - "name": "user", - "description": "Operations about user", - "externalDocs": { - "description": "Find out more about our store", - "url": "http://swagger.io" - } - } - ], - "schemes": [ - "http" - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "pet" - ], - "summary": "Add a new pet to the store", - "description": "", - "operationId": "addPet", - "consumes": [ - "application/json", - "application/xml" - ], - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - } - } - ], - "responses": { - "405": { - "description": "Invalid input" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - }, - "put": { - "tags": [ - "pet" - ], - "summary": "Update an existing pet", - "description": "", - "operationId": "updatePet", - "consumes": [ - "application/json", - "application/xml" - ], - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - } - } - ], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - }, - "405": { - "description": "Validation exception" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "pet" - ], - "summary": "Finds Pets by status", - "description": "Multiple status values can be provided with comma separated strings", - "operationId": "findPetsByStatus", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "status", - "in": "query", - "description": "Status values that need to be considered for filter", - "required": true, - "type": "array", - "items": { - "type": "string", - "enum": [ - "available", - "pending", - "sold" - ], - "default": "available" - }, - "collectionFormat": "multi" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "description": "Invalid status value" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - } - }, - "/pet/findByTags": { - "get": { - "tags": [ - "pet" - ], - "summary": "Finds Pets by tags", - "description": "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - "operationId": "findPetsByTags", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "Tags to filter by", - "required": true, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "description": "Invalid tag value" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ], - "deprecated": true - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "pet" - ], - "summary": "Find pet by ID", - "description": "Returns a single pet", - "operationId": "getPetById", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "ID of pet to return", - "required": true, - "type": "integer", - "format": "int64" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - } - }, - "security": [ - { - "api_key": [ - ] - } - ] - }, - "post": { - "tags": [ - "pet" - ], - "summary": "Updates a pet in the store with form data", - "description": "", - "operationId": "updatePetWithForm", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "ID of pet that needs to be updated", - "required": true, - "type": "integer", - "format": "int64" - }, - { - "name": "name", - "in": "formData", - "description": "Updated name of the pet", - "required": false, - "type": "string" - }, - { - "name": "status", - "in": "formData", - "description": "Updated status of the pet", - "required": false, - "type": "string" - } - ], - "responses": { - "405": { - "description": "Invalid input" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - }, - "delete": { - "tags": [ - "pet" - ], - "summary": "Deletes a pet", - "description": "", - "operationId": "deletePet", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "api_key", - "in": "header", - "required": false, - "type": "string" - }, - { - "name": "petId", - "in": "path", - "description": "Pet id to delete", - "required": true, - "type": "integer", - "format": "int64" - } - ], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "pet" - ], - "summary": "uploads an image", - "description": "", - "operationId": "uploadFile", - "consumes": [ - "multipart/form-data" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "ID of pet to update", - "required": true, - "type": "integer", - "format": "int64" - }, - { - "name": "additionalMetadata", - "in": "formData", - "description": "Additional data to pass to server", - "required": false, - "type": "string" - }, - { - "name": "file", - "in": "formData", - "description": "file to upload", - "required": false, - "type": "file" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - } - }, - "/store/inventory": { - "get": { - "tags": [ - "store" - ], - "summary": "Returns pet inventories by status", - "description": "Returns a map of status codes to quantities", - "operationId": "getInventory", - "produces": [ - "application/json" - ], - "parameters": [ - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int32" - } - } - } - }, - "security": [ - { - "api_key": [ - ] - } - ] - } - }, - "/store/order": { - "post": { - "tags": [ - "store" - ], - "summary": "Place an order for a pet", - "description": "", - "operationId": "placeOrder", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "order placed for purchasing the pet", - "required": true, - "schema": { - "$ref": "#/definitions/Order" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid Order" - } - } - } - }, - "/store/order/{orderId}": { - "get": { - "tags": [ - "store" - ], - "summary": "Find purchase order by ID", - "description": "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions", - "operationId": "getOrderById", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "orderId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "integer", - "maximum": 10.0, - "minimum": 1.0, - "format": "int64" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Order not found" - } - } - }, - "delete": { - "tags": [ - "store" - ], - "summary": "Delete purchase order by ID", - "description": "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors", - "operationId": "deleteOrder", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "orderId", - "in": "path", - "description": "ID of the order that needs to be deleted", - "required": true, - "type": "integer", - "minimum": 1.0, - "format": "int64" - } - ], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Order not found" - } - } - } - }, - "/user": { - "post": { - "tags": [ - "user" - ], - "summary": "Create user", - "description": "This can only be done by the logged in user.", - "operationId": "createUser", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "Created user object", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } - } - ], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/createWithArray": { - "post": { - "tags": [ - "user" - ], - "summary": "Creates list of users with given input array", - "description": "", - "operationId": "createUsersWithArrayInput", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "List of user object", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - } - } - ], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/createWithList": { - "post": { - "tags": [ - "user" - ], - "summary": "Creates list of users with given input array", - "description": "", - "operationId": "createUsersWithListInput", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "List of user object", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - } - } - ], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/login": { - "get": { - "tags": [ - "user" - ], - "summary": "Logs user into the system", - "description": "", - "operationId": "loginUser", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "username", - "in": "query", - "description": "The user name for login", - "required": true, - "type": "string" - }, - { - "name": "password", - "in": "query", - "description": "The password for login in clear text", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "string" - }, - "headers": { - "X-Rate-Limit": { - "type": "integer", - "format": "int32", - "description": "calls per hour allowed by the user" - }, - "X-Expires-After": { - "type": "string", - "format": "date-time", - "description": "date in UTC when token expires" - } - } - }, - "400": { - "description": "Invalid username/password supplied" - } - } - } - }, - "/user/logout": { - "get": { - "tags": [ - "user" - ], - "summary": "Logs out current logged in user session", - "description": "", - "operationId": "logoutUser", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - ], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/{username}": { - "get": { - "tags": [ - "user" - ], - "summary": "Get user by user name", - "description": "", - "operationId": "getUserByName", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "description": "The name that needs to be fetched. Use user1 for testing. ", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/User" - } - }, - "400": { - "description": "Invalid username supplied" - }, - "404": { - "description": "User not found" - } - } - }, - "put": { - "tags": [ - "user" - ], - "summary": "Updated user", - "description": "This can only be done by the logged in user.", - "operationId": "updateUser", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "description": "name that need to be updated", - "required": true, - "type": "string" - }, - { - "in": "body", - "name": "body", - "description": "Updated user object", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } - } - ], - "responses": { - "400": { - "description": "Invalid user supplied" - }, - "404": { - "description": "User not found" - } - } - }, - "delete": { - "tags": [ - "user" - ], - "summary": "Delete user", - "description": "This can only be done by the logged in user.", - "operationId": "deleteUser", - "produces": [ - "application/xml", - "application/json" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "description": "The name that needs to be deleted", - "required": true, - "type": "string" - } - ], - "responses": { - "400": { - "description": "Invalid username supplied" - }, - "404": { - "description": "User not found" - } - } - } - } - }, - "securityDefinitions": { - "petstore_auth": { - "type": "oauth2", - "authorizationUrl": "http://petstore.swagger.io/oauth/dialog", - "flow": "implicit", - "scopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "api_key": { - "type": "apiKey", - "name": "api_key", - "in": "query" - } - }, - "definitions": { - "Order": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "petId": { - "type": "integer", - "format": "int64" - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "shipDate": { - "type": "string", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order Status", - "enum": [ - "placed", - "approved", - "delivered" - ] - }, - "complete": { - "type": "boolean", - "default": false - } - }, - "xml": { - "name": "Order" - } - }, - "Category": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Category" - } - }, - "User": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "username": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "email": { - "type": "string" - }, - "password": { - "type": "string" - }, - "phone": { - "type": "string" - }, - "userStatus": { - "type": "integer", - "format": "int32", - "description": "User Status" - } - }, - "xml": { - "name": "User" - } - }, - "Tag": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Tag" - } - }, - "Pet": { - "type": "object", - "required": [ - "name", - "photoUrls" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "category": { - "$ref": "#/definitions/Category" - }, - "name": { - "type": "string", - "example": "doggie" - }, - "photoUrls": { - "type": "array", - "xml": { - "name": "photoUrl", - "wrapped": true - }, - "items": { - "type": "string" - } - }, - "tags": { - "type": "array", - "xml": { - "name": "tag", - "wrapped": true - }, - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "description": "pet status in the store", - "enum": [ - "available", - "pending", - "sold" - ] - } - }, - "xml": { - "name": "Pet" - } - }, - "ApiResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "type": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "externalDocs": { - "description": "Find out more about OpenApi", - "url": "http://swagger.io" - } -} diff --git a/components/camel-rest-openapi/src/test/resources/alt-petstore.yaml b/components/camel-rest-openapi/src/test/resources/alt-petstore.yaml deleted file mode 100644 index 29275709223..00000000000 --- a/components/camel-rest-openapi/src/test/resources/alt-petstore.yaml +++ /dev/null @@ -1,716 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -swagger: "2.0" -info: - description: 'This is a sample server Petstore server. You can find out more about OpenApi at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.' - version: 1.0.0 - title: OpenApi Petstore - termsOfService: http://swagger.io/terms/ - contact: - email: [email protected] - license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html -host: petstore.swagger.io -basePath: /v2 -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: http://swagger.io - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: http://swagger.io -schemes: - - http -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: "" - operationId: addPet - consumes: - - application/json - - application/xml - produces: - - application/xml - - application/json - parameters: - - in: body - name: body - description: Pet object that needs to be added to the store - required: true - schema: - $ref: '#/definitions/Pet' - responses: - "405": - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets - put: - tags: - - pet - summary: Update an existing pet - description: "" - operationId: updatePet - consumes: - - application/json - - application/xml - produces: - - application/xml - - application/json - parameters: - - in: body - name: body - description: Pet object that needs to be added to the store - required: true - schema: - $ref: '#/definitions/Pet' - responses: - "400": - description: Invalid ID supplied - "404": - description: Pet not found - "405": - description: Validation exception - security: - - petstore_auth: - - write:pets - - read:pets - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - produces: - - application/xml - - application/json - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - type: array - items: - type: string - enum: - - available - - pending - - sold - default: available - collectionFormat: multi - responses: - "200": - description: successful operation - schema: - type: array - items: - $ref: '#/definitions/Pet' - "400": - description: Invalid status value - security: - - petstore_auth: - - write:pets - - read:pets - /pet/findByTags: - get: - tags: - - pet - summary: Finds Pets by tags - description: Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - operationId: findPetsByTags - produces: - - application/xml - - application/json - parameters: - - name: tags - in: query - description: Tags to filter by - required: true - type: array - items: - type: string - collectionFormat: multi - responses: - "200": - description: successful operation - schema: - type: array - items: - $ref: '#/definitions/Pet' - "400": - description: Invalid tag value - security: - - petstore_auth: - - write:pets - - read:pets - deprecated: true - /pet/{petId}: - get: - tags: - - pet - summary: Find pet by ID - description: Returns a single pet - operationId: getPetById - produces: - - application/xml - - application/json - parameters: - - name: petId - in: path - description: ID of pet to return - required: true - type: integer - format: int64 - responses: - "200": - description: successful operation - schema: - $ref: '#/definitions/Pet' - "400": - description: Invalid ID supplied - "404": - description: Pet not found - security: - - api_key: [] - post: - tags: - - pet - summary: Updates a pet in the store with form data - description: "" - operationId: updatePetWithForm - consumes: - - application/x-www-form-urlencoded - produces: - - application/xml - - application/json - parameters: - - name: petId - in: path - description: ID of pet that needs to be updated - required: true - type: integer - format: int64 - - name: name - in: formData - description: Updated name of the pet - required: false - type: string - - name: status - in: formData - description: Updated status of the pet - required: false - type: string - responses: - "405": - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets - delete: - tags: - - pet - summary: Deletes a pet - description: "" - operationId: deletePet - produces: - - application/xml - - application/json - parameters: - - name: api_key - in: header - required: false - type: string - - name: petId - in: path - description: Pet id to delete - required: true - type: integer - format: int64 - responses: - "400": - description: Invalid ID supplied - "404": - description: Pet not found - security: - - petstore_auth: - - write:pets - - read:pets - /pet/{petId}/uploadImage: - post: - tags: - - pet - summary: uploads an image - description: "" - operationId: uploadFile - consumes: - - multipart/form-data - produces: - - application/json - parameters: - - name: petId - in: path - description: ID of pet to update - required: true - type: integer - format: int64 - - name: additionalMetadata - in: formData - description: Additional data to pass to server - required: false - type: string - - name: file - in: formData - description: file to upload - required: false - type: file - responses: - "200": - description: successful operation - schema: - $ref: '#/definitions/ApiResponse' - security: - - petstore_auth: - - write:pets - - read:pets - /store/inventory: - get: - tags: - - store - summary: Returns pet inventories by status - description: Returns a map of status codes to quantities - operationId: getInventory - produces: - - application/json - parameters: [] - responses: - "200": - description: successful operation - schema: - type: object - additionalProperties: - type: integer - format: int32 - security: - - api_key: [] - /store/order: - post: - tags: - - store - summary: Place an order for a pet - description: "" - operationId: placeOrder - produces: - - application/xml - - application/json - parameters: - - in: body - name: body - description: order placed for purchasing the pet - required: true - schema: - $ref: '#/definitions/Order' - responses: - "200": - description: successful operation - schema: - $ref: '#/definitions/Order' - "400": - description: Invalid Order - /store/order/{orderId}: - get: - tags: - - store - summary: Find purchase order by ID - description: For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions - operationId: getOrderById - produces: - - application/xml - - application/json - parameters: - - name: orderId - in: path - description: ID of pet that needs to be fetched - required: true - type: integer - maximum: 10.0 - minimum: 1.0 - format: int64 - responses: - "200": - description: successful operation - schema: - $ref: '#/definitions/Order' - "400": - description: Invalid ID supplied - "404": - description: Order not found - delete: - tags: - - store - summary: Delete purchase order by ID - description: For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors - operationId: deleteOrder - produces: - - application/xml - - application/json - parameters: - - name: orderId - in: path - description: ID of the order that needs to be deleted - required: true - type: integer - minimum: 1.0 - format: int64 - responses: - "400": - description: Invalid ID supplied - "404": - description: Order not found - /user: - post: - tags: - - user - summary: Create user - description: This can only be done by the logged in user. - operationId: createUser - produces: - - application/xml - - application/json - parameters: - - in: body - name: body - description: Created user object - required: true - schema: - $ref: '#/definitions/User' - responses: - default: - description: successful operation - /user/createWithArray: - post: - tags: - - user - summary: Creates list of users with given input array - description: "" - operationId: createUsersWithArrayInput - produces: - - application/xml - - application/json - parameters: - - in: body - name: body - description: List of user object - required: true - schema: - type: array - items: - $ref: '#/definitions/User' - responses: - default: - description: successful operation - /user/createWithList: - post: - tags: - - user - summary: Creates list of users with given input array - description: "" - operationId: createUsersWithListInput - produces: - - application/xml - - application/json - parameters: - - in: body - name: body - description: List of user object - required: true - schema: - type: array - items: - $ref: '#/definitions/User' - responses: - default: - description: successful operation - /user/login: - get: - tags: - - user - summary: Logs user into the system - description: "" - operationId: loginUser - produces: - - application/xml - - application/json - parameters: - - name: username - in: query - description: The user name for login - required: true - type: string - - name: password - in: query - description: The password for login in clear text - required: true - type: string - responses: - "200": - description: successful operation - schema: - type: string - headers: - X-Rate-Limit: - type: integer - format: int32 - description: calls per hour allowed by the user - X-Expires-After: - type: string - format: date-time - description: date in UTC when token expires - "400": - description: Invalid username/password supplied - /user/logout: - get: - tags: - - user - summary: Logs out current logged in user session - description: "" - operationId: logoutUser - produces: - - application/xml - - application/json - parameters: [] - responses: - default: - description: successful operation - /user/{username}: - get: - tags: - - user - summary: Get user by user name - description: "" - operationId: getUserByName - produces: - - application/xml - - application/json - parameters: - - name: username - in: path - description: 'The name that needs to be fetched. Use user1 for testing. ' - required: true - type: string - responses: - "200": - description: successful operation - schema: - $ref: '#/definitions/User' - "400": - description: Invalid username supplied - "404": - description: User not found - put: - tags: - - user - summary: Updated user - description: This can only be done by the logged in user. - operationId: updateUser - produces: - - application/xml - - application/json - parameters: - - name: username - in: path - description: name that need to be updated - required: true - type: string - - in: body - name: body - description: Updated user object - required: true - schema: - $ref: '#/definitions/User' - responses: - "400": - description: Invalid user supplied - "404": - description: User not found - delete: - tags: - - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: deleteUser - produces: - - application/xml - - application/json - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - type: string - responses: - "400": - description: Invalid username supplied - "404": - description: User not found -securityDefinitions: - petstore_auth: - type: oauth2 - authorizationUrl: http://petstore.swagger.io/oauth/dialog - flow: implicit - scopes: - write:pets: modify pets in your account - read:pets: read your pets - api_key: - type: apiKey - name: api_key - in: query -definitions: - Order: - type: object - properties: - id: - type: integer - format: int64 - petId: - type: integer - format: int64 - quantity: - type: integer - format: int32 - shipDate: - type: string - format: date-time - status: - type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - type: boolean - default: false - xml: - name: Order - Category: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string - xml: - name: Category - User: - type: object - properties: - id: - type: integer - format: int64 - username: - type: string - firstName: - type: string - lastName: - type: string - email: - type: string - password: - type: string - phone: - type: string - userStatus: - type: integer - format: int32 - description: User Status - xml: - name: User - Tag: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string - xml: - name: Tag - Pet: - type: object - required: - - name - - photoUrls - properties: - id: - type: integer - format: int64 - category: - $ref: '#/definitions/Category' - name: - type: string - example: doggie - photoUrls: - type: array - xml: - name: photoUrl - wrapped: true - items: - type: string - tags: - type: array - xml: - name: tag - wrapped: true - items: - $ref: '#/definitions/Tag' - status: - type: string - description: pet status in the store - enum: - - available - - pending - - sold - xml: - name: Pet - ApiResponse: - type: object - properties: - code: - type: integer - format: int32 - type: - type: string - message: - type: string -externalDocs: - description: Find out more about OpenApi - url: http://swagger.io diff --git a/components/camel-rest-openapi/src/test/resources/fruits-2.0.yaml b/components/camel-rest-openapi/src/test/resources/fruits-2.0.yaml deleted file mode 100644 index b0b312fe869..00000000000 --- a/components/camel-rest-openapi/src/test/resources/fruits-2.0.yaml +++ /dev/null @@ -1,146 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -swagger: '2.0' -info: - title: Fruits API - version: 1.0.0 -paths: - /api/v1/fruit: - patch: - operationId: updateFruit - consumes: - - application/json - produces: - - application/json - parameters: - - in: body - name: body - schema: - $ref: '#/definitions/Fruit' - responses: - '200': - description: OK - schema: - $ref: '#/definitions/Fruit' - tags: - - Api Spec - post: - operationId: addFruit - consumes: - - application/json - produces: - - application/json - parameters: - - format: int32 - in: query - name: id - type: integer - - in: body - name: body - schema: - $ref: '#/definitions/Fruit' - responses: - '200': - description: OK - schema: - $ref: '#/definitions/Fruit' - tags: - - Api Spec - delete: - operationId: deleteFruits - parameters: - - format: int32 - in: query - name: id - required: true - type: array - responses: - '200': - description: OK - tags: - - Api Spec - /api/v1/fruit/form: - post: - operationId: addFruitFromForm - consumes: - - application/x-www-form-urlencoded - produces: - - application/json - parameters: - - in: formData - name: name - type: string - - in: formData - name: color - type: string - responses: - '200': - description: OK - schema: - $ref: '#/definitions/Fruit' - tags: - - Api Spec - '/api/v1/fruit/{id}': - delete: - operationId: deleteFruit - produces: - - application/json - parameters: - - format: int32 - in: path - name: id - required: true - type: integer - - in: header - name: deletedBy - type: string - - in: header - name: deletionReason - required: true - type: array - responses: - '200': - description: OK - schema: - $ref: '#/definitions/Fruit' - tags: - - Api Spec -definitions: - Fruit: - required: - - name - - color - properties: - color: - type: string - deletedBy: - type: string - deletionReason: - type: string - id: - format: int32 - type: integer - name: - type: string - type: object -securityDefinitions: - SecurityScheme: - description: Authentication - type: basic -x-components: {} -
