You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/03/10 18:34:28 UTC
(camel) 01/04: openapi v2 (swagger) is not supported
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.git
commit db5063abaaac9969ff9f14656d10282c54f30134
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Mar 10 18:29:40 2024 +0100
openapi v2 (swagger) is not supported
---
.../generator/openapi/RestDslGeneratorTest.java | 254 -----
.../generator/openapi/RestDslGeneratorV3Test.java | 2 +-
.../generator/openapi/RestDslXmlGeneratorTest.java | 114 ---
.../openapi/RestDslXmlGeneratorV3SimpleTest.java | 2 +-
.../openapi/RestDslXmlGeneratorV3Test.java | 4 +-
.../openapi/RestDslYamlGeneratorV302Test.java | 2 +-
.../openapi/RestDslYamlGeneratorV3SimpleTest.java | 2 +-
...GeneratorV3SimpleWithRoutesDescriptionTest.java | 2 +-
...RestDslYamlGeneratorV3SimpleWithRoutesTest.java | 2 +-
.../openapi/RestDslYamlGeneratorV3Test.java | 4 +-
.../openapi/RestDslYamlGreetingsTest.java | 2 +-
.../src/test/resources/MyRestRoute.txt | 322 ------
.../src/test/resources/MyRestRouteFilter.txt | 86 --
.../src/test/resources/OpenApiPetstore.txt | 319 ------
.../resources/OpenApiPetstoreWithRestComponent.txt | 321 ------
.../OpenApiPetstoreWithRestComponentXml.txt | 92 --
.../src/test/resources/OpenApiPetstoreXml.txt | 91 --
.../apache/camel/generator/openapi/openapi-v2.json | 1042 --------------------
18 files changed, 11 insertions(+), 2652 deletions(-)
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorTest.java
deleted file mode 100644
index f154cd3f2b2..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorTest.java
+++ /dev/null
@@ -1,254 +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.generator.openapi;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.time.Instant;
-
-import io.apicurio.datamodels.Library;
-import io.apicurio.datamodels.models.openapi.OpenApiDocument;
-import io.apicurio.datamodels.models.openapi.v20.OpenApi20Document;
-import io.apicurio.datamodels.models.openapi.v20.OpenApi20DocumentImpl;
-import io.apicurio.datamodels.models.openapi.v30.OpenApi30Document;
-import io.apicurio.datamodels.models.openapi.v30.OpenApi30DocumentImpl;
-import io.apicurio.datamodels.models.openapi.v30.OpenApi30Server;
-import io.apicurio.datamodels.models.openapi.v30.OpenApi30ServerImpl;
-import io.apicurio.datamodels.models.openapi.v30.OpenApi30ServerVariable;
-import io.apicurio.datamodels.models.openapi.v30.OpenApi30ServerVariableImpl;
-import org.apache.camel.CamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.model.rest.RestsDefinition;
-import org.apache.camel.util.IOHelper;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RestDslGeneratorTest {
-
- static OpenApiDocument document;
-
- final Instant generated = Instant.parse("2017-10-17T00:00:00.000Z");
-
- @Test
- public void shouldCreateDefinitions() throws Exception {
- try (CamelContext context = new DefaultCamelContext()) {
- final RestsDefinition definition = RestDslGenerator.toDefinition(document).generate();
- assertThat(definition).isNotNull();
- assertThat(definition.getRests()).hasSize(1);
- assertThat(definition.getRests().get(0).getPath()).isEqualTo("/v2");
- }
- }
-
- @Test
- public void shouldDetermineBasePathFromV2Document() {
- final OpenApi20Document oas20Document = new OpenApi20DocumentImpl();
- oas20Document.setBasePath("/api");
- assertThat(RestDslGenerator.determineBasePathFrom(oas20Document)).isEqualTo("/api");
- }
-
- @Test
- public void shouldDetermineBasePathFromV3DocumentsServerUrl() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- server.setUrl("https://example.com/api");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom(oas30Document)).isEqualTo("/api");
- }
-
- @Test
- public void shouldDetermineBasePathFromV3DocumentsServerUrlWithTemplateVariables() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- addVariableTo(server, "base", "api");
- addVariableTo(server, "path", "v3");
- server.setUrl("https://example.com/{base}/{path}");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom(oas30Document)).isEqualTo("/api/v3");
- }
-
- @Test
- public void shouldDetermineBasePathFromV3DocumentsWhenServerUrlIsRelative() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- server.setUrl("api/v3");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom(oas30Document)).isEqualTo("/api/v3");
- }
-
- @Test
- public void shouldDetermineBasePathFromV3DocumentsWhenServerUrlIsRelativeWithoutStartingSlash() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- server.setUrl("api/v3");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom(oas30Document)).isEqualTo("/api/v3");
- }
-
- @Test
- public void shouldDetermineBasePathFromParameterOverDocument() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- server.setUrl("api/v3");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom("/api/v4", oas30Document)).isEqualTo("/api/v4");
- }
-
- @Test
- public void shouldDetermineBasePathFromParameterOverDocumentWithoutStartingSlash() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- server.setUrl("api/v3");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom("api/v4", oas30Document)).isEqualTo("/api/v4");
- }
-
- @Test
- public void shouldDetermineBasePathFromParameterOverDocumentWithEmptyParameter() {
- final OpenApi30Document oas30Document = new OpenApi30DocumentImpl();
- final OpenApi30Server server = new OpenApi30ServerImpl();
- server.setUrl("/api/v3");
-
- oas30Document.addServer(server);
- assertThat(RestDslGenerator.determineBasePathFrom(null, oas30Document)).isEqualTo("/api/v3");
- assertThat(RestDslGenerator.determineBasePathFrom("/", oas30Document)).isEqualTo("");
- assertThat(RestDslGenerator.determineBasePathFrom("", oas30Document)).isEqualTo("");
- assertThat(RestDslGenerator.determineBasePathFrom(" ", oas30Document)).isEqualTo("");
- }
-
- @Test
- public void shouldGenerateSourceCodeWithDefaults() throws Exception {
- final StringBuilder code = new StringBuilder();
-
- RestDslGenerator.toAppendable(document).withGeneratedTime(generated).generate(code);
-
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiPetstore.txt").toURI();
- final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
-
- assertThat(code.toString()).isEqualTo(expectedContent);
- }
-
- @Test
- public void shouldGenerateSourceCodeWithFilter() throws Exception {
- final StringBuilder code = new StringBuilder();
-
- RestDslGenerator.toAppendable(document)
- .withGeneratedTime(generated)
- .withClassName("MyRestRoute")
- .withPackageName("com.example")
- .withIndent("\t")
- .withSourceCodeTimestamps()
- .withOperationFilter("find*,deletePet,updatePet")
- .withDestinationGenerator(o -> "direct:rest-" + o.getOperationId())
- .generate(code);
-
- final URI file = RestDslGeneratorTest.class.getResource("/MyRestRouteFilter.txt").toURI();
- final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
-
- assertThat(code.toString()).isEqualTo(expectedContent);
- }
-
- @Test
- public void shouldGenerateSourceCodeWithOptions() throws Exception {
- final StringBuilder code = new StringBuilder();
-
- RestDslGenerator.toAppendable(document)
- .withGeneratedTime(generated)
- .withClassName("MyRestRoute")
- .withPackageName("com.example")
- .withIndent("\t")
- .withSourceCodeTimestamps()
- .withDestinationGenerator(o -> "direct:rest-" + o.getOperationId()).generate(code);
-
- final URI file = RestDslGeneratorTest.class.getResource("/MyRestRoute.txt").toURI();
- final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
-
- assertThat(code.toString()).isEqualTo(expectedContent);
- }
-
- @Test
- public void shouldGenerateSourceCodeWithRestComponent() throws Exception {
- final StringBuilder code = new StringBuilder();
-
- RestDslGenerator.toAppendable(document)
- .withGeneratedTime(generated)
- .withRestComponent("servlet")
- .withRestContextPath("/")
- .generate(code);
-
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiPetstoreWithRestComponent.txt").toURI();
- final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
-
- assertThat(code.toString()).isEqualTo(expectedContent);
- }
-
- @Test
- public void shouldResolveEmptyVariables() {
- assertThat(RestDslGenerator.resolveVariablesIn("", new OpenApi30ServerImpl())).isEmpty();
- }
-
- @Test
- public void shouldResolveMultipleOccurancesOfVariables() {
- final OpenApi30Server server = new OpenApi30ServerImpl();
- addVariableTo(server, "var1", "value1");
- addVariableTo(server, "var2", "value2");
-
- assertThat(RestDslGenerator.resolveVariablesIn("{var2} before {var1} after {var2}", server))
- .isEqualTo("value2 before value1 after value2");
- }
-
- @Test
- public void shouldResolveMultipleVariables() {
- final OpenApi30Server server = new OpenApi30ServerImpl();
- addVariableTo(server, "var1", "value1");
- addVariableTo(server, "var2", "value2");
-
- assertThat(RestDslGenerator.resolveVariablesIn("before {var1} after {var2}", server))
- .isEqualTo("before value1 after value2");
- }
-
- @Test
- public void shouldResolveSingleVariable() {
- final OpenApi30Server server = new OpenApi30ServerImpl();
- addVariableTo(server, "var", "value");
- assertThat(RestDslGenerator.resolveVariablesIn("before {var} after", server)).isEqualTo("before value after");
- }
-
- @BeforeAll
- public static void readOpenApiDoc() throws Exception {
- try (InputStream is = RestDslGeneratorTest.class.getResourceAsStream("openapi-v2.json")) {
- String json = IOHelper.loadText(is);
- document = (OpenApiDocument) Library.readDocumentFromJSONString(json);
- }
- }
-
- private static void addVariableTo(final OpenApi30Server server, final String name, final String value) {
- final OpenApi30ServerVariable variable = new OpenApi30ServerVariableImpl();
- variable.setDefault(value);
- server.addVariable(name, variable);
- }
-}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorV3Test.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorV3Test.java
index 64b741d7729..08946dd472c 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorV3Test.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslGeneratorV3Test.java
@@ -118,7 +118,7 @@ public class RestDslGeneratorV3Test {
@BeforeAll
public static void readOpenApiDoc() throws Exception {
- try (InputStream is = RestDslGeneratorTest.class.getResourceAsStream("openapi-spec.json")) {
+ try (InputStream is = RestDslXmlGeneratorV3Test.class.getResourceAsStream("openapi-spec.json")) {
String json = IOHelper.loadText(is);
document = (OpenApi30Document) Library.readDocumentFromJSONString(json);
}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorTest.java
deleted file mode 100644
index 187b1d68fea..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorTest.java
+++ /dev/null
@@ -1,114 +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.generator.openapi;
-
-import java.io.InputStream;
-import java.io.StringReader;
-import java.net.URI;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-
-import org.xml.sax.InputSource;
-
-import io.apicurio.datamodels.Library;
-import io.apicurio.datamodels.models.openapi.OpenApiDocument;
-import org.apache.camel.CamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.util.IOHelper;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RestDslXmlGeneratorTest {
-
- static OpenApiDocument document;
-
- @Test
- public void shouldGenerateBlueprintXml() throws Exception {
- try (CamelContext context = new DefaultCamelContext()) {
- final String xml = RestDslGenerator.toXml(document).withBlueprint().generate(context);
- assertThat(xml).contains("http://camel.apache.org/schema/blueprint");
- }
- }
-
- @Test
- public void shouldGenerateSpringXml() throws Exception {
- try (CamelContext context = new DefaultCamelContext()) {
- final String xml = RestDslGenerator.toXml(document).generate(context);
- assertThat(xml).contains("http://camel.apache.org/schema/spring");
- }
- }
-
- @Test
- public void shouldGenerateXmlWithDefaultnamespace() throws Exception {
- try (CamelContext context = new DefaultCamelContext()) {
- final String xml = RestDslGenerator.toXml(document).generate(context);
-
- final DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
- builderFactory.setNamespaceAware(true);
-
- final DocumentBuilder builder = builderFactory.newDocumentBuilder();
-
- final Document document = builder.parse(new InputSource(new StringReader(xml)));
-
- assertThat(document.isDefaultNamespace("http://camel.apache.org/schema/spring")).isTrue();
- }
- }
-
- @Test
- public void shouldGenerateXmlWithDefaults() throws Exception {
- try (CamelContext context = new DefaultCamelContext()) {
- final String xml = RestDslGenerator.toXml(document).generate(context);
-
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiPetstoreXml.txt").toURI();
- final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
-
- assertThat(xml).isXmlEqualTo(expectedContent);
- }
- }
-
- @Test
- public void shouldGenerateXmlWithRestComponent() throws Exception {
- try (CamelContext context = new DefaultCamelContext()) {
- final String xml = RestDslGenerator.toXml(document)
- .withRestComponent("servlet")
- .withRestContextPath("/foo")
- .generate(context);
-
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiPetstoreWithRestComponentXml.txt").toURI();
- final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
-
- assertThat(xml).isXmlEqualTo(expectedContent);
- }
- }
-
- @BeforeAll
- public static void readOpenApiDoc() throws Exception {
- try (InputStream is = RestDslXmlGeneratorTest.class.getResourceAsStream("openapi-v2.json")) {
- String json = IOHelper.loadText(is);
- document = (OpenApiDocument) Library.readDocumentFromJSONString(json);
- }
- }
-
-}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3SimpleTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3SimpleTest.java
index 9023590dd8b..2e227c2ea45 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3SimpleTest.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3SimpleTest.java
@@ -50,7 +50,7 @@ public class RestDslXmlGeneratorV3SimpleTest {
final CamelContext context = new DefaultCamelContext();
final String xml = RestDslGenerator.toXml(document).generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreSimpleXml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreSimpleXml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(xml).isXmlEqualTo(expectedContent);
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3Test.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3Test.java
index 3c36f5ffb72..7fba47ada33 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3Test.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslXmlGeneratorV3Test.java
@@ -81,7 +81,7 @@ public class RestDslXmlGeneratorV3Test {
try (CamelContext context = new DefaultCamelContext()) {
final String xml = RestDslGenerator.toXml(document).generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreXml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreXml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(xml).isXmlEqualTo(expectedContent);
@@ -96,7 +96,7 @@ public class RestDslXmlGeneratorV3Test {
.withRestContextPath("/foo")
.generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreWithRestComponentXml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreWithRestComponentXml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(xml).isXmlEqualTo(expectedContent);
}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV302Test.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV302Test.java
index cd42eaa45b6..8171bfa21a2 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV302Test.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV302Test.java
@@ -43,7 +43,7 @@ public class RestDslYamlGeneratorV302Test {
try (CamelContext context = new DefaultCamelContext()) {
final String yaml = RestDslGenerator.toYaml(document).generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV302PetstoreYaml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV302PetstoreYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleTest.java
index 20bf8a8a4a5..199e63a2102 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleTest.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleTest.java
@@ -49,7 +49,7 @@ public class RestDslYamlGeneratorV3SimpleTest {
final CamelContext context = new DefaultCamelContext();
final String yaml = RestDslGenerator.toYaml(document).generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreSimpleYaml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreSimpleYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesDescriptionTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesDescriptionTest.java
index 13712a79555..698fcbebee2 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesDescriptionTest.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesDescriptionTest.java
@@ -52,7 +52,7 @@ public class RestDslYamlGeneratorV3SimpleWithRoutesDescriptionTest {
final String yaml = RestDslGenerator.toYaml(document).generate(context, true);
final URI file
- = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreSimpleWithRoutesDescriptionYaml.txt").toURI();
+ = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreSimpleWithRoutesDescriptionYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesTest.java
index 44e46a13c97..123d6cd24a0 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesTest.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3SimpleWithRoutesTest.java
@@ -50,7 +50,7 @@ public class RestDslYamlGeneratorV3SimpleWithRoutesTest {
final CamelContext context = new DefaultCamelContext();
final String yaml = RestDslGenerator.toYaml(document).generate(context, true);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreSimpleWithRoutesYaml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreSimpleWithRoutesYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3Test.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3Test.java
index 22ea95f5314..c3774382335 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3Test.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGeneratorV3Test.java
@@ -41,7 +41,7 @@ public class RestDslYamlGeneratorV3Test {
try (CamelContext context = new DefaultCamelContext()) {
final String yaml = RestDslGenerator.toYaml(document).generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreYaml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
@@ -56,7 +56,7 @@ public class RestDslYamlGeneratorV3Test {
.withRestContextPath("/foo")
.generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/OpenApiV3PetstoreWithRestComponentYaml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/OpenApiV3PetstoreWithRestComponentYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGreetingsTest.java b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGreetingsTest.java
index 4f645278e71..7bfb867eb57 100644
--- a/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGreetingsTest.java
+++ b/tooling/openapi-rest-dsl-generator/src/test/java/org/apache/camel/generator/openapi/RestDslYamlGreetingsTest.java
@@ -49,7 +49,7 @@ public class RestDslYamlGreetingsTest {
final CamelContext context = new DefaultCamelContext();
final String yaml = RestDslGenerator.toYaml(document).generate(context);
- final URI file = RestDslGeneratorTest.class.getResource("/GreetingsYaml.txt").toURI();
+ final URI file = RestDslXmlGeneratorV3Test.class.getResource("/GreetingsYaml.txt").toURI();
final String expectedContent = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8);
assertThat(yaml).isEqualTo(expectedContent);
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/MyRestRoute.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/MyRestRoute.txt
deleted file mode 100644
index 02d756b27f7..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/MyRestRoute.txt
+++ /dev/null
@@ -1,322 +0,0 @@
-package com.example;
-
-import jakarta.annotation.Generated;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.CollectionFormat;
-import org.apache.camel.model.rest.RestParamType;
-
-/**
- * Generated from OpenApi specification by Camel REST DSL generator.
- */
-@Generated(
- value = "org.apache.camel.generator.openapi.AppendableGenerator",
- date = "2017-10-17T00:00:00Z"
-)
-public final class MyRestRoute extends RouteBuilder {
- /**
- * Defines Apache Camel routes using REST DSL fluent API.
- */
- public void configure() {
-
- rest("/v2")
- .put("/pet")
- .id("updatePet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .to("direct:rest-updatePet")
- .post("/pet")
- .id("addPet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .param()
- .name("verbose")
- .type(RestParamType.query)
- .dataType("boolean")
- .defaultValue("false")
- .required(false)
- .description("Verbose data")
- .endParam()
- .to("direct:rest-addPet");
-
- rest("/v2")
- .get("/pet/findByStatus")
- .id("findPetsByStatus")
- .description("Multiple status values can be provided with comma separated strings")
- .produces("application/xml,application/json")
- .param()
- .name("status")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Status values that need to be considered for filter")
- .endParam()
- .to("direct:rest-findPetsByStatus");
-
- rest("/v2")
- .get("/pet/findByTags")
- .id("findPetsByTags")
- .description("Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.")
- .produces("application/xml,application/json")
- .param()
- .name("tags")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Tags to filter by")
- .endParam()
- .to("direct:rest-findPetsByTags");
-
- rest("/v2")
- .get("/pet/{petId}")
- .id("getPetById")
- .description("Returns a single pet")
- .produces("application/xml,application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet to return")
- .endParam()
- .to("direct:rest-getPetById")
- .post("/pet/{petId}")
- .id("updatePetWithForm")
- .consumes("application/x-www-form-urlencoded")
- .produces("application/xml,application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet that needs to be updated")
- .endParam()
- .param()
- .name("name")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Updated name of the pet")
- .endParam()
- .param()
- .name("status")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Updated status of the pet")
- .endParam()
- .to("direct:rest-updatePetWithForm")
- .delete("/pet/{petId}")
- .id("deletePet")
- .produces("application/xml,application/json")
- .param()
- .name("api_key")
- .type(RestParamType.header)
- .dataType("string")
- .required(false)
- .endParam()
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("Pet id to delete")
- .endParam()
- .to("direct:rest-deletePet");
-
- rest("/v2")
- .post("/pet/{petId}/uploadImage")
- .id("uploadFile")
- .consumes("multipart/form-data")
- .produces("application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet to update")
- .endParam()
- .param()
- .name("additionalMetadata")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Additional data to pass to server")
- .endParam()
- .param()
- .name("file")
- .type(RestParamType.formData)
- .dataType("file")
- .required(false)
- .description("file to upload")
- .endParam()
- .to("direct:rest-uploadFile");
-
- rest("/v2")
- .get("/store/inventory")
- .id("getInventory")
- .description("Returns a map of status codes to quantities")
- .produces("application/json")
- .to("direct:rest-getInventory");
-
- rest("/v2")
- .post("/store/order")
- .id("placeOrder")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("order placed for purchasing the pet")
- .endParam()
- .to("direct:rest-placeOrder");
-
- rest("/v2")
- .get("/store/order/{orderId}")
- .id("getOrderById")
- .description("For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions")
- .produces("application/xml,application/json")
- .param()
- .name("orderId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet that needs to be fetched")
- .endParam()
- .to("direct:rest-getOrderById")
- .delete("/store/order/{orderId}")
- .id("deleteOrder")
- .description("For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors")
- .produces("application/xml,application/json")
- .param()
- .name("orderId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of the order that needs to be deleted")
- .endParam()
- .to("direct:rest-deleteOrder");
-
- rest("/v2")
- .post("/user")
- .id("createUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Created user object")
- .endParam()
- .to("direct:rest-createUser");
-
- rest("/v2")
- .post("/user/createWithArray")
- .id("createUsersWithArrayInput")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("List of user object")
- .endParam()
- .to("direct:rest-createUsersWithArrayInput");
-
- rest("/v2")
- .post("/user/createWithList")
- .id("createUsersWithListInput")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("List of user object")
- .endParam()
- .to("direct:rest-createUsersWithListInput");
-
- rest("/v2")
- .get("/user/login")
- .id("loginUser")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.query)
- .dataType("string")
- .required(true)
- .description("The user name for login")
- .endParam()
- .param()
- .name("password")
- .type(RestParamType.query)
- .dataType("string")
- .required(true)
- .description("The password for login in clear text")
- .endParam()
- .to("direct:rest-loginUser");
-
- rest("/v2")
- .get("/user/logout")
- .id("logoutUser")
- .produces("application/xml,application/json")
- .to("direct:rest-logoutUser");
-
- rest("/v2")
- .get("/user/{username}")
- .id("getUserByName")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("The name that needs to be fetched. Use user1 for testing. ")
- .endParam()
- .to("direct:rest-getUserByName")
- .put("/user/{username}")
- .id("updateUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("name that need to be updated")
- .endParam()
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Updated user object")
- .endParam()
- .to("direct:rest-updateUser")
- .delete("/user/{username}")
- .id("deleteUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("The name that needs to be deleted")
- .endParam()
- .to("direct:rest-deleteUser");
-
- }
-}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/MyRestRouteFilter.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/MyRestRouteFilter.txt
deleted file mode 100644
index 94ad2fd8d18..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/MyRestRouteFilter.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.example;
-
-import jakarta.annotation.Generated;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.CollectionFormat;
-import org.apache.camel.model.rest.RestParamType;
-
-/**
- * Generated from OpenApi specification by Camel REST DSL generator.
- */
-@Generated(
- value = "org.apache.camel.generator.openapi.AppendableGenerator",
- date = "2017-10-17T00:00:00Z"
-)
-public final class MyRestRoute extends RouteBuilder {
- /**
- * Defines Apache Camel routes using REST DSL fluent API.
- */
- public void configure() {
-
- rest("/v2")
- .put("/pet")
- .id("updatePet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .to("direct:rest-updatePet");
-
- rest("/v2")
- .get("/pet/findByStatus")
- .id("findPetsByStatus")
- .description("Multiple status values can be provided with comma separated strings")
- .produces("application/xml,application/json")
- .param()
- .name("status")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Status values that need to be considered for filter")
- .endParam()
- .to("direct:rest-findPetsByStatus");
-
- rest("/v2")
- .get("/pet/findByTags")
- .id("findPetsByTags")
- .description("Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.")
- .produces("application/xml,application/json")
- .param()
- .name("tags")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Tags to filter by")
- .endParam()
- .to("direct:rest-findPetsByTags");
-
- rest("/v2")
- .delete("/pet/{petId}")
- .id("deletePet")
- .produces("application/xml,application/json")
- .param()
- .name("api_key")
- .type(RestParamType.header)
- .dataType("string")
- .required(false)
- .endParam()
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("Pet id to delete")
- .endParam()
- .to("direct:rest-deletePet");
-
- }
-}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstore.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstore.txt
deleted file mode 100644
index b718f76d093..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstore.txt
+++ /dev/null
@@ -1,319 +0,0 @@
-package io.openapi.petstore;
-
-import jakarta.annotation.Generated;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.CollectionFormat;
-import org.apache.camel.model.rest.RestParamType;
-
-/**
- * Generated from OpenApi specification by Camel REST DSL generator.
- */
-@Generated("org.apache.camel.generator.openapi.AppendableGenerator")
-public final class OpenApiPetstore extends RouteBuilder {
- /**
- * Defines Apache Camel routes using REST DSL fluent API.
- */
- public void configure() {
-
- rest("/v2")
- .put("/pet")
- .id("updatePet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .to("direct:updatePet")
- .post("/pet")
- .id("addPet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .param()
- .name("verbose")
- .type(RestParamType.query)
- .dataType("boolean")
- .defaultValue("false")
- .required(false)
- .description("Verbose data")
- .endParam()
- .to("direct:addPet");
-
- rest("/v2")
- .get("/pet/findByStatus")
- .id("findPetsByStatus")
- .description("Multiple status values can be provided with comma separated strings")
- .produces("application/xml,application/json")
- .param()
- .name("status")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Status values that need to be considered for filter")
- .endParam()
- .to("direct:findPetsByStatus");
-
- rest("/v2")
- .get("/pet/findByTags")
- .id("findPetsByTags")
- .description("Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.")
- .produces("application/xml,application/json")
- .param()
- .name("tags")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Tags to filter by")
- .endParam()
- .to("direct:findPetsByTags");
-
- rest("/v2")
- .get("/pet/{petId}")
- .id("getPetById")
- .description("Returns a single pet")
- .produces("application/xml,application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet to return")
- .endParam()
- .to("direct:getPetById")
- .post("/pet/{petId}")
- .id("updatePetWithForm")
- .consumes("application/x-www-form-urlencoded")
- .produces("application/xml,application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet that needs to be updated")
- .endParam()
- .param()
- .name("name")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Updated name of the pet")
- .endParam()
- .param()
- .name("status")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Updated status of the pet")
- .endParam()
- .to("direct:updatePetWithForm")
- .delete("/pet/{petId}")
- .id("deletePet")
- .produces("application/xml,application/json")
- .param()
- .name("api_key")
- .type(RestParamType.header)
- .dataType("string")
- .required(false)
- .endParam()
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("Pet id to delete")
- .endParam()
- .to("direct:deletePet");
-
- rest("/v2")
- .post("/pet/{petId}/uploadImage")
- .id("uploadFile")
- .consumes("multipart/form-data")
- .produces("application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet to update")
- .endParam()
- .param()
- .name("additionalMetadata")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Additional data to pass to server")
- .endParam()
- .param()
- .name("file")
- .type(RestParamType.formData)
- .dataType("file")
- .required(false)
- .description("file to upload")
- .endParam()
- .to("direct:uploadFile");
-
- rest("/v2")
- .get("/store/inventory")
- .id("getInventory")
- .description("Returns a map of status codes to quantities")
- .produces("application/json")
- .to("direct:getInventory");
-
- rest("/v2")
- .post("/store/order")
- .id("placeOrder")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("order placed for purchasing the pet")
- .endParam()
- .to("direct:placeOrder");
-
- rest("/v2")
- .get("/store/order/{orderId}")
- .id("getOrderById")
- .description("For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions")
- .produces("application/xml,application/json")
- .param()
- .name("orderId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet that needs to be fetched")
- .endParam()
- .to("direct:getOrderById")
- .delete("/store/order/{orderId}")
- .id("deleteOrder")
- .description("For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors")
- .produces("application/xml,application/json")
- .param()
- .name("orderId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of the order that needs to be deleted")
- .endParam()
- .to("direct:deleteOrder");
-
- rest("/v2")
- .post("/user")
- .id("createUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Created user object")
- .endParam()
- .to("direct:createUser");
-
- rest("/v2")
- .post("/user/createWithArray")
- .id("createUsersWithArrayInput")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("List of user object")
- .endParam()
- .to("direct:createUsersWithArrayInput");
-
- rest("/v2")
- .post("/user/createWithList")
- .id("createUsersWithListInput")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("List of user object")
- .endParam()
- .to("direct:createUsersWithListInput");
-
- rest("/v2")
- .get("/user/login")
- .id("loginUser")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.query)
- .dataType("string")
- .required(true)
- .description("The user name for login")
- .endParam()
- .param()
- .name("password")
- .type(RestParamType.query)
- .dataType("string")
- .required(true)
- .description("The password for login in clear text")
- .endParam()
- .to("direct:loginUser");
-
- rest("/v2")
- .get("/user/logout")
- .id("logoutUser")
- .produces("application/xml,application/json")
- .to("direct:logoutUser");
-
- rest("/v2")
- .get("/user/{username}")
- .id("getUserByName")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("The name that needs to be fetched. Use user1 for testing. ")
- .endParam()
- .to("direct:getUserByName")
- .put("/user/{username}")
- .id("updateUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("name that need to be updated")
- .endParam()
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Updated user object")
- .endParam()
- .to("direct:updateUser")
- .delete("/user/{username}")
- .id("deleteUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("The name that needs to be deleted")
- .endParam()
- .to("direct:deleteUser");
-
- }
-}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreWithRestComponent.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreWithRestComponent.txt
deleted file mode 100644
index 6f63eb22a58..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreWithRestComponent.txt
+++ /dev/null
@@ -1,321 +0,0 @@
-package io.openapi.petstore;
-
-import jakarta.annotation.Generated;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.CollectionFormat;
-import org.apache.camel.model.rest.RestParamType;
-
-/**
- * Generated from OpenApi specification by Camel REST DSL generator.
- */
-@Generated("org.apache.camel.generator.openapi.AppendableGenerator")
-public final class OpenApiPetstore extends RouteBuilder {
- /**
- * Defines Apache Camel routes using REST DSL fluent API.
- */
- public void configure() {
-
- restConfiguration().component("servlet").contextPath("/");
-
- rest("/v2")
- .put("/pet")
- .id("updatePet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .to("direct:updatePet")
- .post("/pet")
- .id("addPet")
- .consumes("application/json,application/xml")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Pet object that needs to be added to the store")
- .endParam()
- .param()
- .name("verbose")
- .type(RestParamType.query)
- .dataType("boolean")
- .defaultValue("false")
- .required(false)
- .description("Verbose data")
- .endParam()
- .to("direct:addPet");
-
- rest("/v2")
- .get("/pet/findByStatus")
- .id("findPetsByStatus")
- .description("Multiple status values can be provided with comma separated strings")
- .produces("application/xml,application/json")
- .param()
- .name("status")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Status values that need to be considered for filter")
- .endParam()
- .to("direct:findPetsByStatus");
-
- rest("/v2")
- .get("/pet/findByTags")
- .id("findPetsByTags")
- .description("Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.")
- .produces("application/xml,application/json")
- .param()
- .name("tags")
- .type(RestParamType.query)
- .dataType("array")
- .collectionFormat(CollectionFormat.multi)
- .arrayType("string")
- .required(true)
- .description("Tags to filter by")
- .endParam()
- .to("direct:findPetsByTags");
-
- rest("/v2")
- .get("/pet/{petId}")
- .id("getPetById")
- .description("Returns a single pet")
- .produces("application/xml,application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet to return")
- .endParam()
- .to("direct:getPetById")
- .post("/pet/{petId}")
- .id("updatePetWithForm")
- .consumes("application/x-www-form-urlencoded")
- .produces("application/xml,application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet that needs to be updated")
- .endParam()
- .param()
- .name("name")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Updated name of the pet")
- .endParam()
- .param()
- .name("status")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Updated status of the pet")
- .endParam()
- .to("direct:updatePetWithForm")
- .delete("/pet/{petId}")
- .id("deletePet")
- .produces("application/xml,application/json")
- .param()
- .name("api_key")
- .type(RestParamType.header)
- .dataType("string")
- .required(false)
- .endParam()
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("Pet id to delete")
- .endParam()
- .to("direct:deletePet");
-
- rest("/v2")
- .post("/pet/{petId}/uploadImage")
- .id("uploadFile")
- .consumes("multipart/form-data")
- .produces("application/json")
- .param()
- .name("petId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet to update")
- .endParam()
- .param()
- .name("additionalMetadata")
- .type(RestParamType.formData)
- .dataType("string")
- .required(false)
- .description("Additional data to pass to server")
- .endParam()
- .param()
- .name("file")
- .type(RestParamType.formData)
- .dataType("file")
- .required(false)
- .description("file to upload")
- .endParam()
- .to("direct:uploadFile");
-
- rest("/v2")
- .get("/store/inventory")
- .id("getInventory")
- .description("Returns a map of status codes to quantities")
- .produces("application/json")
- .to("direct:getInventory");
-
- rest("/v2")
- .post("/store/order")
- .id("placeOrder")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("order placed for purchasing the pet")
- .endParam()
- .to("direct:placeOrder");
-
- rest("/v2")
- .get("/store/order/{orderId}")
- .id("getOrderById")
- .description("For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions")
- .produces("application/xml,application/json")
- .param()
- .name("orderId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of pet that needs to be fetched")
- .endParam()
- .to("direct:getOrderById")
- .delete("/store/order/{orderId}")
- .id("deleteOrder")
- .description("For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors")
- .produces("application/xml,application/json")
- .param()
- .name("orderId")
- .type(RestParamType.path)
- .dataType("integer")
- .required(true)
- .description("ID of the order that needs to be deleted")
- .endParam()
- .to("direct:deleteOrder");
-
- rest("/v2")
- .post("/user")
- .id("createUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Created user object")
- .endParam()
- .to("direct:createUser");
-
- rest("/v2")
- .post("/user/createWithArray")
- .id("createUsersWithArrayInput")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("List of user object")
- .endParam()
- .to("direct:createUsersWithArrayInput");
-
- rest("/v2")
- .post("/user/createWithList")
- .id("createUsersWithListInput")
- .produces("application/xml,application/json")
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("List of user object")
- .endParam()
- .to("direct:createUsersWithListInput");
-
- rest("/v2")
- .get("/user/login")
- .id("loginUser")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.query)
- .dataType("string")
- .required(true)
- .description("The user name for login")
- .endParam()
- .param()
- .name("password")
- .type(RestParamType.query)
- .dataType("string")
- .required(true)
- .description("The password for login in clear text")
- .endParam()
- .to("direct:loginUser");
-
- rest("/v2")
- .get("/user/logout")
- .id("logoutUser")
- .produces("application/xml,application/json")
- .to("direct:logoutUser");
-
- rest("/v2")
- .get("/user/{username}")
- .id("getUserByName")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("The name that needs to be fetched. Use user1 for testing. ")
- .endParam()
- .to("direct:getUserByName")
- .put("/user/{username}")
- .id("updateUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("name that need to be updated")
- .endParam()
- .param()
- .name("body")
- .type(RestParamType.body)
- .required(true)
- .description("Updated user object")
- .endParam()
- .to("direct:updateUser")
- .delete("/user/{username}")
- .id("deleteUser")
- .description("This can only be done by the logged in user.")
- .produces("application/xml,application/json")
- .param()
- .name("username")
- .type(RestParamType.path)
- .dataType("string")
- .required(true)
- .description("The name that needs to be deleted")
- .endParam()
- .to("direct:deleteUser");
-
- }
-}
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreWithRestComponentXml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreWithRestComponentXml.txt
deleted file mode 100644
index 1e4ad5b28b2..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreWithRestComponentXml.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<rests xmlns="http://camel.apache.org/schema/spring">
- <restConfiguration component="servlet" contextPath="/foo"/>
- <rest path="/v2">
- <put consumes="application/json,application/xml" id="updatePet" produces="application/xml,application/json" path="/pet">
- <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/>
- <to uri="direct:updatePet"/>
- </put>
- <post consumes="application/json,application/xml" id="addPet" produces="application/xml,application/json" path="/pet">
- <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/>
- <param dataType="boolean" defaultValue="false" description="Verbose data" name="verbose" required="false" type="query"/>
- <to uri="direct:addPet"/>
- </post>
- <get id="findPetsByStatus" description="Multiple status values can be provided with comma separated strings" produces="application/xml,application/json" path="/pet/findByStatus">
- <param arrayType="string" collectionFormat="multi" dataType="array" description="Status values that need to be considered for filter" name="status" required="true" type="query"/>
- <to uri="direct:findPetsByStatus"/>
- </get>
- <get id="findPetsByTags" description="Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." produces="application/xml,application/json" path="/pet/findByTags">
- <param arrayType="string" collectionFormat="multi" dataType="array" description="Tags to filter by" name="tags" required="true" type="query"/>
- <to uri="direct:findPetsByTags"/>
- </get>
- <get id="getPetById" description="Returns a single pet" produces="application/xml,application/json" path="/pet/{petId}">
- <param dataType="integer" description="ID of pet to return" name="petId" required="true" type="path"/>
- <to uri="direct:getPetById"/>
- </get>
- <post consumes="application/x-www-form-urlencoded" id="updatePetWithForm" produces="application/xml,application/json" path="/pet/{petId}">
- <param dataType="integer" description="ID of pet that needs to be updated" name="petId" required="true" type="path"/>
- <param dataType="string" description="Updated name of the pet" name="name" required="false" type="formData"/>
- <param dataType="string" description="Updated status of the pet" name="status" required="false" type="formData"/>
- <to uri="direct:updatePetWithForm"/>
- </post>
- <delete id="deletePet" produces="application/xml,application/json" path="/pet/{petId}">
- <param dataType="string" name="api_key" required="false" type="header"/>
- <param dataType="integer" description="Pet id to delete" name="petId" required="true" type="path"/>
- <to uri="direct:deletePet"/>
- </delete>
- <post consumes="multipart/form-data" id="uploadFile" produces="application/json" path="/pet/{petId}/uploadImage">
- <param dataType="integer" description="ID of pet to update" name="petId" required="true" type="path"/>
- <param dataType="string" description="Additional data to pass to server" name="additionalMetadata" required="false" type="formData"/>
- <param dataType="file" description="file to upload" name="file" required="false" type="formData"/>
- <to uri="direct:uploadFile"/>
- </post>
- <get id="getInventory" description="Returns a map of status codes to quantities" produces="application/json" path="/store/inventory">
- <to uri="direct:getInventory"/>
- </get>
- <post id="placeOrder" produces="application/xml,application/json" path="/store/order">
- <param description="order placed for purchasing the pet" name="body" required="true" type="body"/>
- <to uri="direct:placeOrder"/>
- </post>
- <get id="getOrderById" description="For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" produces="application/xml,application/json" path="/store/order/{orderId}">
- <param dataType="integer" description="ID of pet that needs to be fetched" name="orderId" required="true" type="path"/>
- <to uri="direct:getOrderById"/>
- </get>
- <delete id="deleteOrder" description="For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" produces="application/xml,application/json" path="/store/order/{orderId}">
- <param dataType="integer" description="ID of the order that needs to be deleted" name="orderId" required="true" type="path"/>
- <to uri="direct:deleteOrder"/>
- </delete>
- <post id="createUser" description="This can only be done by the logged in user." produces="application/xml,application/json" path="/user">
- <param description="Created user object" name="body" required="true" type="body"/>
- <to uri="direct:createUser"/>
- </post>
- <post id="createUsersWithArrayInput" produces="application/xml,application/json" path="/user/createWithArray">
- <param description="List of user object" name="body" required="true" type="body"/>
- <to uri="direct:createUsersWithArrayInput"/>
- </post>
- <post id="createUsersWithListInput" produces="application/xml,application/json" path="/user/createWithList">
- <param description="List of user object" name="body" required="true" type="body"/>
- <to uri="direct:createUsersWithListInput"/>
- </post>
- <get id="loginUser" produces="application/xml,application/json" path="/user/login">
- <param dataType="string" description="The user name for login" name="username" required="true" type="query"/>
- <param dataType="string" description="The password for login in clear text" name="password" required="true" type="query"/>
- <to uri="direct:loginUser"/>
- </get>
- <get id="logoutUser" produces="application/xml,application/json" path="/user/logout">
- <to uri="direct:logoutUser"/>
- </get>
- <get id="getUserByName" produces="application/xml,application/json" path="/user/{username}">
- <param dataType="string" description="The name that needs to be fetched. Use user1 for testing. " name="username" required="true" type="path"/>
- <to uri="direct:getUserByName"/>
- </get>
- <put id="updateUser" description="This can only be done by the logged in user." produces="application/xml,application/json" path="/user/{username}">
- <param dataType="string" description="name that need to be updated" name="username" required="true" type="path"/>
- <param description="Updated user object" name="body" required="true" type="body"/>
- <to uri="direct:updateUser"/>
- </put>
- <delete id="deleteUser" description="This can only be done by the logged in user." produces="application/xml,application/json" path="/user/{username}">
- <param dataType="string" description="The name that needs to be deleted" name="username" required="true" type="path"/>
- <to uri="direct:deleteUser"/>
- </delete>
- </rest>
-</rests>
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreXml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreXml.txt
deleted file mode 100644
index 0468f7e3a03..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiPetstoreXml.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<rests xmlns="http://camel.apache.org/schema/spring">
- <rest path="/v2">
- <put consumes="application/json,application/xml" id="updatePet" produces="application/xml,application/json" path="/pet">
- <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/>
- <to uri="direct:updatePet"/>
- </put>
- <post consumes="application/json,application/xml" id="addPet" produces="application/xml,application/json" path="/pet">
- <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/>
- <param dataType="boolean" defaultValue="false" description="Verbose data" name="verbose" required="false" type="query"/>
- <to uri="direct:addPet"/>
- </post>
- <get id="findPetsByStatus" description="Multiple status values can be provided with comma separated strings" produces="application/xml,application/json" path="/pet/findByStatus">
- <param arrayType="string" collectionFormat="multi" dataType="array" description="Status values that need to be considered for filter" name="status" required="true" type="query"/>
- <to uri="direct:findPetsByStatus"/>
- </get>
- <get id="findPetsByTags" description="Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." produces="application/xml,application/json" path="/pet/findByTags">
- <param arrayType="string" collectionFormat="multi" dataType="array" description="Tags to filter by" name="tags" required="true" type="query"/>
- <to uri="direct:findPetsByTags"/>
- </get>
- <get id="getPetById" description="Returns a single pet" produces="application/xml,application/json" path="/pet/{petId}">
- <param dataType="integer" description="ID of pet to return" name="petId" required="true" type="path"/>
- <to uri="direct:getPetById"/>
- </get>
- <post consumes="application/x-www-form-urlencoded" id="updatePetWithForm" produces="application/xml,application/json" path="/pet/{petId}">
- <param dataType="integer" description="ID of pet that needs to be updated" name="petId" required="true" type="path"/>
- <param dataType="string" description="Updated name of the pet" name="name" required="false" type="formData"/>
- <param dataType="string" description="Updated status of the pet" name="status" required="false" type="formData"/>
- <to uri="direct:updatePetWithForm"/>
- </post>
- <delete id="deletePet" produces="application/xml,application/json" path="/pet/{petId}">
- <param dataType="string" name="api_key" required="false" type="header"/>
- <param dataType="integer" description="Pet id to delete" name="petId" required="true" type="path"/>
- <to uri="direct:deletePet"/>
- </delete>
- <post consumes="multipart/form-data" id="uploadFile" produces="application/json" path="/pet/{petId}/uploadImage">
- <param dataType="integer" description="ID of pet to update" name="petId" required="true" type="path"/>
- <param dataType="string" description="Additional data to pass to server" name="additionalMetadata" required="false" type="formData"/>
- <param dataType="file" description="file to upload" name="file" required="false" type="formData"/>
- <to uri="direct:uploadFile"/>
- </post>
- <get id="getInventory" description="Returns a map of status codes to quantities" produces="application/json" path="/store/inventory">
- <to uri="direct:getInventory"/>
- </get>
- <post id="placeOrder" produces="application/xml,application/json" path="/store/order">
- <param description="order placed for purchasing the pet" name="body" required="true" type="body"/>
- <to uri="direct:placeOrder"/>
- </post>
- <get id="getOrderById" description="For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" produces="application/xml,application/json" path="/store/order/{orderId}">
- <param dataType="integer" description="ID of pet that needs to be fetched" name="orderId" required="true" type="path"/>
- <to uri="direct:getOrderById"/>
- </get>
- <delete id="deleteOrder" description="For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" produces="application/xml,application/json" path="/store/order/{orderId}">
- <param dataType="integer" description="ID of the order that needs to be deleted" name="orderId" required="true" type="path"/>
- <to uri="direct:deleteOrder"/>
- </delete>
- <post id="createUser" description="This can only be done by the logged in user." produces="application/xml,application/json" path="/user">
- <param description="Created user object" name="body" required="true" type="body"/>
- <to uri="direct:createUser"/>
- </post>
- <post id="createUsersWithArrayInput" produces="application/xml,application/json" path="/user/createWithArray">
- <param description="List of user object" name="body" required="true" type="body"/>
- <to uri="direct:createUsersWithArrayInput"/>
- </post>
- <post id="createUsersWithListInput" produces="application/xml,application/json" path="/user/createWithList">
- <param description="List of user object" name="body" required="true" type="body"/>
- <to uri="direct:createUsersWithListInput"/>
- </post>
- <get id="loginUser" produces="application/xml,application/json" path="/user/login">
- <param dataType="string" description="The user name for login" name="username" required="true" type="query"/>
- <param dataType="string" description="The password for login in clear text" name="password" required="true" type="query"/>
- <to uri="direct:loginUser"/>
- </get>
- <get id="logoutUser" produces="application/xml,application/json" path="/user/logout">
- <to uri="direct:logoutUser"/>
- </get>
- <get id="getUserByName" produces="application/xml,application/json" path="/user/{username}">
- <param dataType="string" description="The name that needs to be fetched. Use user1 for testing. " name="username" required="true" type="path"/>
- <to uri="direct:getUserByName"/>
- </get>
- <put id="updateUser" description="This can only be done by the logged in user." produces="application/xml,application/json" path="/user/{username}">
- <param dataType="string" description="name that need to be updated" name="username" required="true" type="path"/>
- <param description="Updated user object" name="body" required="true" type="body"/>
- <to uri="direct:updateUser"/>
- </put>
- <delete id="deleteUser" description="This can only be done by the logged in user." produces="application/xml,application/json" path="/user/{username}">
- <param dataType="string" description="The name that needs to be deleted" name="username" required="true" type="path"/>
- <to uri="direct:deleteUser"/>
- </delete>
- </rest>
-</rests>
diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/org/apache/camel/generator/openapi/openapi-v2.json b/tooling/openapi-rest-dsl-generator/src/test/resources/org/apache/camel/generator/openapi/openapi-v2.json
deleted file mode 100644
index 8d762a8519a..00000000000
--- a/tooling/openapi-rest-dsl-generator/src/test/resources/org/apache/camel/generator/openapi/openapi-v2.json
+++ /dev/null
@@ -1,1042 +0,0 @@
-{
- "swagger": "2.0",
- "info": {
- "description": "This is a sample server Petstore server. You can find out more about Swagger 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": "apiteam@swagger.io"
- },
- "license": {
- "name": "Apache 2.0",
- "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
- }
- },
- "host": "petstore.openapi.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"
- }
- },
- {
- "name": "verbose",
- "in": "query",
- "description": "Verbose data",
- "type": "boolean",
- "default": false
- }
- ],
- "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": "header"
- }
- },
- "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 Swagger",
- "url": "http://swagger.io"
- }
-}