diff --git a/catalog/citrus-bom/pom.xml b/catalog/citrus-bom/pom.xml
index 0e0aa4a2f4..d542f0bbae 100644
--- a/catalog/citrus-bom/pom.xml
+++ b/catalog/citrus-bom/pom.xml
@@ -238,6 +238,21 @@
citrus-openapi4.4.0-SNAPSHOT
+
+ org.citrusframework
+ citrus-test-api-core
+ 4.4.0-SNAPSHOT
+
+
+ org.citrusframework
+ citrus-test-api-generator-core
+ 4.4.0-SNAPSHOT
+
+
+ org.citrusframework
+ citrus-test-api-spring
+ 4.4.0-SNAPSHOT
+ org.citrusframeworkcitrus-jms
diff --git a/connectors/citrus-openapi/README.md b/connectors/citrus-openapi/README.md
new file mode 100644
index 0000000000..7669d15a9e
--- /dev/null
+++ b/connectors/citrus-openapi/README.md
@@ -0,0 +1,6 @@
+// TODO
+OpenApiServerRequest
+- SchemaValidation is active by default (also in other scenarios)
+
+Oas Validation now by ValidationFramework
+- no control response message is created any more
\ No newline at end of file
diff --git a/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiPathRegistry.java b/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiPathRegistry.java
deleted file mode 100644
index 6218baaceb..0000000000
--- a/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiPathRegistry.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright the original author or authors.
- *
- * Licensed 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.citrusframework.openapi;
-
-import org.citrusframework.exceptions.CitrusRuntimeException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static java.lang.String.format;
-
-/**
- * A registry to store objects by OpenApi paths. The registry uses a digital tree data structure
- * that performs path matching with variable placeholders. Variable
- * placeholders must be enclosed in curly braces '{}', e.g., '/api/v1/pet/{id}'. This data structure
- * is optimized for matching paths efficiently, handling both static and dynamic segments.
- *
- * This class is currently not in use but may serve scenarios where a path needs to be mapped to an
- * OasOperation without explicit knowledge of the API to which the path belongs.
- * It could be utilized, for instance, in implementing an OAS message validator based on
- * {@link org.citrusframework.validation.AbstractMessageValidator}.
- */
-public class OpenApiPathRegistry {
-
- private static final Logger logger = LoggerFactory.getLogger(OpenApiPathRegistry.class);
-
- private final RegistryNode root = new RegistryNode();
-
- private final Map allPaths = new ConcurrentHashMap<>();
-
- public T search(String path) {
- RegistryNode trieNode = internalSearch(path);
- return trieNode != null ? trieNode.value : null;
- }
-
- RegistryNode internalSearch(String path) {
- String[] segments = path.split("/");
- return searchHelper(root, segments, 0);
- }
-
- public boolean insert(String path, T value) {
- return insertInternal(path, value) != null;
- }
-
- RegistryNode insertInternal(String path, T value) {
-
- if (path == null || value == null) {
- return null;
- }
-
- String[] segments = path.split("/");
- RegistryNode node = root;
-
- if (!allPaths.isEmpty() && (isPathAlreadyContainedWithDifferentValue(path, value)
- || isPathMatchedByOtherPath(path, value))) {
- return null;
- }
-
- allPaths.put(path, value);
- StringBuilder builder = new StringBuilder();
- for (String segment : segments) {
- if (builder.isEmpty() || builder.charAt(builder.length() - 1) != '/') {
- builder.append("/");
- }
- builder.append(segment);
-
- if (!node.children.containsKey(segment)) {
- RegistryNode trieNode = new RegistryNode();
- trieNode.path = builder.toString();
- node.children.put(segment, trieNode);
- }
- node = node.children.get(segment);
- }
-
- // Sanity check to disallow overwrite of existing values
- if (node.value != null && !node.value.equals(value)) {
- throw new CitrusRuntimeException(format(
- "Illegal attempt to overwrite an existing node value. This is probably a bug. path=%s value=%s",
- node.path, node.value));
- }
- node.value = value;
-
- return node;
- }
-
- /**
- * Tests if the path is either matching an existing path or any existing path matches the given
- * patch.
- *
org.citrusframeworkcitrus-ws${project.version}
+
+ org.citrusframework
+ citrus-test-api-core
+ ${project.version}
+
+
+ org.citrusframework
+ citrus-groovy
+ ${project.version}
+ test
+
+
+
+ org.citrusframework
+ citrus-validation-groovy
+ ${project.version}
+ test
+
+
+ org.citrusframework
+ citrus-test-api-spring
+ ${project.version}
+ org.assertj
@@ -88,6 +110,12 @@
${spring.boot.version}test
+
+ commons-fileupload
+ commons-fileupload
+ 1.5
+ test
+
@@ -98,7 +126,7 @@
${maven.helper.plugin.version}
- add-generated-specs
+ add-generated-test-resourcesgenerate-test-resourcesadd-test-resource
@@ -113,7 +141,7 @@
- add-generated-classes
+ add-generated-test-classesgenerate-test-sourcesadd-test-source
@@ -215,56 +243,54 @@
generate
- ${project.basedir}/src/test/resources/apis/petstore.yaml
+ ${project.basedir}/src/test/resources/apis/petstore-v3.yamlorg.citrusframework.openapi.generator.rest.petstoreorg.citrusframework.openapi.generator.rest.petstore.requestorg.citrusframework.openapi.generator.rest.petstore.model
- PetStore
- petStoreEndpoint
+ petStore
+ petstore.endpoint
- generate-openapi-files-for-soap
+ generate-openapi-petstore-extended-filescompilegenerate
- ${project.basedir}/src/test/resources/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformerTest/BookService-generated.yaml
+ ${project.basedir}/src/test/resources/apis/petstore-extended-v3.yaml
- SOAP
- org.citrusframework.openapi.generator.soap.bookservice
- org.citrusframework.openapi.generator.soap.bookservice.request
- org.citrusframework.openapi.generator.soap.bookservice.model
- SoapSample
- OpenApiFromWsdl
- soapSampleEndpoint
+ org.citrusframework.openapi.generator.rest.extpetstore
+ org.citrusframework.openapi.generator.rest.extpetstore.request
+ org.citrusframework.openapi.generator.rest.extpetstore.model
+ ExtPetStore
+ extpetstore.endpoint
-
-
- generate-openapi-multiparttest-files
+ generate-openapi-files-for-soapcompilegenerate
- ${project.basedir}/src/test/resources/apis/multiparttest-rest-resource.yaml
+ ${project.basedir}/src/test/resources/apis/BookService-generated.yaml
- org.citrusframework.openapi.generator.rest.multiparttest
- org.citrusframework.openapi.generator.rest.multiparttest.request
- org.citrusframework.openapi.generator.rest.multiparttest.model
- MultipartTest
- multipartTestEndpoint
+ SOAP
+ org.citrusframework.openapi.generator.soap.bookservice
+ org.citrusframework.openapi.generator.soap.bookservice.request
+ org.citrusframework.openapi.generator.soap.bookservice.model
+ BookService
+ bookstore.endpoint
+
diff --git a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/CitrusJavaCodegen.java b/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/CitrusJavaCodegen.java
new file mode 100644
index 0000000000..50ae1d21b9
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/CitrusJavaCodegen.java
@@ -0,0 +1,595 @@
+/*
+ * Copyright the original author or authors.
+ *
+ * Licensed 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.citrusframework.openapi.generator;
+
+import static java.lang.Boolean.TRUE;
+import static java.lang.String.format;
+import static java.util.Arrays.asList;
+import static java.util.stream.Collectors.toMap;
+import static org.citrusframework.util.ReflectionHelper.copyFields;
+import static org.citrusframework.util.StringUtils.appendSegmentToUrlPath;
+import static org.citrusframework.util.StringUtils.titleCase;
+import static org.openapitools.codegen.CliOption.newString;
+import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
+import static org.openapitools.codegen.utils.StringUtils.camelize;
+
+import io.swagger.v3.core.util.Yaml;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.Operation;
+import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.media.Schema;
+import io.swagger.v3.oas.models.parameters.Parameter;
+import io.swagger.v3.oas.models.parameters.RequestBody;
+import io.swagger.v3.oas.models.servers.Server;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+import lombok.Getter;
+import lombok.Setter;
+import org.citrusframework.exceptions.CitrusRuntimeException;
+import org.citrusframework.openapi.testapi.RestApiReceiveMessageActionBuilder;
+import org.citrusframework.openapi.testapi.RestApiSendMessageActionBuilder;
+import org.citrusframework.openapi.testapi.SoapApiReceiveMessageActionBuilder;
+import org.citrusframework.openapi.testapi.SoapApiSendMessageActionBuilder;
+import org.openapitools.codegen.CodegenOperation;
+import org.openapitools.codegen.CodegenParameter;
+import org.openapitools.codegen.CodegenSecurity;
+import org.openapitools.codegen.CodegenType;
+import org.openapitools.codegen.SupportingFile;
+import org.openapitools.codegen.languages.AbstractJavaCodegen;
+import org.openapitools.codegen.model.ModelMap;
+import org.openapitools.codegen.model.OperationMap;
+import org.openapitools.codegen.model.OperationsMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Getter
+@Setter
+public class CitrusJavaCodegen extends AbstractJavaCodegen {
+
+ private static final Logger logger = LoggerFactory.getLogger(CitrusJavaCodegen.class);
+
+ public static final String CODEGEN_NAME = "java-citrus";
+
+ public static final String API_TYPE_REST = "REST";
+ public static final String API_TYPE_SOAP = "SOAP";
+
+ public static final String API_ENDPOINT = "apiEndpoint";
+ public static final String API_TYPE = "apiType";
+ public static final String GENERATED_SCHEMA_FOLDER = "generatedSchemaFolder";
+ public static final String PREFIX = "prefix";
+ public static final String RESOURCE_FOLDER = "resourceFolder";
+ public static final String SOURCE_FOLDER = "sourceFolder";
+ public static final String TARGET_XMLNS_NAMESPACE = "targetXmlnsNamespace";
+ public static final String REQUEST_BUILDER_CLASS = "requestBuilderClass";
+ public static final String RESPONSE_BUILDER_CLASS = "responseBuilderClass";
+ public static final String REQUEST_BUILDER_CLASS_NAME = "requestBuilderClassName";
+ public static final String RESPONSE_BUILDER_CLASS_NAME = "responseBuilderClassName";
+
+ protected String apiPrefix = "Api";
+
+ protected String httpClient = API_ENDPOINT;
+
+ protected String resourceFolder =
+ "src" + File.separator + "main" + File.separator + "resources";
+ protected String generatedSchemaFolder = "schema" + File.separator + "xsd";
+ protected String targetXmlnsNamespace;
+
+ protected String apiVersion = "1.0.0";
+ private String invokerFolder;
+ private String springFolder;
+ private String schemaFolder;
+
+ public CitrusJavaCodegen() {
+ super();
+
+ templateDir = CODEGEN_NAME;
+
+ configureAdditionalProperties();
+ configureReservedWords();
+ configureCliOptions();
+ configureTypeMappings();
+ }
+
+ private void configureAdditionalProperties() {
+ additionalProperties.put("apiVersion", apiVersion);
+ additionalProperties.put(API_TYPE, API_TYPE_REST);
+ additionalProperties.put("useJakartaEe", true);
+ }
+
+ private void configureReservedWords() {
+ Set reservedWordsTemp = reservedWords();
+ reservedWordsTemp.addAll(
+ asList(
+ "name",
+ "description",
+ "httpClient",
+ "message",
+ "endpoint",
+ "validate",
+ "validator",
+ "validators",
+ "process",
+ "selector",
+ "transform",
+ "build",
+ "actor",
+ "process")
+ );
+ setReservedWordsLowerCase(new ArrayList<>(reservedWordsTemp));
+ }
+
+ private void configureCliOptions() {
+ cliOptions.add(
+ newString(API_ENDPOINT,
+ "Which http client should be used (default " + httpClient + ")."));
+ cliOptions.add(
+ newString(API_TYPE,
+ "Specifies the type of API to be generated specify SOAP to generate a SOAP API. By default a REST API will be generated"
+ )
+ );
+ cliOptions.add(
+ newString(GENERATED_SCHEMA_FOLDER,
+ "The schema output directory (default " + generatedSchemaFolder + ").")
+ );
+ cliOptions.add(
+ newString(PREFIX,
+ "Add a prefix before the name of the files. First character should be upper case (default "
+ + apiPrefix + ")."
+ )
+ );
+ cliOptions.add(newString(PREFIX, "The api prefix (default " + apiPrefix + ")."));
+ cliOptions.add(
+ newString(RESOURCE_FOLDER,
+ "Where the resource files are emitted (default " + resourceFolder + ")."));
+ cliOptions.add(
+ newString(TARGET_XMLNS_NAMESPACE,
+ "Xmlns namespace of the schema (default " + targetXmlnsNamespace + ").")
+ );
+ }
+
+ private void configureTypeMappings() {
+ this.typeMapping.put("binary", "Resource");
+ this.typeMapping.put("file", "Resource");
+ }
+
+ /**
+ * Returns human-friendly help for the generator. Provide the consumer with help tips,
+ * parameters here
+ *
+ * @return A string value for the help message
+ */
+ @Override
+ public String getHelp() {
+ return "Generates citrus api requests.";
+ }
+
+ /**
+ * Configures a friendly name for the generator. This will be used by the generator to select
+ * the library with the -g flag.
+ *
+ * @return the friendly name for the generator
+ */
+ @Override
+ public String getName() {
+ return CODEGEN_NAME;
+ }
+
+ /**
+ * Configures the type of generator.
+ *
+ * @return the CodegenType for this generator
+ * @see org.openapitools.codegen.CodegenType
+ */
+ @Override
+ public CodegenType getTag() {
+ return CodegenType.CLIENT;
+ }
+
+ @Override
+ public void processOpts() {
+ super.processOpts();
+ setupEndpoint();
+ setupApiPrefix();
+ setupNamespace();
+ setupFolders();
+ setupApiType();
+ addDefaultSupportingFiles();
+ writeApiToResourceFolder();
+ }
+
+ private void setupEndpoint() {
+ if (additionalProperties.containsKey(API_ENDPOINT)) {
+ this.setHttpClient(additionalProperties.get(API_ENDPOINT).toString());
+ }
+ additionalProperties.put(API_ENDPOINT, httpClient);
+ }
+
+ private void setupApiPrefix() {
+ if (additionalProperties.containsKey(PREFIX)) {
+ this.setApiPrefix(additionalProperties.get(PREFIX).toString());
+ additionalProperties.put(PREFIX, apiPrefix);
+ additionalProperties.put(PREFIX + "LowerCase", apiPrefix.toLowerCase());
+ } else {
+ logger.warn(
+ "Using empty prefix for code generation. A prefix can be configured using \"{}\" property.",
+ PREFIX);
+ apiPrefix = "";
+ }
+ }
+
+ private void setupNamespace() {
+ if (additionalProperties.containsKey(TARGET_XMLNS_NAMESPACE)) {
+ this.setTargetXmlnsNamespace(
+ additionalProperties.get(TARGET_XMLNS_NAMESPACE).toString());
+ } else {
+ this.targetXmlnsNamespace = format(
+ "http://www.citrusframework.org/citrus-test-schema/%s-api",
+ apiPrefix.toLowerCase());
+ }
+ additionalProperties.put(TARGET_XMLNS_NAMESPACE, targetXmlnsNamespace);
+ }
+
+ private void setupFolders() {
+ if (additionalProperties.containsKey(GENERATED_SCHEMA_FOLDER)) {
+ this.setGeneratedSchemaFolder(
+ additionalProperties.get(GENERATED_SCHEMA_FOLDER).toString());
+ }
+ additionalProperties.put(GENERATED_SCHEMA_FOLDER, generatedSchemaFolder);
+
+ if (additionalProperties.containsKey(RESOURCE_FOLDER)) {
+ this.setResourceFolder(additionalProperties.get(RESOURCE_FOLDER).toString());
+ }
+ additionalProperties.put(RESOURCE_FOLDER, resourceFolder);
+
+ invokerFolder = (sourceFolder + File.separator + invokerPackage).replace(".",
+ File.separator);
+ springFolder = invokerFolder + File.separator + "spring";
+ schemaFolder = resourceFolder + File.separator + generatedSchemaFolder;
+ }
+
+ private void setupApiType() {
+ Object apiType = additionalProperties.get(API_TYPE);
+ if (API_TYPE_REST.equals(apiType)) {
+ setupRestApiType(springFolder, schemaFolder);
+ } else if (API_TYPE_SOAP.equals(apiType)) {
+ setupSoapApiType(springFolder, schemaFolder);
+ } else {
+ throw new IllegalArgumentException(format("Unknown API_TYPE: '%s'", apiType));
+ }
+ }
+
+ private void setupSoapApiType(String springFolder, String schemaFolder) {
+ additionalProperties.put(REQUEST_BUILDER_CLASS,
+ SoapApiSendMessageActionBuilder.class.getName());
+ additionalProperties.put(REQUEST_BUILDER_CLASS_NAME,
+ SoapApiSendMessageActionBuilder.class.getSimpleName());
+ additionalProperties.put(RESPONSE_BUILDER_CLASS,
+ SoapApiReceiveMessageActionBuilder.class.getName());
+ additionalProperties.put(RESPONSE_BUILDER_CLASS_NAME,
+ SoapApiReceiveMessageActionBuilder.class.getSimpleName());
+ additionalProperties.put("isRest", false);
+ additionalProperties.put("isSoap", true);
+ addSoapSupportingFiles(springFolder, schemaFolder);
+ }
+
+ private void setupRestApiType(String springFolder, String schemaFolder) {
+ additionalProperties.put(REQUEST_BUILDER_CLASS,
+ RestApiSendMessageActionBuilder.class.getName());
+ additionalProperties.put(REQUEST_BUILDER_CLASS_NAME,
+ RestApiSendMessageActionBuilder.class.getSimpleName());
+ additionalProperties.put(RESPONSE_BUILDER_CLASS,
+ RestApiReceiveMessageActionBuilder.class.getName());
+ additionalProperties.put(RESPONSE_BUILDER_CLASS_NAME,
+ RestApiReceiveMessageActionBuilder.class.getSimpleName());
+ additionalProperties.put("isRest", true);
+ additionalProperties.put("isSoap", false);
+
+ addRestSupportingFiles(springFolder, schemaFolder);
+ }
+
+ /**
+ * Store a copy of the source open api as resource.
+ */
+ private void writeApiToResourceFolder() {
+
+ String directoryPath = appendSegmentToUrlPath(getOutputDir(), getResourceFolder());
+ directoryPath = appendSegmentToUrlPath(directoryPath,
+ invokerPackage.replace('.', File.separatorChar));
+
+ String filename = getApiPrefix() + "_openApi.yaml";
+
+ File directory = new File(directoryPath);
+ if (!directory.exists() && !directory.mkdirs()) {
+ throw new CitrusRuntimeException("Unable to create directory for api resource!");
+ }
+
+ File file = new File(directory, filename);
+
+ try (FileWriter writer = new FileWriter(file)) {
+ String yamlContent = Yaml.pretty(openAPI);
+ writer.write(yamlContent);
+ } catch (IOException e) {
+ throw new CitrusRuntimeException(
+ "Unable to write OpenAPI to resource folder: " + file.getAbsolutePath());
+ }
+ }
+
+ @Override
+ public void preprocessOpenAPI(OpenAPI openAPI) {
+ super.preprocessOpenAPI(openAPI);
+
+ Info info = openAPI.getInfo();
+ Map extensions = info.getExtensions();
+ if (extensions != null) {
+ additionalProperties.putAll(extensions);
+
+ Map infoExtensions = extensions.entrySet().stream()
+ .filter(entry -> entry.getKey().toUpperCase().startsWith("X-"))
+ .collect(toMap(Entry::getKey, Entry::getValue));
+ additionalProperties.put("infoExtensions", infoExtensions);
+ }
+ }
+
+ private void addRestSupportingFiles(String springFolder,
+ String schemaFolder) {
+
+ supportingFiles.add(new SupportingFile("namespace_handler.mustache", springFolder,
+ titleCase(apiPrefix) + "NamespaceHandler.java"));
+ supportingFiles.add(new SupportingFile("schema.mustache", schemaFolder,
+ apiPrefix.toLowerCase() + "-api.xsd"));
+ }
+
+ private void addSoapSupportingFiles(String springFolder, String schemaFolder) {
+ // Remove the default api template file
+ apiTemplateFiles().remove("api.mustache");
+ apiTemplateFiles().put("api_soap.mustache", ".java");
+
+ supportingFiles.add(new SupportingFile("namespace_handler_soap.mustache", springFolder,
+ titleCase(apiPrefix) + "NamespaceHandler.java"));
+ supportingFiles.add(new SupportingFile("schema_soap.mustache", schemaFolder,
+ apiPrefix.toLowerCase() + "-api.xsd"));
+ }
+
+ private void addDefaultSupportingFiles() {
+ supportingFiles.add(new SupportingFile("api_locator.mustache", invokerFolder,
+ titleCase(apiPrefix) + ".java"));
+ supportingFiles.add(new SupportingFile("bean_configuration.mustache", springFolder,
+ titleCase(apiPrefix) + "BeanConfiguration.java"));
+ }
+
+ @Override
+ public CodegenParameter fromRequestBody(RequestBody body, Set imports,
+ String bodyParameterName) {
+ CodegenParameter codegenParameter = super.fromRequestBody(body, imports, bodyParameterName);
+ return convertToCustomCodegenParameter(codegenParameter);
+ }
+
+ @Override
+ public CodegenParameter fromFormProperty(String name, Schema propertySchema,
+ Set imports) {
+ CodegenParameter codegenParameter = super.fromFormProperty(name, propertySchema, imports);
+ return convertToCustomCodegenParameter(codegenParameter);
+ }
+
+ @Override
+ public CodegenParameter fromParameter(Parameter parameter, Set imports) {
+ CodegenParameter codegenParameter = super.fromParameter(parameter, imports);
+
+ if ("File".equals(codegenParameter.dataType)) {
+ codegenParameter.dataType = "Resource";
+ }
+
+ return convertToCustomCodegenParameter(codegenParameter);
+ }
+
+ /**
+ * Converts given codegenParameter to a custom {@link CustomCodegenParameter} to provide
+ * additional derived properties.
+ */
+ private CustomCodegenParameter convertToCustomCodegenParameter(
+ CodegenParameter codegenParameter) {
+ CustomCodegenParameter customCodegenParameter = new CustomCodegenParameter();
+ copyFields(CodegenParameter.class, codegenParameter, customCodegenParameter);
+
+ customCodegenParameter.isBaseTypeString = codegenParameter.isString || "String".equals(
+ codegenParameter.baseType);
+
+ return customCodegenParameter;
+ }
+
+ @Override
+ public CodegenOperation fromOperation(String path,
+ String httpMethod,
+ Operation operation,
+ List servers) {
+ CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
+ return convertToCustomCodegenOperation(op);
+
+ }
+
+ /**
+ * Converts given codegenOperation to a custom {@link CustomCodegenOperation} to provide
+ * additional derived properties.
+ */
+ private CustomCodegenOperation convertToCustomCodegenOperation(
+ CodegenOperation codegenOperation) {
+
+ CustomCodegenOperation customOperation = new CustomCodegenOperation();
+
+ copyFields(CodegenOperation.class, codegenOperation, customOperation);
+
+ customOperation.requiredNonBodyParams.addAll(customOperation.requiredParams
+ .stream()
+ .filter(param -> !param.isBodyParam).toList());
+
+ customOperation.needsConstructorWithAllStringParameter =
+ !customOperation.requiredParams.isEmpty() &&
+ customOperation.requiredParams
+ .stream()
+ .anyMatch(
+ param -> !param.isBodyParam && !"String".equals(param.dataType));
+
+ if (customOperation.optionalParams != null) {
+ customOperation.optionalAndAuthParameterNames.addAll(
+ customOperation.optionalParams.stream()
+ .map(codegenParameter ->
+ toVarName(codegenParameter.nameInCamelCase))
+ .toList());
+ }
+
+ return customOperation;
+ }
+
+ @Override
+ public OperationsMap postProcessOperationsWithModels(OperationsMap objs,
+ List allModels) {
+ OperationsMap operationsMap = super.postProcessOperationsWithModels(objs, allModels);
+
+ OperationMap operations = objs.getOperations();
+ List operationList = operations.getOperation();
+ if (operationList != null) {
+ operationList.forEach(codegenOperation -> {
+ if (codegenOperation instanceof CustomCodegenOperation customCodegenOperation
+ && customCodegenOperation.authMethods != null) {
+ postProcessSecurityParameters(customCodegenOperation);
+ }
+ });
+ }
+
+ return operationsMap;
+ }
+
+ private static void postProcessSecurityParameters(
+ CustomCodegenOperation customCodegenOperation) {
+ customCodegenOperation.hasApiKeyAuth = customCodegenOperation.authMethods.stream()
+ .anyMatch(codegenSecurity -> codegenSecurity.isApiKey);
+
+ customCodegenOperation.authWithParameters = customCodegenOperation.hasApiKeyAuth;
+ for (CodegenSecurity codegenSecurity : customCodegenOperation.authMethods) {
+ if (TRUE.equals(codegenSecurity.isBasicBasic)) {
+ customCodegenOperation.optionalAndAuthParameterNames.add(
+ "basicAuthUsername");
+ customCodegenOperation.optionalAndAuthParameterNames.add(
+ "basicAuthPassword");
+ customCodegenOperation.authWithParameters = true;
+ } else if (TRUE.equals(codegenSecurity.isApiKey)) {
+ customCodegenOperation.optionalAndAuthParameterNames.add(
+ camelize(codegenSecurity.keyParamName, LOWERCASE_FIRST_LETTER));
+ customCodegenOperation.authWithParameters = true;
+ } else if (TRUE.equals(codegenSecurity.isBasicBearer)) {
+ customCodegenOperation.optionalAndAuthParameterNames.add(
+ "basicAuthBearer");
+ customCodegenOperation.authWithParameters = true;
+ }
+ }
+ }
+
+ static class CustomCodegenOperation extends CodegenOperation {
+
+ private final List requiredNonBodyParams;
+
+ /**
+ * List of all optional parameters plus all authentication specific parameter names.
+ */
+ private final List optionalAndAuthParameterNames;
+
+ private boolean needsConstructorWithAllStringParameter;
+
+ private boolean authWithParameters;
+
+ private boolean hasApiKeyAuth;
+
+ public CustomCodegenOperation() {
+ super();
+ requiredNonBodyParams = new ArrayList<>();
+ optionalAndAuthParameterNames = new ArrayList<>();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ CustomCodegenOperation that = (CustomCodegenOperation) o;
+ return needsConstructorWithAllStringParameter
+ == that.needsConstructorWithAllStringParameter
+ && hasApiKeyAuth == that.hasApiKeyAuth && Objects.equals(requiredNonBodyParams,
+ that.requiredNonBodyParams) && Objects.equals(optionalAndAuthParameterNames,
+ that.optionalAndAuthParameterNames);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), requiredNonBodyParams,
+ optionalAndAuthParameterNames,
+ needsConstructorWithAllStringParameter, hasApiKeyAuth);
+ }
+ }
+
+ static class CustomCodegenParameter extends CodegenParameter {
+
+ boolean isBaseTypeString;
+
+ public CustomCodegenParameter() {
+ super();
+ }
+
+ @Override
+ public CustomCodegenParameter copy() {
+ CodegenParameter copy = super.copy();
+ CustomCodegenParameter customCopy = new CustomCodegenParameter();
+
+ copyFields(CodegenParameter.class, copy, customCopy);
+ customCopy.isBaseTypeString = isBaseTypeString;
+
+ return customCopy;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ CustomCodegenParameter that = (CustomCodegenParameter) o;
+ return isBaseTypeString == that.isBaseTypeString;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), isBaseTypeString);
+ }
+ }
+}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/JavaCitrusCodegen.java b/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/JavaCitrusCodegen.java
deleted file mode 100644
index c624c885f6..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/JavaCitrusCodegen.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright the original author or authors.
- *
- * Licensed 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.citrusframework.openapi.generator;
-
-import static java.lang.String.format;
-import static java.util.Arrays.asList;
-import static java.util.stream.Collectors.toMap;
-import static org.openapitools.codegen.CliOption.newString;
-
-import io.swagger.v3.oas.models.OpenAPI;
-import io.swagger.v3.oas.models.info.Info;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import lombok.Getter;
-import lombok.Setter;
-import org.openapitools.codegen.CodegenType;
-import org.openapitools.codegen.SupportingFile;
-import org.openapitools.codegen.languages.AbstractJavaCodegen;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Getter
-@Setter
-public class JavaCitrusCodegen extends AbstractJavaCodegen {
-
- private static final Logger logger = LoggerFactory.getLogger(JavaCitrusCodegen.class);
-
- private static final String ABSTRACT_TEST_REQUEST_JAVA = "AbstractTestRequest.java";
- private static final String API_TYPE_REST = "REST";
- private static final String API_TYPE_SOAP = "SOAP";
- public static final String CODEGEN_NAME = "java-citrus";
-
- // possible optional parameters
- public static final String API_ENDPOINT = "apiEndpoint";
- public static final String API_TYPE = "apiType";
- public static final String GENERATED_SCHEMA_FOLDER = "generatedSchemaFolder";
- public static final String HTTP_PATH_PREFIX = "httpPathPrefix";
- public static final String OPENAPI_SCHEMA = "openapiSchema";
- public static final String PREFIX = "prefix";
- public static final String RESOURCE_FOLDER = "resourceFolder";
- public static final String SOURCE_FOLDER = "sourceFolder";
- public static final String TARGET_XMLNS_NAMESPACE = "targetXmlnsNamespace";
-
- // default values for optional parameters
- protected String apiPrefix = "Api";
-
- protected String httpClient = API_ENDPOINT;
- protected String httpPathPrefix = "api";
- protected String openapiSchema = "oas3";
- protected String resourceFolder =
- "src" + File.separator + "main" + File.separator + "resources";
- protected String generatedSchemaFolder = "schema" + File.separator + "xsd";
- protected String targetXmlnsNamespace;
-
- protected String apiVersion = "1.0.0";
-
- public JavaCitrusCodegen() {
- super();
-
- // the root folder where all files are emitted
- outputFolder = "generated-code" + File.separator + "java";
-
- // this is the location which templates will be read from in the - resources - directory
- templateDir = CODEGEN_NAME;
-
- // register additional properties which will be available in the templates
- additionalProperties.put("apiVersion", apiVersion);
-
- // set default
- additionalProperties.put(API_TYPE, API_TYPE_REST);
- additionalProperties.put("useJakartaEe", true);
-
- // add additional reserved words used in CitrusAbstractTestRequest and its base class to prevent name collisions
- Set reservedWordsTemp = reservedWords();
- reservedWordsTemp.addAll(
- asList(
- "name",
- "description",
- "actor",
- "httpClient",
- "dataSource",
- "schemaValidation",
- "schema",
- "headerContentType",
- "headerAccept",
- "bodyFile",
- "responseType",
- "responseStatus",
- "responseReasonPhrase",
- "responseVersion",
- "resource",
- "responseVariable",
- "responseValue",
- "cookies",
- "script",
- "type"
- )
- );
- setReservedWordsLowerCase(new ArrayList<>(reservedWordsTemp));
-
- // add possibility to set a new value for the properties
- cliOptions.add(
- newString(API_ENDPOINT,
- "Which http client should be used (default " + httpClient + ")."));
- cliOptions.add(
- newString(API_TYPE,
- "Specifies the type of API to be generated specify SOAP to generate a SOAP API. By default a REST API will be generated"
- )
- );
- cliOptions.add(
- newString(GENERATED_SCHEMA_FOLDER,
- "The schema output directory (default " + generatedSchemaFolder + ").")
- );
- cliOptions.add(
- newString(HTTP_PATH_PREFIX,
- "Add a prefix to http path for all APIs (default " + httpPathPrefix + ")."));
- cliOptions.add(
- newString(OPENAPI_SCHEMA,
- "Which OpenAPI schema should be used (default " + openapiSchema + ")."));
- cliOptions.add(
- newString(PREFIX,
- "Add a prefix before the name of the files. First character should be upper case (default " + apiPrefix + ")."
- )
- );
- cliOptions.add(newString(PREFIX, "The api prefix (default " + apiPrefix + ")."));
- cliOptions.add(
- newString(RESOURCE_FOLDER,
- "Where the resource files are emitted (default " + resourceFolder + ")."));
- cliOptions.add(
- newString(TARGET_XMLNS_NAMESPACE,
- "Xmlns namespace of the schema (default " + targetXmlnsNamespace + ").")
- );
- }
-
- /**
- * Returns human-friendly help for the generator. Provide the consumer with help tips,
- * parameters here
- *
- * @return A string value for the help message
- */
- @Override
- public String getHelp() {
- return "Generates citrus api requests.";
- }
-
- /**
- * Configures a friendly name for the generator. This will be used by the generator to select
- * the library with the -g flag.
- *
- * @return the friendly name for the generator
- */
- @Override
- public String getName() {
- return CODEGEN_NAME;
- }
-
- /**
- * Configures the type of generator.
- *
- * @return the CodegenType for this generator
- * @see org.openapitools.codegen.CodegenType
- */
- @Override
- public CodegenType getTag() {
- return CodegenType.CLIENT;
- }
-
- @Override
- public void processOpts() {
- super.processOpts();
-
- if (additionalProperties.containsKey(API_ENDPOINT)) {
- this.setHttpClient(additionalProperties.get(API_ENDPOINT).toString());
- }
- additionalProperties.put(API_ENDPOINT, httpClient);
-
- if (additionalProperties.containsKey(GENERATED_SCHEMA_FOLDER)) {
- this.setGeneratedSchemaFolder(additionalProperties.get(GENERATED_SCHEMA_FOLDER).toString());
- }
- additionalProperties.put(GENERATED_SCHEMA_FOLDER, generatedSchemaFolder);
-
- if (additionalProperties.containsKey(HTTP_PATH_PREFIX)) {
- this.setHttpPathPrefix(additionalProperties.get(HTTP_PATH_PREFIX).toString());
- additionalProperties.put(HTTP_PATH_PREFIX, httpPathPrefix);
- } else {
- logger.warn(
- "Using empty http-path-prefix for code generation. A http-path-prefix can be configured using \"{}\" property.",
- HTTP_PATH_PREFIX
- );
- httpPathPrefix = "";
- }
-
- if (additionalProperties.containsKey(OPENAPI_SCHEMA)) {
- this.setOpenapiSchema(additionalProperties.get(OPENAPI_SCHEMA).toString());
- }
- additionalProperties.put(OPENAPI_SCHEMA, openapiSchema);
-
- if (additionalProperties.containsKey(PREFIX)) {
- this.setApiPrefix(additionalProperties.get(PREFIX).toString());
- additionalProperties.put(PREFIX, apiPrefix);
- additionalProperties.put(PREFIX + "LowerCase", apiPrefix.toLowerCase());
- } else {
- logger.warn(
- "Using empty prefix for code generation. A prefix can be configured using \"{}\" property.",
- PREFIX);
- apiPrefix = "";
- }
-
- if (additionalProperties.containsKey(RESOURCE_FOLDER)) {
- this.setResourceFolder(additionalProperties.get(RESOURCE_FOLDER).toString());
- }
- additionalProperties.put(RESOURCE_FOLDER, resourceFolder);
-
- if (additionalProperties.containsKey(TARGET_XMLNS_NAMESPACE)) {
- this.setTargetXmlnsNamespace(additionalProperties.get(TARGET_XMLNS_NAMESPACE).toString());
- } else {
- this.targetXmlnsNamespace = format("http://www.citrusframework.org/citrus-test-schema/%s-api", apiPrefix.toLowerCase());
- }
- additionalProperties.put(TARGET_XMLNS_NAMESPACE, targetXmlnsNamespace);
-
- // define different folders where the files will be emitted
- final String invokerFolder = (sourceFolder + File.separator + invokerPackage).replace(".", File.separator);
- final String citrusFolder = invokerFolder + File.separator + "citrus";
- final String extensionFolder = citrusFolder + File.separator + "extension";
- final String springFolder = invokerFolder + File.separator + "spring";
- final String schemaFolder = resourceFolder + File.separator + generatedSchemaFolder;
-
- Object apiType = additionalProperties.get(API_TYPE);
- if (API_TYPE_REST.equals(apiType)) {
- addRestSupportingFiles(citrusFolder, schemaFolder);
- } else if (API_TYPE_SOAP.equals(apiType)) {
- addSoapSupportingFiles(citrusFolder, schemaFolder);
- } else {
- throw new IllegalArgumentException(format("Unknown API_TYPE: '%s'", apiType));
- }
-
- addDefaultSupportingFiles(citrusFolder, extensionFolder, springFolder);
- }
-
- @Override
- public void preprocessOpenAPI(OpenAPI openAPI) {
- super.preprocessOpenAPI(openAPI);
-
- Info info = openAPI.getInfo();
- Map extensions = info.getExtensions();
- if (extensions != null) {
- additionalProperties.putAll(extensions);
-
- Map infoExtensions = extensions.entrySet().stream()
- .filter(entry -> entry.getKey().toUpperCase().startsWith("X-"))
- .collect(toMap(Entry::getKey, Entry::getValue));
- additionalProperties.put("infoExtensions", infoExtensions);
- }
- }
-
- private void addRestSupportingFiles(final String citrusFolder, String schemaFolder) {
- supportingFiles.add(new SupportingFile("schema.mustache", schemaFolder, apiPrefix.toLowerCase() + "-api.xsd"));
- supportingFiles.add(new SupportingFile("test_base.mustache", citrusFolder, apiPrefix + ABSTRACT_TEST_REQUEST_JAVA));
- }
-
- private void addSoapSupportingFiles(final String citrusFolder, String schemaFolder) {
- // Remove the default api template file
- apiTemplateFiles().remove("api.mustache");
- apiTemplateFiles().put("api_soap.mustache", ".java");
-
- supportingFiles.add(new SupportingFile("schema_soap.mustache", schemaFolder, apiPrefix.toLowerCase() + "-api.xsd"));
- supportingFiles.add(new SupportingFile("api_soap.mustache", citrusFolder, apiPrefix + ABSTRACT_TEST_REQUEST_JAVA));
- supportingFiles.add(new SupportingFile("test_base_soap.mustache", citrusFolder, apiPrefix + ABSTRACT_TEST_REQUEST_JAVA));
- }
-
- private void addDefaultSupportingFiles(final String citrusFolder, final String extensionFolder, final String springFolder) {
- supportingFiles.add(new SupportingFile("bean_configuration.mustache", springFolder, apiPrefix + "BeanConfiguration.java"));
- supportingFiles.add(new SupportingFile("bean_definition_parser.mustache", citrusFolder, apiPrefix + "BeanDefinitionParser.java"));
- supportingFiles.add(new SupportingFile("namespace_handler.mustache", extensionFolder, apiPrefix + "NamespaceHandler.java"));
- supportingFiles.add(new SupportingFile("api-model.mustache", resourceFolder, apiPrefix.toLowerCase() + "-api-model.csv"));
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/TestApiClientRequestActionBuilder.java b/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/TestApiClientRequestActionBuilder.java
deleted file mode 100644
index 7945002312..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/TestApiClientRequestActionBuilder.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.citrusframework.openapi.generator;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.citrusframework.actions.SendMessageAction;
-import org.citrusframework.openapi.OpenApiSpecification;
-import org.citrusframework.openapi.actions.OpenApiClientRequestActionBuilder;
-import org.springframework.http.MediaType;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-
-public class TestApiClientRequestActionBuilder extends OpenApiClientRequestActionBuilder {
-
- // TODO: do we really need this?
- protected OpenApiSpecification openApiSpec;
-
- private final String path;
-
- private final Map pathParameters = new HashMap<>();
-
- private final MultiValueMap formData = new LinkedMultiValueMap<>();
-
- // TODO: can we just pass in the operation?
- public TestApiClientRequestActionBuilder(OpenApiSpecification openApiSpec, String method, String path, String operationName) {
- super(openApiSpec, "%s_%s".formatted(method, path));
- name(String.format("%s:%s", "PetStore".toLowerCase(), operationName));
- getMessageBuilderSupport().header("citrus_open_api_operation_name", operationName);
- getMessageBuilderSupport().header("citrus_open_api_method", method);
- getMessageBuilderSupport().header("citrus_open_api_path", path);
-
- this.openApiSpec = openApiSpec;
- this.path = path;
- }
-
- protected void pathParameter(String name, String value) {
- pathParameters.put(name, value);
- }
-
- protected void formData(String name, String value) {
- formData.add(name, value);
- }
-
- protected String qualifiedPath(String path) {
-
- String qualifiedPath = path;
- for (Entry entry : pathParameters.entrySet()) {
- qualifiedPath = qualifiedPath.replace("{%s}".formatted(entry.getKey()), entry.getValue());
- }
- return qualifiedPath;
- }
-
- protected String toQueryParam(String...arrayElements) {
- return String.join(",", arrayElements);
- }
-
- @Override
- public SendMessageAction doBuild() {
- // TODO: register callback to modify builder
- path(qualifiedPath(path));
- if (!formData.isEmpty()) {
- // TODO: do we have to explicitly set the content type or is this done by citrus
- messageBuilderSupport.contentType(MediaType.MULTIPART_FORM_DATA_VALUE);
- getMessageBuilderSupport().body(formData);
- }
- return super.doBuild();
- }
-
- }
\ No newline at end of file
diff --git a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformer.java b/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/WsdlToOpenApiTransformer.java
similarity index 60%
rename from test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformer.java
rename to test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/WsdlToOpenApiTransformer.java
index 8243be5aa8..db0be8bfe2 100644
--- a/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformer.java
+++ b/test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/WsdlToOpenApiTransformer.java
@@ -28,6 +28,7 @@
import io.swagger.v3.oas.models.Paths;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import java.net.URI;
import java.util.Collections;
@@ -38,6 +39,7 @@
import javax.wsdl.BindingOperation;
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.soap.SOAPOperation;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
@@ -47,14 +49,56 @@
import org.w3c.dom.Element;
/**
- * Transforms a wsdl specification into a simple OpenApi specification for usage with the OpenApiGenerator.
+ * Transforms a WSDL specification into a simple OpenAPI specification for usage with the OpenApiGenerator.
*
+ * This transformer primarily focuses on mapping WSDL bindings into OpenAPI operations.
+ * It converts SOAP operations described in the WSDL into corresponding HTTP POST operations
+ * in the OpenAPI format. However, it does not convert or map schema information, such as
+ * types or message definitions, from the WSDL.
+ *
+ *
+ *
WSDL to OpenAPI Mapping
+ * The transformer processes the following WSDL elements and maps them to the OpenAPI specification:
+ *
+ *
WSDL Bindings: Mapped to OpenAPI paths and operations. Each binding operation is
+ * converted into a corresponding POST operation in OpenAPI.
+ *
WSDL Operation Name: The operation name in the WSDL is used as the operation ID
+ * in OpenAPI and forms part of the path in the OpenAPI specification.
+ *
Binding Name: The binding name (for example, "SoapBinding") is used to tag the operation
+ * in the OpenAPI specification, allowing operations to be grouped logically by their binding.
+ *
WSDL Documentation: If available, the documentation from the WSDL is extracted and used
+ * as the description for the OpenAPI operation. This provides human-readable documentation for
+ * each operation in the OpenAPI spec.
+ *
+ *
+ * The following elements of the WSDL are not mapped to the OpenAPI specification:
+ *
+ *
WSDL Types and Schema: The schema and type definitions from the WSDL are not included in the
+ * resulting OpenAPI specification. This transformer focuses solely on operations, not data models.
+ *
WSDL Messages: The message parts (input/output) associated with operations are not included
+ * in the OpenAPI output. This transformation only extracts the operations without message payload details.
+
+
+
+
+ {{#responses}}
+ {{#-first}}
+
+
+
+ An enumeration of all specified API response codes.
+
+
+
+
+ {{/-first}}
+
+
+
+ {{#message}}
+ Message: {{message}}
+ {{/message}}
+ {{#dataType}}
+ Datatype: {{dataType}}
+ {{/dataType}}
+
+
+
+ {{#-last}}
+
+
+
+ {{/-last}}
+ {{/responses}}
+
@@ -225,7 +407,8 @@
{{#operations}}
{{#operation}}
-
+
+
{{/operation}}
{{/operations}}
{{/apis}}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/main/resources/java-citrus/schema_soap.mustache b/test-api-generator/citrus-test-api-generator-core/src/main/resources/java-citrus/schema_soap.mustache
index 096cdc9392..39fac4680c 100644
--- a/test-api-generator/citrus-test-api-generator-core/src/main/resources/java-citrus/schema_soap.mustache
+++ b/test-api-generator/citrus-test-api-generator-core/src/main/resources/java-citrus/schema_soap.mustache
@@ -1,123 +1,72 @@
-
-
+{{!
-
+ Copyright the original author or authors.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Licensed 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.
+
+}}
+
+
+
+
{{#apiInfo}}
- {{#apis}}
- {{#operations}}
- {{#operation}}
-
-
-
- {{operationId}}
-
- * It may also serve as an entry point for debugging the code generation process. When executed in debug mode, it allows you to
- * step through the generation process and inspect the resulting output in the specified output directory.
- *
- * To debug the code generator:
- *
- *
Set a breakpoint in the {@code postProcessOperationsWithModels()} method of {@code JavaCitrusCodegen.java}.
- *
In your IDE, launch this test by right-clicking and selecting Debug As > JUnit Test.
- *
- */
-
-class JavaCitrusCodegenTest {
-
- /**
- * Get the absolute path to the test resources directory.
- *
- * @param pathToFileInTestResources The file within {@code src/test/resources} to look for
- * @return the absolute path to the file
- */
- static String getAbsoluteTestResourcePath(String pathToFileInTestResources) {
- URL resourceUrl = JavaCitrusCodegenTest.class.getClassLoader().getResource(pathToFileInTestResources);
- assert resourceUrl != null;
- File inputSpecFile = new File(resourceUrl.getFile());
- return inputSpecFile.getAbsolutePath();
- }
-
- /**
- * Get the absolute path to the project's target directory.
- *
- * @param pathToFileInTargetDirectory The file within {@code target} to look for
- * @return the absolute path to the file
- */
- static String getAbsoluteTargetDirectoryPath(String pathToFileInTargetDirectory) {
- String projectBaseDir = System.getProperty("user.dir"); // Base directory of the project
- File outputDirFile = new File(projectBaseDir, "target/" + pathToFileInTargetDirectory);
- return outputDirFile.getAbsolutePath();
- }
-
- @Test
- void retrieveGeneratorBsSpi() {
- JavaCitrusCodegen codegen = (JavaCitrusCodegen) CodegenConfigLoader.forName("java-citrus");
- assertThat(codegen).isNotNull();
- }
-
- @Test
- void arePredefinedValuesNotEmptyTest() {
- JavaCitrusCodegen codegen = new JavaCitrusCodegen();
-
- assertThat(codegen.getName()).isEqualTo(CODEGEN_NAME);
- assertThat(codegen.getHelp()).isNotEmpty();
- assertThat(codegen.getHttpClient()).isNotEmpty();
- assertThat(codegen.getOpenapiSchema()).isNotEmpty();
- assertThat(codegen.getApiPrefix()).isNotEmpty();
- assertThat(codegen.getHttpPathPrefix()).isNotEmpty();
- assertThat(codegen.getTargetXmlnsNamespace()).isNull();
- assertThat(codegen.getGeneratedSchemaFolder()).isNotEmpty();
- }
-
- @Test
- void areAdditionalPropertiesProcessedTest() {
- final String httpClient = "myTestEndpoint";
- final String openapiSchema = "testSchema";
- final String prefix = "testPrefix";
- final String httpPathPrefix = "test/path";
- final String targetXmlnsNamespace = "http://www.citrusframework.org/schema/test/extension";
- final String generatedSchemaFolder = "generatedResourceFolder";
-
- Map properties = new HashMap<>();
- properties.put(JavaCitrusCodegen.API_ENDPOINT, httpClient);
- properties.put(JavaCitrusCodegen.GENERATED_SCHEMA_FOLDER, generatedSchemaFolder);
- properties.put(JavaCitrusCodegen.HTTP_PATH_PREFIX, httpPathPrefix);
- properties.put(JavaCitrusCodegen.OPENAPI_SCHEMA, openapiSchema);
- properties.put(JavaCitrusCodegen.PREFIX, prefix);
- properties.put(JavaCitrusCodegen.TARGET_XMLNS_NAMESPACE, targetXmlnsNamespace);
-
- JavaCitrusCodegen codegen = new JavaCitrusCodegen();
- codegen.additionalProperties().putAll(properties);
- codegen.processOpts();
-
- assertThat(codegen.getApiPrefix()).isEqualTo(prefix);
- assertThat(codegen.getGeneratedSchemaFolder()).isEqualTo(generatedSchemaFolder);
- assertThat(codegen.getHttpClient()).isEqualTo(httpClient);
- assertThat(codegen.getHttpPathPrefix()).isEqualTo(httpPathPrefix);
- assertThat(codegen.getOpenapiSchema()).isEqualTo(openapiSchema);
- assertThat(codegen.getTargetXmlnsNamespace()).isEqualTo(targetXmlnsNamespace);
- }
-
- @Test
- void areReservedWordsEscapedTest() throws IOException {
- String absoluteInputSpecPath = getAbsoluteTestResourcePath("apis/petstore_reservedWords.yaml");
- String absoluteOutputDirPath = getAbsoluteTargetDirectoryPath("JavaCitrusCodegenTest/petstore_escapedWords");
-
- final CodegenConfigurator configurator = new CodegenConfigurator()
- .setGeneratorName(CODEGEN_NAME)
- .setInputSpec(absoluteInputSpecPath)
- .setOutputDir(absoluteOutputDirPath);
-
- final ClientOptInput clientOptInput = configurator.toClientOptInput();
- DefaultGenerator generator = new DefaultGenerator();
- List outputFiles = generator.opts(clientOptInput).generate();
-
- Optional file = outputFiles.stream()
- .filter(x -> "PetApi.java".equals(x.getName()))
- .findFirst();
-
- assertThat(file).isPresent();
-
- List lines = Files.readAllLines(file.get().toPath(), StandardCharsets.UTF_8);
-
- // "name" is a reserved word, so it should be escaped with an underline for the second parameter
- assertThat(
- lines.stream()
- .filter(x -> x.contains("\"name\", this._name"))
- .count())
- .isEqualTo(1L);
- }
-
- @Test
- void arePathParamsFieldsPresent() throws IOException {
- String absoluteInputSpecPath = getAbsoluteTestResourcePath("apis/petstore.yaml");
- String absoluteOutputDirPath = getAbsoluteTargetDirectoryPath("JavaCitrusCodegenTest/petstore");
-
- final CodegenConfigurator configurator = new CodegenConfigurator()
- .setGeneratorName(CODEGEN_NAME)
- .setInputSpec(absoluteInputSpecPath)
- .setOutputDir(absoluteOutputDirPath);
-
- final ClientOptInput clientOptInput = configurator.toClientOptInput();
- DefaultGenerator generator = new DefaultGenerator();
- List outputFiles = generator.opts(clientOptInput).generate();
-
- Optional file = outputFiles.stream()
- .filter(x -> "PetApi.java".equals(x.getName()))
- .findFirst();
-
- assertThat(file).isPresent();
-
- List lines = Files.readAllLines(file.get().toPath(), StandardCharsets.UTF_8);
-
- // "name" is a reserved word, so it should be escaped with an underline for the second parameter
- assertThat(
- lines.stream()
- .filter(x -> x.contains("private String petId;"))
- .count())
- .isEqualTo(4L);
- assertThat(
- lines.stream()
- .filter(x -> x.contains(
- "endpoint = endpoint.replace(\"{\" + \"petId\" + \"}\", petId);"))
- .count())
- .isEqualTo(4L);
- }
-
- @Test
- void areBasicAuthFieldsPresent() throws IOException {
- String absoluteInputSpecPath = getAbsoluteTestResourcePath("apis/petstore.yaml");
- String absoluteOutputDirPath = getAbsoluteTargetDirectoryPath("JavaCitrusCodegenTest/petstore");
-
- final CodegenConfigurator configurator = new CodegenConfigurator()
- .setGeneratorName(CODEGEN_NAME)
- .setInputSpec(absoluteInputSpecPath)
- .setOutputDir(absoluteOutputDirPath);
-
- final ClientOptInput clientOptInput = configurator.toClientOptInput();
- DefaultGenerator generator = new DefaultGenerator();
- List outputFiles = generator.opts(clientOptInput).generate();
-
- Optional file = outputFiles.stream()
- .filter(x -> "PetApi.java".equals(x.getName()))
- .findFirst();
-
- assertThat(file).isPresent();
-
- List lines = Files.readAllLines(file.get().toPath(), StandardCharsets.UTF_8);
-
- // "name" is a reserved word, so it should be escaped with an underline for the second parameter
- assertThat(
- lines.stream()
- .filter(x -> x.contains("@Value(\"${\" + \"apiEndpoint.basic.username:#{null}}\")"))
- .count())
- .isEqualTo(1L);
- assertThat(
- lines.stream()
- .filter(x -> x.contains("private String basicUsername;"))
- .count())
- .isEqualTo(1L);
- assertThat(
- lines.stream()
- .filter(x ->
- x.contains(
- "messageBuilderSupport.header(\"Authorization\", \"Basic \" + Base64.getEncoder().encodeToString((context.replaceDynamicContentInString(basicUsername)+\":\"+context.replaceDynamicContentInString(basicPassword)).getBytes()));"
- )
- )
- .count())
- .isEqualTo(1L);
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/OpenApiPetStoreTest.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/OpenApiPetStoreTest.java
deleted file mode 100644
index 372219d262..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/OpenApiPetStoreTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.citrusframework.openapi.generator;
-
-import static org.citrusframework.openapi.generator.sample.OpenApiPetStore.PetEntityValidationContext.Builder.pet;
-import static org.mockito.Mockito.mock;
-
-import com.jayway.jsonpath.JsonPath;
-import com.jayway.jsonpath.ReadContext;
-import java.util.Map;
-import net.minidev.json.parser.JSONParser;
-import net.minidev.json.parser.ParseException;
-import org.citrusframework.context.TestContext;
-import org.citrusframework.exceptions.CitrusRuntimeException;
-import org.citrusframework.functions.DefaultFunctionRegistry;
-import org.citrusframework.json.JsonPathUtils;
-import org.citrusframework.message.DefaultMessage;
-import org.citrusframework.message.Message;
-import org.citrusframework.openapi.generator.sample.OpenApiPetStore.AggregateEntityValidationContext;
-import org.citrusframework.openapi.generator.sample.OpenApiPetStore.EntityValidationContext;
-import org.citrusframework.openapi.generator.sample.OpenApiPetStore.PetEntityValidationContext;
-import org.citrusframework.openapi.generator.sample.OpenApiPetStore.PetEntityValidationContext.Builder;
-import org.citrusframework.validation.AbstractMessageValidator;
-import org.citrusframework.validation.DefaultMessageValidatorRegistry;
-import org.citrusframework.validation.ValidationUtils;
-import org.testng.annotations.Test;
-
-public class OpenApiPetStoreTest {
-
- @Test
- public void test() {
- Builder petValidationContextBuilder = pet().id("1234")
- .name("Garfield")
- .category("Cat")
- .address(address -> address
- .street("Nina Hagen Hang")
- .zip("12345")
- .city("Hagen ATW"))
-// .owners(anyOf(List.of(
-// owner -> owner.name("Peter Lustig"),
-// owner -> owner.name("Hans Meier")
-// )))
-// .owners(oneOf(List.of(
-// owner -> owner.name("Seppel Hinterhuber")
-// )))
-// .urls(0, "url1")
-// .urls(1, "url2")
-// .urls("@contains('url1', 'url2')")
- ;
-
- PetEntityValidationContext petValidationContext = petValidationContextBuilder.build();
- OpenApiEntityValidator validator = new OpenApiEntityValidator();
-
- Message receivedMessage = new DefaultMessage();
- receivedMessage.setPayload("""
- {
- "id": 1234,
- "name": "Garfield",
- "category": "Cat",
- "address": {
- "street": "Nina Hagen Hang",
- "zip": "12345",
- "city": "Hagen ATW"
- },
- "owners": [
- {
- "name": "Peter Lustig"
- },
- {
- "name": "Hans Meier"
- }
- ]
- }
- """);
- TestContext testContext = new TestContext();
- testContext.setReferenceResolver(mock());
- testContext.setMessageValidatorRegistry(new DefaultMessageValidatorRegistry());
- testContext.setFunctionRegistry(new DefaultFunctionRegistry());
-
- validator.validateMessage(receivedMessage, null, testContext, petValidationContext);
-
-
- }
-
- public class OpenApiEntityValidator extends
- AbstractMessageValidator {
-
- public void validateMessage(Message receivedMessage, Message controlMessage,
- TestContext context, EntityValidationContext validationContext) {
- System.out.println("asSD");
-
- validateJson(receivedMessage.getPayload(String.class), context, validationContext);
-
-
- }
-
- private void validateJson(String jsonString, TestContext context,
- EntityValidationContext validationContext) {
- validateJsonPathExpressions(jsonString, context, validationContext);
- validateNestedJsonPathExpressions(jsonString, context, validationContext);
- }
-
- @Override
- protected Class getRequiredValidationContextType() {
- return EntityValidationContext.class;
- }
-
- @Override
- public boolean supportsMessageType(String messageType, Message message) {
- return true;
- }
-
-
- private void validateJsonPathExpressions(String jsonString, TestContext context,
- EntityValidationContext validationContext) {
- String jsonPathExpression;
- try {
- JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
- Object receivedJson = parser.parse(jsonString);
- ReadContext readerContext = JsonPath.parse(receivedJson);
-
- for (Map.Entry entry : validationContext.getJsonPathExpressions()
- .entrySet()) {
- Object expectedValue = entry.getValue();
-
- jsonPathExpression = context.replaceDynamicContentInString(entry.getKey());
- Object jsonPathResult = JsonPathUtils.evaluate(readerContext,
- jsonPathExpression);
-
- if (expectedValue instanceof EntityValidationContext entityValidationContext) {
- validateJson((String) jsonPathResult, context, entityValidationContext);
- } else if (expectedValue instanceof AggregateEntityValidationContext>) {
-
- } else {
-
- if (expectedValue instanceof String) {
- //check if expected value is variable or function (and resolve it, if yes)
- expectedValue = context.replaceDynamicContentInString(
- String.valueOf(expectedValue));
- }
-
- //do the validation of actual and expected value for element
- ValidationUtils.validateValues(jsonPathResult, expectedValue,
- jsonPathExpression, context);
-
- logger.debug("Validating element: {}='{}': OK", jsonPathExpression,
- expectedValue);
- }
-
- }
-
- logger.debug("JSONPath element validation successful: All values OK");
- } catch (ParseException e) {
- throw new CitrusRuntimeException("Failed to parse JSON text", e);
- }
- }
-
- private void validateNestedJsonPathExpressions(String jsonString, TestContext context,
- EntityValidationContext validationContext) {
- String jsonPathExpression;
- try {
- JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
- Object receivedJson = parser.parse(jsonString);
- ReadContext readerContext = JsonPath.parse(receivedJson);
-
- for (Map.Entry entry : validationContext.getNestedValidationContextsBuilders()
- .entrySet()) {
-
- jsonPathExpression = context.replaceDynamicContentInString(entry.getKey());
- Object jsonPathResult = JsonPathUtils.evaluate(readerContext,
- jsonPathExpression);
-
- validateJson(jsonPathResult.toString(), context, entry.getValue());
-
- }
-
- logger.debug("JSONPath element validation successful: All values OK");
- } catch (ParseException e) {
- throw new CitrusRuntimeException("Failed to parse JSON text", e);
- }
- }
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/ServiceLoaderTest.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/ServiceLoaderTest.java
deleted file mode 100644
index 419cea9ade..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/ServiceLoaderTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.citrusframework.openapi.generator;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.List;
-import java.util.ServiceLoader;
-import java.util.ServiceLoader.Provider;
-import org.citrusframework.openapi.generator.util.TestApiActionBuilderCustomizer;
-import org.citrusframework.testapi.ApiActionBuilderCustomizerService;
-import org.junit.jupiter.api.Test;
-
-class ServiceLoaderTest {
-
- @Test
- void test() {
- ServiceLoader serviceLoader = ServiceLoader.load(
- ApiActionBuilderCustomizerService.class, ApiActionBuilderCustomizerService.class.getClassLoader());
- List> list = serviceLoader.stream().toList();
- assertThat(list).hasSize(1);
- ApiActionBuilderCustomizerService apiActionBuilderCustomizerService = list.iterator().next()
- .get();
- assertThat(apiActionBuilderCustomizerService).isInstanceOf(TestApiActionBuilderCustomizer.class);
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/SpringBeanConfigurationIT.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/SpringBeanConfigurationIT.java
deleted file mode 100644
index 15dfb85dc3..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/SpringBeanConfigurationIT.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.citrusframework.openapi.generator;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.citrusframework.annotations.CitrusResource;
-import org.citrusframework.annotations.CitrusTest;
-import org.citrusframework.config.CitrusSpringConfig;
-import org.citrusframework.context.TestContext;
-import org.citrusframework.http.client.HttpClient;
-import org.citrusframework.http.client.HttpEndpointConfiguration;
-import org.citrusframework.junit.jupiter.spring.CitrusSpringSupport;
-import org.citrusframework.openapi.generator.SpringBeanConfigurationIT.ClientConfiguration;
-import org.citrusframework.openapi.generator.rest.petstore.request.PetApi.AddPetRequest;
-import org.citrusframework.openapi.generator.rest.petstore.spring.PetStoreBeanConfiguration;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.test.context.ContextConfiguration;
-
-@CitrusSpringSupport
-@ContextConfiguration(classes = {CitrusSpringConfig.class, ClientConfiguration.class, PetStoreBeanConfiguration.class})
-class SpringBeanConfigurationIT {
-
- @Autowired
- private ApplicationContext applicationContext;
-
- @Test
- @CitrusTest
- void fromReferenceResolverIsPrototypeScoped(@CitrusResource TestContext testContext) {
- var addPetRequest = testContext.getReferenceResolver().resolve(AddPetRequest.class);
- assertThat(addPetRequest)
- .isNotNull()
- .isNotEqualTo(testContext.getReferenceResolver().resolve(AddPetRequest.class));
- }
-
- @Test
- void fromSpringApplicationContextIsPrototypeScoped() {
- assertThat(applicationContext.getBean(AddPetRequest.class))
- .isNotNull()
- .isNotEqualTo(applicationContext.getBean(AddPetRequest.class));
- }
-
- @TestConfiguration
- public static class ClientConfiguration {
-
- @Bean(name= {"applicationServiceClient", "petStoreEndpoint"})
- public HttpClient applicationServiceClient() {
- var config = new HttpEndpointConfiguration();
- config.setRequestUrl("http://localhost:9000");
- return new HttpClient(config);
- }
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformerTest.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/WsdlToOpenApiTransformerTest.java
similarity index 87%
rename from test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformerTest.java
rename to test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/WsdlToOpenApiTransformerTest.java
index 1ae66986fd..581a3f065a 100644
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformerTest.java
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/WsdlToOpenApiTransformerTest.java
@@ -10,14 +10,14 @@
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
-class SimpleWsdlToOpenApiTransformerTest {
+class WsdlToOpenApiTransformerTest {
@Test
void testTransform() throws WsdlToOpenApiTransformationException, IOException {
ClassPathResource wsdlResource = new ClassPathResource(
"/org/citrusframework/openapi/generator/SimpleWsdlToOpenApiTransformerTest/BookService.wsdl");
- SimpleWsdlToOpenApiTransformer simpleWsdlToOpenApiTransformer = new SimpleWsdlToOpenApiTransformer(wsdlResource.getURI());
+ WsdlToOpenApiTransformer simpleWsdlToOpenApiTransformer = new WsdlToOpenApiTransformer(wsdlResource.getURI());
String generatedYaml = simpleWsdlToOpenApiTransformer.transformToOpenApi();
Resource expectedYamlResource = new ClasspathResource(
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/OpenApiPetStore.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/OpenApiPetStore.java
deleted file mode 100644
index 5ed27a3765..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/OpenApiPetStore.java
+++ /dev/null
@@ -1,306 +0,0 @@
-package org.citrusframework.openapi.generator.sample;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import org.citrusframework.builder.WithExpressions;
-import org.citrusframework.http.actions.HttpClientRequestActionBuilder;
-import org.citrusframework.http.actions.HttpClientResponseActionBuilder;
-import org.citrusframework.http.client.HttpClient;
-import org.citrusframework.message.DelegatingPathExpressionProcessor;
-import org.citrusframework.message.MessageProcessor;
-import org.citrusframework.message.MessageProcessorAdapter;
-import org.citrusframework.openapi.generator.sample.OpenApiPetStore.EntityValidationContext;
-import org.citrusframework.openapi.generator.sample.OpenApiPetStore.PetEntityValidationContext.Builder;
-import org.citrusframework.openapi.generator.sample.PetApi.FindPetByStatusActionBuilder;
-import org.citrusframework.validation.DelegatingPayloadVariableExtractor;
-import org.citrusframework.validation.context.DefaultValidationContext;
-import org.citrusframework.validation.context.ValidationContext;
-import org.citrusframework.variable.VariableExtractor;
-import org.citrusframework.variable.VariableExtractorAdapter;
-import org.springframework.http.HttpStatus;
-
-public class OpenApiPetStore {
-
- public static OpenApiPetStore openApiPetStore(HttpClient httpClient) {
- return new OpenApiPetStore();
- }
-
- public GetPetIdRequestActionBuilder getPetById() {
- return new GetPetIdRequestActionBuilder();
- }
-
- public FindPetByStatusActionBuilder findByStatus() {
- return new PetApi.FindPetByStatusActionBuilder();
- }
-
- public static class GetPetIdRequestActionBuilder extends HttpClientRequestActionBuilder {
-
- public GetPetIdRequestActionBuilder withPetId(String petId) {
- return this;
- }
-
- }
-
- public GetPetIdResponseActionBuilder receivePetById(HttpStatus status) {
- return new GetPetIdResponseActionBuilder();
- }
-
- public GetPetIdResponseActionBuilder200 receivePetById200() {
- return new GetPetIdResponseActionBuilder200();
- }
-
- public static class GetPetIdResponseActionBuilder extends HttpClientResponseActionBuilder {
-
- }
-
- // Per configured response
- public static class GetPetIdResponseActionBuilder200 extends HttpClientResponseActionBuilder {
-
- public HttpMessageBuilderSupport withPet(
- Consumer validator) {
- PetEntityValidationContext.Builder builder = new PetEntityValidationContext.Builder();
- validator.accept(builder);
- return message().validate(builder);
- }
- }
-
- public static class EntityValidationContext extends DefaultValidationContext {
-
- private Map expressions;
-
-
- private Map nestedValidationContextsBuilders = new HashMap<>();
-
- public EntityValidationContext(Builder, ?> builder) {
- super();
- this.expressions = builder.expressions;
- builder.nestedValidationContextBuilders.forEach((key, value) ->
- nestedValidationContextsBuilders.put(key, value.build()));
-
- }
-
- public Map getJsonPathExpressions() {
- return expressions;
- }
-
- public Map getNestedValidationContextsBuilders() {
- return nestedValidationContextsBuilders;
- }
-
- public static class Builder> implements
- ValidationContext.Builder,
- WithExpressions, VariableExtractorAdapter,
- MessageProcessorAdapter {
-
- private final Map expressions = new HashMap<>();
-
- protected final Map> nestedValidationContextBuilders= new HashMap<>();
-
- @Override
- public B expressions(Map expressions) {
- this.expressions.putAll(expressions);
- return (B) this;
- }
-
- @Override
- public B expression(final String expression,
- final Object value) {
- this.expressions.put(expression, value);
- return (B) this;
- }
-
- @Override
- public EntityValidationContext build() {
- return new EntityValidationContext(this);
- }
-
- @Override
- public MessageProcessor asProcessor() {
- return new DelegatingPathExpressionProcessor.Builder()
- .expressions(expressions)
- .build();
- }
-
- @Override
- public VariableExtractor asExtractor() {
- return new DelegatingPayloadVariableExtractor.Builder()
- .expressions(expressions)
- .build();
- }
-
- }
- }
-
- public static class PetEntityValidationContext extends EntityValidationContext {
-
- public PetEntityValidationContext(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends
- EntityValidationContext.Builder {
-
- public Builder id(String expression) {
- return expression("$.id", expression);
- }
-
- public Builder name(String expression) {
- return expression("$.name", expression);
- }
-
- public Builder category(String expression) {
- return expression("$.category", expression);
- }
-
- public Builder urls(String expression) {
- return expression("$.urls", expression);
- }
-
-
- public Builder urls(int index, String expression) {
- return expression("$.urls[%d]".formatted(index), expression);
- }
-
- public Builder address(Consumer validator) {
- AddressEntityValidationContext.Builder addressEntityValidationContextBuilder = new AddressEntityValidationContext.Builder();
- validator.accept(addressEntityValidationContextBuilder);
- nestedValidationContextBuilders.put("$.address", addressEntityValidationContextBuilder);
-
- return this;
- }
-
-
- public Builder owners(AggregateEntityValidationContext.Builder aggregateContext) {
- nestedValidationContextBuilders.put("$.owners", aggregateContext);
- return this;
- }
-
- public static Builder pet() {
- return new Builder();
- }
-
- @Override
- public PetEntityValidationContext build() {
- return new PetEntityValidationContext(this);
- }
-
- }
- }
-
- public static class AddressEntityValidationContext extends EntityValidationContext {
-
- public AddressEntityValidationContext(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends
- EntityValidationContext.Builder {
-
-
- public Builder street(String expression) {
- return expression("$.street", expression);
- }
-
- public Builder city(String expression) {
- return expression("$.city", expression);
- }
-
- public Builder zip(String expression) {
- return expression("$.zip", expression);
- }
-
- public static Builder address() {
- return new Builder();
- }
-
- @Override
- public AddressEntityValidationContext build() {
- return new AddressEntityValidationContext(this);
- }
-
- }
- }
-
- public static class OwnerEntityValidationContext extends EntityValidationContext {
-
- public OwnerEntityValidationContext(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends
- EntityValidationContext.Builder {
-
- public OwnerEntityValidationContext.Builder address(Consumer validator) {
- AddressEntityValidationContext.Builder addressEntityValidationContextBuilder = new AddressEntityValidationContext.Builder();
- validator.accept(addressEntityValidationContextBuilder);
- nestedValidationContextBuilders.put("address", addressEntityValidationContextBuilder);
- return this;
- }
-
- public OwnerEntityValidationContext.Builder name(String expression) {
- expression("$.name", expression);
- return this;
- }
-
- @Override
- public OwnerEntityValidationContext build() {
- return new OwnerEntityValidationContext(this);
- }
- }
- }
-
- public static class AggregateEntityValidationContext> extends EntityValidationContext {
-
- private final Type type;
-
- private List> validator;
-
- public AggregateEntityValidationContext(Builder builder) {
- super(builder);
-
- this.type = builder.type;
- this.validator = builder.validator;
- }
-
- public enum Type {
- ONE_OF, ANY_OF, ALL_OF, NONE_OF
- }
-
- public static class Builder> extends EntityValidationContext.Builder, Builder> {
-
- private final Type type;
-
- private final List> validator;
-
- public Builder(Type type, List> validator) {
- this.type = type;
- this.validator = validator;
- }
-
- public static > AggregateEntityValidationContext.Builder anyOf(List> validator) {
- return new Builder<>(Type.ANY_OF, validator);
- }
-
- public static > AggregateEntityValidationContext.Builder allOf(List> validator) {
- return new Builder<>(Type.ALL_OF, validator);
- }
-
- public static > AggregateEntityValidationContext.Builder noneOf(List> validator) {
-
- return new Builder<>(Type.NONE_OF, validator);
- }
-
- public static > AggregateEntityValidationContext.Builder oneOf(List> validator) {
- return new Builder<>(Type.ONE_OF, validator);
- }
-
- @Override
- public AggregateEntityValidationContext build() {
- return null;
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/OpenApiPetStore_.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/OpenApiPetStore_.java
deleted file mode 100644
index b810d81281..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/OpenApiPetStore_.java
+++ /dev/null
@@ -1,304 +0,0 @@
-package org.citrusframework.openapi.generator.sample;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import org.citrusframework.builder.WithExpressions;
-import org.citrusframework.http.actions.HttpClientRequestActionBuilder;
-import org.citrusframework.http.actions.HttpClientResponseActionBuilder;
-import org.citrusframework.http.client.HttpClient;
-import org.citrusframework.message.DelegatingPathExpressionProcessor;
-import org.citrusframework.message.MessageProcessor;
-import org.citrusframework.message.MessageProcessorAdapter;
-import org.citrusframework.openapi.generator.sample.PetApi.FindPetByStatusActionBuilder;
-import org.citrusframework.validation.DelegatingPayloadVariableExtractor;
-import org.citrusframework.validation.context.DefaultValidationContext;
-import org.citrusframework.validation.context.ValidationContext;
-import org.citrusframework.variable.VariableExtractor;
-import org.citrusframework.variable.VariableExtractorAdapter;
-import org.springframework.http.HttpStatus;
-
-public class OpenApiPetStore_ {
-
- public static OpenApiPetStore_ openApiPetStore(HttpClient httpClient) {
- return new OpenApiPetStore_();
- }
-
- public GetPetIdRequestActionBuilder getPetById() {
- return new GetPetIdRequestActionBuilder();
- }
-
- public FindPetByStatusActionBuilder findByStatus() {
- return new FindPetByStatusActionBuilder();
- }
-
- public static class GetPetIdRequestActionBuilder extends HttpClientRequestActionBuilder {
-
- public GetPetIdRequestActionBuilder withPetId(String petId) {
- return this;
- }
-
- }
-
- public GetPetIdResponseActionBuilder receivePetById(HttpStatus status) {
- return new GetPetIdResponseActionBuilder();
- }
-
- public GetPetIdResponseActionBuilder200 receivePetById200() {
- return new GetPetIdResponseActionBuilder200();
- }
-
- public static class GetPetIdResponseActionBuilder extends HttpClientResponseActionBuilder {
-
- }
-
- // Per configured response
- public static class GetPetIdResponseActionBuilder200 extends HttpClientResponseActionBuilder {
-
- public HttpMessageBuilderSupport withPet(
- Consumer validator) {
- PetEntityValidationContext.Builder builder = new PetEntityValidationContext.Builder();
- validator.accept(builder);
- return message().validate(builder);
- }
- }
-
- public static class EntityValidationContext extends DefaultValidationContext {
-
- private Map expressions;
-
-
- private Map nestedValidationContextsBuilders = new HashMap<>();
-
- public EntityValidationContext(Builder, ?> builder) {
- super();
- this.expressions = builder.expressions;
- builder.nestedValidationContextBuilders.forEach((key, value) ->
- nestedValidationContextsBuilders.put(key, value.build()));
-
- }
-
- public Map getJsonPathExpressions() {
- return expressions;
- }
-
- public Map getNestedValidationContextsBuilders() {
- return nestedValidationContextsBuilders;
- }
-
- public static class Builder> implements
- ValidationContext.Builder,
- WithExpressions, VariableExtractorAdapter,
- MessageProcessorAdapter {
-
- private final Map expressions = new HashMap<>();
-
- protected final Map> nestedValidationContextBuilders= new HashMap<>();
-
- @Override
- public B expressions(Map expressions) {
- this.expressions.putAll(expressions);
- return (B) this;
- }
-
- @Override
- public B expression(final String expression,
- final Object value) {
- this.expressions.put(expression, value);
- return (B) this;
- }
-
- @Override
- public EntityValidationContext build() {
- return new EntityValidationContext(this);
- }
-
- @Override
- public MessageProcessor asProcessor() {
- return new DelegatingPathExpressionProcessor.Builder()
- .expressions(expressions)
- .build();
- }
-
- @Override
- public VariableExtractor asExtractor() {
- return new DelegatingPayloadVariableExtractor.Builder()
- .expressions(expressions)
- .build();
- }
-
- }
- }
-
- public static class PetEntityValidationContext extends EntityValidationContext {
-
- public PetEntityValidationContext(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends
- EntityValidationContext.Builder {
-
- public Builder id(String expression) {
- return expression("$.id", expression);
- }
-
- public Builder name(String expression) {
- return expression("$.name", expression);
- }
-
- public Builder category(String expression) {
- return expression("$.category", expression);
- }
-
- public Builder urls(String expression) {
- return expression("$.urls", expression);
- }
-
-
- public Builder urls(int index, String expression) {
- return expression("$.urls[%d]".formatted(index), expression);
- }
-
- public Builder address(Consumer validator) {
- AddressEntityValidationContext.Builder addressEntityValidationContextBuilder = new AddressEntityValidationContext.Builder();
- validator.accept(addressEntityValidationContextBuilder);
- nestedValidationContextBuilders.put("$.address", addressEntityValidationContextBuilder);
-
- return this;
- }
-
-
- public Builder owners(AggregateEntityValidationContext.Builder aggregateContext) {
- nestedValidationContextBuilders.put("$.owners", aggregateContext);
- return this;
- }
-
- public static Builder pet() {
- return new Builder();
- }
-
- @Override
- public PetEntityValidationContext build() {
- return new PetEntityValidationContext(this);
- }
-
- }
- }
-
- public static class AddressEntityValidationContext extends EntityValidationContext {
-
- public AddressEntityValidationContext(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends
- EntityValidationContext.Builder {
-
-
- public Builder street(String expression) {
- return expression("$.street", expression);
- }
-
- public Builder city(String expression) {
- return expression("$.city", expression);
- }
-
- public Builder zip(String expression) {
- return expression("$.zip", expression);
- }
-
- public static Builder address() {
- return new Builder();
- }
-
- @Override
- public AddressEntityValidationContext build() {
- return new AddressEntityValidationContext(this);
- }
-
- }
- }
-
- public static class OwnerEntityValidationContext extends EntityValidationContext {
-
- public OwnerEntityValidationContext(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends
- EntityValidationContext.Builder {
-
- public Builder address(Consumer validator) {
- AddressEntityValidationContext.Builder addressEntityValidationContextBuilder = new AddressEntityValidationContext.Builder();
- validator.accept(addressEntityValidationContextBuilder);
- nestedValidationContextBuilders.put("address", addressEntityValidationContextBuilder);
- return this;
- }
-
- public Builder name(String expression) {
- expression("$.name", expression);
- return this;
- }
-
- @Override
- public OwnerEntityValidationContext build() {
- return new OwnerEntityValidationContext(this);
- }
- }
- }
-
- public static class AggregateEntityValidationContext> extends EntityValidationContext {
-
- private final Type type;
-
- private List> validator;
-
- public AggregateEntityValidationContext(Builder builder) {
- super(builder);
-
- this.type = builder.type;
- this.validator = builder.validator;
- }
-
- public enum Type {
- ONE_OF, ANY_OF, ALL_OF, NONE_OF
- }
-
- public static class Builder> extends EntityValidationContext.Builder, Builder> {
-
- private final Type type;
-
- private final List> validator;
-
- public Builder(Type type, List> validator) {
- this.type = type;
- this.validator = validator;
- }
-
- public static > Builder anyOf(List> validator) {
- return new Builder<>(Type.ANY_OF, validator);
- }
-
- public static > Builder allOf(List> validator) {
- return new Builder<>(Type.ALL_OF, validator);
- }
-
- public static > Builder noneOf(List> validator) {
-
- return new Builder<>(Type.NONE_OF, validator);
- }
-
- public static > Builder oneOf(List> validator) {
- return new Builder<>(Type.ONE_OF, validator);
- }
-
- @Override
- public AggregateEntityValidationContext build() {
- return null;
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetApi.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetApi.java
deleted file mode 100644
index 325be20a88..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetApi.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright the original author or authors.
- *
- * Licensed 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.citrusframework.openapi.generator.sample;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.citrusframework.http.client.HttpClient;
-import org.citrusframework.openapi.OpenApiSpecification;
-import org.citrusframework.openapi.generator.TestApiClientRequestActionBuilder;
-import org.citrusframework.openapi.generator.rest.petstore.model.Pet;
-import org.citrusframework.testapi.GeneratedApi;
-
-@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.JavaCitrusCodegen", date = "2024-07-20T08:47:39.378047600+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
-public class PetApi implements GeneratedApi {
-
- public static final PetApi INSTANCE = new PetApi();
-
- public String getApiTitle() {
- return "OpenAPI Petstore";
- }
-
- public String getApiVersion() {
- return "1.0.0";
- }
-
- public String getApiPrefix() {
- return "PetStore";
- }
-
- private OpenApiSpecification openApiSpecification = null;
-
- public Map getApiInfoExtensions() {
- Map infoExtensionMap = new HashMap<>();
- infoExtensionMap.put("x-citrus-api-name", "petstore");
- infoExtensionMap.put("x-citrus-app", "PETS");
- return infoExtensionMap;
- }
-
- public static PetApi openApiPetStore(HttpClient httpClient) {
-
- return new PetApi();
- }
-
- private static OpenApiSpecification petApi() {
- // TODO implement me
- return null;
- }
-
- public AddPetActionBuilder addPet() {
- return new AddPetActionBuilder();
- }
-
- public DeletePetActionBuilder deletePet() {
- return new DeletePetActionBuilder();
- }
-
- public FindPetByStatusActionBuilder findPetsByStatus() {
- return new FindPetByStatusActionBuilder();
- }
-
- public FindPetsByTagsActionBuilder findPetsByTags() {
- return new FindPetsByTagsActionBuilder();
- }
-
- public GetPetByIdActionBuilder getPetById() {
- return new GetPetByIdActionBuilder();
- }
-
- public class AddPetActionBuilder extends PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "POST";
-
- private static final String ENDPOINT = "/pet";
-
- private static final String OPERATION_NAME = "addPet";
-
- public AddPetActionBuilder() {
- super(openApiSpecification, METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public AddPetActionBuilder withStatus(String status) {
- queryParam("status", status);
- return this;
- }
-
- public AddPetActionBuilder withPet(Pet pet) {
- // TODO: fix this
- getMessageBuilderSupport().body(pet.toString());
- return this;
- }
-
- }
-
- public class DeletePetActionBuilder extends TestApiClientRequestActionBuilder {
-
- private static final String METHOD = "DELETE";
-
- private static final String ENDPOINT = "/pet/{petId}";
-
- private static final String OPERATION_NAME = "deletePet";
-
- public DeletePetActionBuilder() {
- super(openApiSpecification, METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public DeletePetActionBuilder withId(String id) {
- pathParameter("id", id);
- return this;
- }
-
- public DeletePetActionBuilder withPet(Pet pet) {
- // TODO: fix this pet.toString will not properly work
- getMessageBuilderSupport().body(pet.toString());
- return this;
- }
-
- }
-
- public static class FindPetByStatusActionBuilder extends PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "GET";
-
- private static final String ENDPOINT = "/pet/findByStatus";
-
- private static final String OPERATION_NAME = "findPetsByStatus";
-
- public FindPetByStatusActionBuilder() {
- super(PetApi.petApi(), METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public FindPetByStatusActionBuilder withStatus(String status) {
- queryParam("status", status);
- return this;
- }
-
- }
-
- public static class FindPetsByTagsActionBuilder extends PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "GET";
-
- private static final String ENDPOINT = "/pet/findByTags";
-
- private static final String OPERATION_NAME = "findPetsByTags";
-
- public FindPetsByTagsActionBuilder() {
- super(PetApi.petApi(), METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public FindPetsByTagsActionBuilder withTags(String... tags) {
- queryParam("tags", toQueryParam(tags));
- return this;
- }
- }
-
- public static class GetPetByIdActionBuilder extends PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "GET";
-
- private static final String ENDPOINT = "/pet/{petId}";
-
- private static final String OPERATION_NAME = "getPetById";
-
- public GetPetByIdActionBuilder() {
- super(PetApi.petApi(), METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public GetPetByIdActionBuilder withId(String id) {
- pathParameter("id", id);
- return this;
- }
-
-
-
- // TODO: find solution for authentication
-// public GetPetByIdActionBuilder withBasicUsername(String basicUsername) {
-// this.basicUsername = basicUsername;
-// return this;
-// }
-//
-// public GetPetByIdActionBuilder withBasicPassword(String basicPassword) {
-// this.basicPassword = basicPassword;
-// return this;
-// }
- }
-
- public static class UpdatePetActionBuilder extends PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "PUT";
-
- private static final String ENDPOINT = "/pet";
-
- private static final String OPERATION_NAME = "updatePet";
-
- public UpdatePetActionBuilder() {
- super(PetApi.petApi(), METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public UpdatePetActionBuilder withId(String id) {
- pathParameter("id", id);
- return this;
- }
-
- public UpdatePetActionBuilder withPet(Pet pet) {
- // TODO: fix this pet.toString
- getMessageBuilderSupport().body(pet.toString());
- return this;
- }
- }
-
- public static class UpdatePetWithFormDataActionBuilder extends
- PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "POST";
-
- private static final String ENDPOINT = "/pet/{petId}";
-
- private static final String OPERATION_NAME = "updatePetWithForm";
-
- public UpdatePetWithFormDataActionBuilder() {
- super(PetApi.petApi(), METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public UpdatePetWithFormDataActionBuilder withId(String id) {
- pathParameter("id", id);
- return this;
- }
-
- // TODO: what is the magic about form data request?
- }
-
- public static class UploadFileActionBuilder extends PetStoreAbstractSendAction.Builder {
-
- private static final String METHOD = "POST";
-
- private static final String ENDPOINT = "/pet/{petId}/uploadImage";
-
- private static final String OPERATION_NAME = "uploadImage";
-
- public UploadFileActionBuilder() {
- super(PetApi.petApi(), METHOD, ENDPOINT, OPERATION_NAME);
- }
-
- public UploadFileActionBuilder withId(String id) {
- pathParameter("id", id);
- return this;
- }
-
- public UploadFileActionBuilder withAdditionalMetadata(String additionalMetadata) {
-
- // TODO: what is the magic about form data request?
- formData("additionalMetadata", additionalMetadata);
- return this;
- }
- }
-
-
-
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetStoreAbstractReceiveActionBuilder.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetStoreAbstractReceiveActionBuilder.java
deleted file mode 100644
index e8f1e5c473..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetStoreAbstractReceiveActionBuilder.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
-* Copyright the original author or authors.
-*
-* Licensed 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.citrusframework.openapi.generator.sample;
-
-import static org.springframework.util.CollectionUtils.isEmpty;
-
-import jakarta.annotation.Nullable;
-import java.util.List;
-import java.util.Map;
-import java.util.ServiceLoader;
-import javax.sql.DataSource;
-import org.citrusframework.actions.AbstractTestAction;
-import org.citrusframework.actions.ReceiveMessageAction;
-import org.citrusframework.context.TestContext;
-import org.citrusframework.http.actions.HttpActionBuilder;
-import org.citrusframework.http.actions.HttpClientRequestActionBuilder;
-import org.citrusframework.http.actions.HttpClientResponseActionBuilder;
-import org.citrusframework.http.actions.HttpClientResponseActionBuilder.HttpMessageBuilderSupport;
-import org.citrusframework.http.client.HttpClient;
-import org.citrusframework.message.Message;
-import org.citrusframework.spi.Resources;
-import org.citrusframework.testapi.ApiActionBuilderCustomizerService;
-import org.citrusframework.testapi.GeneratedApi;
-import org.citrusframework.validation.DelegatingPayloadVariableExtractor;
-import org.citrusframework.validation.PathExpressionValidationContext;
-import org.citrusframework.validation.json.JsonMessageValidationContext;
-import org.citrusframework.validation.script.ScriptValidationContext;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-
-@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.JavaCitrusCodegen", date = "2024-07-20T08:47:39.378047600+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
-public abstract class PetStoreAbstractReceiveActionBuilder extends AbstractTestAction {
-
- protected final Marker coverageMarker = MarkerFactory.getMarker("PETSTORE-API-COVERAGE");
-
- @Autowired
- @Qualifier("petStoreEndpoint")
- protected HttpClient httpClient;
-
- @Autowired(required = false)
- protected DataSource dataSource;
-
- @Autowired(required = false)
- private List actionBuilderCustomizerServices;
-
- // attributes of differentNodes
- protected boolean schemaValidation;
- protected String schema;
- protected String bodyContentType;
- protected String bodyLiteralContentType;
- protected String bodyFile;
- protected String bodyLiteral;
- protected String responseAcceptType = "*/*";
- protected String responseType = "json";
- protected int responseStatus = 200;
- protected String responseReasonPhrase = "OK";
- protected String responseVersion = "HTTP/1.1";
-
- // children of response element
- protected String resource;
- protected Map responseVariable; // Contains the 'JSON-PATH' as key and the 'VARIABLE NAME' as value
- protected Map responseValue; // Contains the 'JSON-PATH' as key and the 'VALUE TO BE VALIDATED' as value
- protected Map cookies;
- protected Map headers;
- protected String script;
- protected String type; // default script type is groovy - supported types see com.consol.citrus.script.ScriptTypes
-
- @Override
- public void doExecute(TestContext context) {
- recieveResponse(context);
- }
-
- /**
- * This method receives the HTTP-Response.
- *
- * @deprecated use {@link PetStoreAbstractReceiveActionBuilder#receiveResponse(TestContext)} instead.
- */
- public ReceiveMessageAction recieveResponse(TestContext context) {
-
- HttpClientResponseActionBuilder httpClientResponseActionBuilder = new HttpActionBuilder().client(httpClient).receive().response();
- HttpMessageBuilderSupport messageBuilderSupport = httpClientResponseActionBuilder.getMessageBuilderSupport();
-
- messageBuilderSupport
- .statusCode(responseStatus)
- .reasonPhrase(responseReasonPhrase)
- .version(responseVersion)
- .validate(new JsonMessageValidationContext.Builder().schemaValidation(schemaValidation).schema(schema));
-
- if (resource != null) {
- messageBuilderSupport.body(Resources.create(resource));
- }
-
- if (!isEmpty(responseVariable)) {
- DelegatingPayloadVariableExtractor.Builder extractorBuilder = new DelegatingPayloadVariableExtractor.Builder();
- responseVariable.forEach(extractorBuilder::expression);
- messageBuilderSupport.extract(extractorBuilder);
- }
-
- if (!isEmpty(responseValue)) {
- PathExpressionValidationContext.Builder validationContextBuilder = new PathExpressionValidationContext.Builder();
- responseValue.forEach(validationContextBuilder::expression);
- messageBuilderSupport.validate(validationContextBuilder);
- }
-
- if (script != null) {
- ScriptValidationContext.Builder scriptValidationContextBuilder = new ScriptValidationContext.Builder();
- if (type != null) {
- scriptValidationContextBuilder.scriptType(type);
- }
- scriptValidationContextBuilder.script(script);
- messageBuilderSupport.validate(scriptValidationContextBuilder);
- }
-
- messageBuilderSupport.type(responseType);
- httpClientResponseActionBuilder.withReferenceResolver(context.getReferenceResolver());
- var responseAction = httpClientResponseActionBuilder.build();
-
- responseAction.execute(context);
-
- return responseAction;
- }
-
- public @Nullable Message receiveResponse(TestContext context) {
- var responseAction = recieveResponse(context);
-
- var messageStore = context.getMessageStore();
- return messageStore.getMessage(messageStore.constructMessageName(responseAction, httpClient));
- }
-
- public void setSchemaValidation(boolean schemaValidation) {
- this.schemaValidation = schemaValidation;
- }
-
- public void setSchema(String schema) {
- this.schema = schema;
- }
-
- public void setBodyLiteral(String bodyLiteral) {
- this.bodyLiteral = bodyLiteral;
- }
-
- public void setBodyContentType(String bodyContentType) {
- this.bodyContentType = bodyContentType;
- }
-
- public void setBodyLiteralContentType(String bodyLiteralContentType) {
- this.bodyLiteralContentType = bodyLiteralContentType;
- }
-
- public void setResponseAcceptType(String responseAcceptType) {
- this.responseAcceptType = responseAcceptType;
- }
-
- public void setCookie(Map cookies) {
- this.cookies = cookies;
- }
-
- public void setHeader(Map headers) {
- this.headers = headers;
- }
-
- public void setBodyFile(String bodyFile) {
- this.bodyFile = bodyFile;
- }
-
- public void setResponseType(String responseType) {
- this.responseType = responseType;
- }
-
- public void setResponseStatus(int responseStatus) {
- this.responseStatus = responseStatus;
- }
-
- public void setResponseReasonPhrase(String responseReasonPhrase) {
- this.responseReasonPhrase = responseReasonPhrase;
- }
-
- public void setResponseVersion(String responseVersion) {
- this.responseVersion = responseVersion;
- }
-
- public void setResource(String resource) {
- this.resource = resource;
- }
-
- public void setResponseVariable(Map responseVariable) {
- this.responseVariable = responseVariable;
- }
-
- public void setResponseValue(Map responseValue) {
- this.responseValue = responseValue;
- }
-
- public void setScript(String script) {
- this.script = script;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- protected HttpClientRequestActionBuilder customizeBuilder(GeneratedApi generatedApi,
- TestContext context, HttpClientRequestActionBuilder httpClientRequestActionBuilder) {
-
- httpClientRequestActionBuilder = customizeByBeans(generatedApi, context,
- httpClientRequestActionBuilder);
-
- httpClientRequestActionBuilder = customizeBySpi(generatedApi, context, httpClientRequestActionBuilder);
-
- return httpClientRequestActionBuilder;
- }
-
- private HttpClientRequestActionBuilder customizeBySpi(GeneratedApi generatedApi, TestContext context,
- HttpClientRequestActionBuilder httpClientRequestActionBuilder) {
- ServiceLoader serviceLoader = ServiceLoader.load(
- ApiActionBuilderCustomizerService.class, ApiActionBuilderCustomizerService.class.getClassLoader());
- for (ApiActionBuilderCustomizerService service :serviceLoader) {
- httpClientRequestActionBuilder = service.build(generatedApi, this, context, httpClientRequestActionBuilder);
- }
- return httpClientRequestActionBuilder;
- }
-
- private HttpClientRequestActionBuilder customizeByBeans(
- GeneratedApi generatedApi, TestContext context,
- HttpClientRequestActionBuilder httpClientRequestActionBuilder) {
- if (actionBuilderCustomizerServices != null) {
- for (ApiActionBuilderCustomizerService apiActionBuilderCustomizer : actionBuilderCustomizerServices) {
- httpClientRequestActionBuilder = apiActionBuilderCustomizer.build(generatedApi, this,
- context, httpClientRequestActionBuilder);
- }
- }
- return httpClientRequestActionBuilder;
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetStoreAbstractSendActionBuilder.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetStoreAbstractSendActionBuilder.java
deleted file mode 100644
index a02a8d4639..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/sample/PetStoreAbstractSendActionBuilder.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
-* Copyright the original author or authors.
-*
-* Licensed 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.citrusframework.openapi.generator.sample;
-
-import static org.springframework.util.CollectionUtils.isEmpty;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.ServiceLoader;
-import javax.sql.DataSource;
-import org.citrusframework.actions.SendMessageAction;
-import org.citrusframework.context.TestContext;
-import org.citrusframework.http.actions.HttpClientRequestActionBuilder;
-import org.citrusframework.http.client.HttpClient;
-import org.citrusframework.openapi.OpenApiSpecification;
-import org.citrusframework.openapi.actions.OpenApiClientRequestActionBuilder;
-import org.citrusframework.testapi.ApiActionBuilderCustomizerService;
-import org.citrusframework.testapi.GeneratedApi;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.http.MediaType;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-
-@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.JavaCitrusCodegen", date = "2024-07-20T08:47:39.378047600+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
-public abstract class PetStoreAbstractSendAction extends SendMessageAction {
-
- protected final Marker coverageMarker = MarkerFactory.getMarker("PETSTORE-API-COVERAGE");
-
- @Autowired
- @Qualifier("petStoreEndpoint")
- protected HttpClient httpClient;
-
- @Autowired(required = false)
- protected DataSource dataSource;
-
- @Autowired(required = false)
- private List actionBuilderCustomizerServices;
-
- // attributes of differentNodes
- protected boolean schemaValidation;
- protected String schema;
- protected String bodyContentType;
- protected String bodyLiteralContentType;
- protected String bodyFile;
- protected String bodyLiteral;
- protected String responseAcceptType = "*/*";
- protected String responseType = "json";
- protected int responseStatus = 200;
- protected String responseReasonPhrase = "OK";
- protected String responseVersion = "HTTP/1.1";
-
- // children of response element
- protected String resource;
- protected Map responseVariable; // Contains the 'JSON-PATH' as key and the 'VARIABLE NAME' as value
- protected Map responseValue; // Contains the 'JSON-PATH' as key and the 'VALUE TO BE VALIDATED' as value
- protected Map cookies;
- protected Map headers;
- protected String script;
- protected String type; // default script type is groovy - supported types see com.consol.citrus.script.ScriptTypes
-
- @Override
- public void doExecute(TestContext context) {
- sendRequest(context);
- }
-
-
- public abstract void sendRequest(TestContext context);
-
- public void setSchemaValidation(boolean schemaValidation) {
- this.schemaValidation = schemaValidation;
- }
-
- public void setSchema(String schema) {
- this.schema = schema;
- }
-
- public void setBodyLiteral(String bodyLiteral) {
- this.bodyLiteral = bodyLiteral;
- }
-
- public void setBodyContentType(String bodyContentType) {
- this.bodyContentType = bodyContentType;
- }
-
- public void setBodyLiteralContentType(String bodyLiteralContentType) {
- this.bodyLiteralContentType = bodyLiteralContentType;
- }
-
- public void setResponseAcceptType(String responseAcceptType) {
- this.responseAcceptType = responseAcceptType;
- }
-
- public void setCookie(Map cookies) {
- this.cookies = cookies;
- }
-
- public void setHeader(Map headers) {
- this.headers = headers;
- }
-
- public void setBodyFile(String bodyFile) {
- this.bodyFile = bodyFile;
- }
-
- public void setResource(String resource) {
- this.resource = resource;
- }
-
- public void setResponseVariable(Map responseVariable) {
- this.responseVariable = responseVariable;
- }
-
- public void setResponseValue(Map responseValue) {
- this.responseValue = responseValue;
- }
-
- public void setScript(String script) {
- this.script = script;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- protected HttpClientRequestActionBuilder customizeBuilder(GeneratedApi generatedApi,
- TestContext context, HttpClientRequestActionBuilder httpClientRequestActionBuilder) {
-
- httpClientRequestActionBuilder = customizeByBeans(generatedApi, context,
- httpClientRequestActionBuilder);
-
- httpClientRequestActionBuilder = customizeBySpi(generatedApi, context, httpClientRequestActionBuilder);
-
- return httpClientRequestActionBuilder;
- }
-
- private HttpClientRequestActionBuilder customizeBySpi(GeneratedApi generatedApi, TestContext context,
- HttpClientRequestActionBuilder httpClientRequestActionBuilder) {
- ServiceLoader serviceLoader = ServiceLoader.load(
- ApiActionBuilderCustomizerService.class, ApiActionBuilderCustomizerService.class.getClassLoader());
- for (ApiActionBuilderCustomizerService service :serviceLoader) {
- httpClientRequestActionBuilder = service.build(generatedApi, this, context, httpClientRequestActionBuilder);
- }
- return httpClientRequestActionBuilder;
- }
-
- private HttpClientRequestActionBuilder customizeByBeans(
- GeneratedApi generatedApi, TestContext context,
- HttpClientRequestActionBuilder httpClientRequestActionBuilder) {
- if (actionBuilderCustomizerServices != null) {
- for (ApiActionBuilderCustomizerService apiActionBuilderCustomizer : actionBuilderCustomizerServices) {
- httpClientRequestActionBuilder = apiActionBuilderCustomizer.build(generatedApi, this,
- context, httpClientRequestActionBuilder);
- }
- }
- return httpClientRequestActionBuilder;
- }
-
- public static class Builder extends OpenApiClientRequestActionBuilder {
-
- // TODO: do we really need this?
- protected OpenApiSpecification openApiSpec;
-
- private final String path;
-
- private final Map pathParameters = new HashMap<>();
-
- private final MultiValueMap formData = new LinkedMultiValueMap<>();
-
- // TODO: can we just pass in the operation?
- public Builder(OpenApiSpecification openApiSpec, String method, String path, String operationName) {
- super(openApiSpec, "%s_%s".formatted(method, path));
- name(String.format("%s:%s", "PetStore".toLowerCase(), operationName));
- getMessageBuilderSupport().header("citrus_open_api_operation_name", operationName);
- getMessageBuilderSupport().header("citrus_open_api_method", method);
- getMessageBuilderSupport().header("citrus_open_api_path", path);
-
- this.openApiSpec = openApiSpec;
- this.path = path;
- }
-
- protected void pathParameter(String name, String value) {
- pathParameters.put(name, value);
- }
-
- protected void formData(String name, String value) {
- formData.add(name, value);
- }
-
- protected String qualifiedPath(String path) {
-
- String qualifiedPath = path;
- for (Entry entry : pathParameters.entrySet()) {
- qualifiedPath = qualifiedPath.replace("{%s}".formatted(entry.getKey()), entry.getValue());
- }
- return qualifiedPath;
- }
-
- protected String toQueryParam(String...arrayElements) {
- return String.join(",", arrayElements);
- }
-
- @Override
- public SendMessageAction doBuild() {
- // TODO: register callback to modify builder
- path(qualifiedPath(path));
- if (!formData.isEmpty()) {
- // TODO: do we have to explicitly set the content type or is this done by citrus
- messageBuilderSupport.contentType(MediaType.MULTIPART_FORM_DATA_VALUE);
- getMessageBuilderSupport().body(formData);
- }
- return super.doBuild();
- }
-
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/util/MultipartConverter.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/util/MultipartConverter.java
new file mode 100644
index 0000000000..6869b9ecea
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/util/MultipartConverter.java
@@ -0,0 +1,76 @@
+package org.citrusframework.openapi.generator.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.commons.fileupload.MultipartStream;
+import org.citrusframework.exceptions.CitrusRuntimeException;
+import org.citrusframework.http.message.HttpMessage;
+
+/**
+ * Provides utility method to convert a multipart http message to a map for simplified assertion.
+ */
+public class MultipartConverter {
+
+ private static final Pattern NAME_PATTERN = Pattern.compile("name=\"([^\"]+)\"");
+
+ private static final Pattern CONTENT_PATTERN = Pattern.compile("Content-Type:\\s*([^\\s;]+)");
+
+ public static Map multipartMessageToMap(HttpMessage message) {
+ String contentType = message.getContentType();
+ String boundary = contentType.substring(contentType.indexOf("=") + 1);
+
+ Map partMap = new HashMap<>();
+ ByteArrayInputStream inputStream = null;
+ try {
+ inputStream = new ByteArrayInputStream(message.getPayload(String.class).getBytes());
+ MultipartStream multipartStream = new MultipartStream(inputStream, boundary.getBytes(),
+ 4096, null);
+
+ boolean nextPart = multipartStream.skipPreamble();
+ while (nextPart) {
+ String headers = multipartStream.readHeaders();
+ String partName = getHeaderGroup(headers, NAME_PATTERN);
+ String partContentType = getHeaderGroup(headers, CONTENT_PATTERN);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ multipartStream.readBodyData(outputStream);
+ String rawBodyContent = outputStream.toString();
+
+ partMap.put(partName, convertContent(rawBodyContent, partContentType));
+ nextPart = multipartStream.readBoundary();
+ }
+
+ return partMap;
+ } catch (IOException e) {
+ throw new CitrusRuntimeException("Unable to parse multipart data");
+ }
+
+ }
+
+ private static String getHeaderGroup(String headers, Pattern groupPattern) {
+
+ Matcher m = groupPattern.matcher(headers);
+
+ if (m.find()) {
+ return m.group(1);
+ } else {
+ throw new CitrusRuntimeException(
+ "unable to determine header group name: " + groupPattern);
+ }
+ }
+
+ private static Object convertContent(String rawContent, String contentType) {
+ if (contentType != null) {
+ if (contentType.contains("application/octet-stream")) {
+ return rawContent.getBytes(StandardCharsets.ISO_8859_1);
+ }
+ }
+ return rawContent;
+ }
+}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/util/TestApiActionBuilderCustomizer.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/util/TestApiActionBuilderCustomizer.java
deleted file mode 100644
index 1b0b8824a7..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/util/TestApiActionBuilderCustomizer.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.citrusframework.openapi.generator.util;
-
-import org.citrusframework.TestAction;
-import org.citrusframework.actions.SendMessageAction.SendMessageActionBuilder;
-import org.citrusframework.context.TestContext;
-import org.citrusframework.testapi.ApiActionBuilderCustomizerService;
-import org.citrusframework.testapi.GeneratedApi;
-
-public class TestApiActionBuilderCustomizer implements ApiActionBuilderCustomizerService {
-
- @Override
- public > T build(GeneratedApi generatedApi, TestAction action,
- TestContext context, T builder) {
-
- generatedApi.getApiInfoExtensions().forEach((key, value) -> {
- builder.getMessageBuilderSupport().header(key, value);
- });
-
- return builder;
- }
-}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/services/org.citrusframework.testapi.ApiActionBuilderCustomizerService b/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/services/org.citrusframework.testapi.ApiActionBuilderCustomizerService
deleted file mode 100644
index ba96f521f6..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/services/org.citrusframework.testapi.ApiActionBuilderCustomizerService
+++ /dev/null
@@ -1 +0,0 @@
-org.citrusframework.openapi.generator.util.TestApiActionBuilderCustomizer
\ No newline at end of file
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.handlers b/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.handlers
index 1f0c4bdb95..f1955af26b 100644
--- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.handlers
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.handlers
@@ -1,3 +1,3 @@
-http\://www.citrusframework.org/citrus-test-schema/multiparttest-api=org.citrusframework.openapi.generator.rest.multiparttest.citrus.extension.MultipartTestNamespaceHandler
-http\://www.citrusframework.org/citrus-test-schema/openapifromwsdl-api=org.citrusframework.openapi.generator.soap.bookservice.citrus.extension.OpenApiFromWsdlNamespaceHandler
-http\://www.citrusframework.org/citrus-test-schema/petstore-api=org.citrusframework.openapi.generator.rest.petstore.citrus.extension.PetStoreNamespaceHandler
+http\://www.citrusframework.org/citrus-test-schema/bookservice-api=org.citrusframework.openapi.generator.soap.bookservice.spring.BookServiceNamespaceHandler
+http\://www.citrusframework.org/citrus-test-schema/petstore-api=org.citrusframework.openapi.generator.rest.petstore.spring.PetStoreNamespaceHandler
+http\://www.citrusframework.org/citrus-test-schema/extpetstore-api=org.citrusframework.openapi.generator.rest.extpetstore.spring.ExtPetStoreNamespaceHandler
\ No newline at end of file
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.schemas b/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.schemas
index 0050010472..5b3c2539b9 100644
--- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.schemas
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/META-INF/spring.schemas
@@ -1,3 +1,4 @@
-http\://www.citrusframework.org/citrus-test-schema/multiparttest-api/multiparttest-api.xsd=schema/xsd/multiparttest-api.xsd
-http\://www.citrusframework.org/citrus-test-schema/openapifromwsdl-api/openapifromwsdl-api.xsd=schema/xsd/openapifromwsdl-api.xsd
http\://www.citrusframework.org/citrus-test-schema/petstore-api/petstore-api.xsd=schema/xsd/petstore-api.xsd
+http\://www.citrusframework.org/citrus-test-schema/extpetstore-api/extpetstore-api.xsd=schema/xsd/extpetstore-api.xsd
+http\://www.citrusframework.org/citrus-test-schema/bookservice-api/bookservice-api.xsd=schema/xsd/bookservice-api.xsd
+http\://www.citrusframework.org/bookstore/datatypes/BookDatatypes.xsd=schema/xsd/BookDatatypes.xsd
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/BookService-generated.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/BookService-generated.yaml
new file mode 100644
index 0000000000..f70656312d
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/BookService-generated.yaml
@@ -0,0 +1,43 @@
+---
+info:
+ contact:
+ name: "org.citrusframework.openapi.generator.SimpleWsdlToOpenApiTransformer"
+ description: "This api has been generated from the following wsdl 'BookService.wsdl'.\
+ \ It's purpose is solely to serve as input for SOAP API generation. Note that\
+ \ only operations are extracted from the WSDL. No schema information whatsoever\
+ \ is generated!"
+ title: "Generated api from wsdl"
+ version: "1.0.0"
+openapi: "3.0.1"
+paths:
+ /GetBook:
+ post:
+ description: "This operation retrieves details for a specific book identified\
+ \ by its ID."
+ operationId: "GetBook"
+ responses:
+ default:
+ description: "Generic Response"
+ summary: "http://www.citrusframework.com/BookService/GetBook"
+ tags:
+ - "BookServiceSOAP"
+ /AddBook:
+ post:
+ description: ""
+ operationId: "AddBook"
+ responses:
+ default:
+ description: "Generic Response"
+ summary: "http://www.citrusframework.com/BookService/AddBook"
+ tags:
+ - "BookServiceSOAP"
+ /GetAllBooks:
+ post:
+ description: ""
+ operationId: "GetAllBooks"
+ responses:
+ default:
+ description: "Generic Response"
+ summary: "http://www.citrusframework.com/BookService/GetAllBooks"
+ tags:
+ - "BookServiceSOAP"
\ No newline at end of file
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml
deleted file mode 100644
index cfac634788..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/multiparttest-rest-resource.yaml
+++ /dev/null
@@ -1,249 +0,0 @@
-openapi: 3.0.3
-info:
- title: multiparttest API
- version: 2.0.0
- description: |
- The service to test mutlipart
- x-citrus-app: MPT
- x-citrus-api-name: multiparttest-rest-resource
- contact:
- name: Citrusframework Authors
- email: citrus-dev@googlegroups.com
- url: https://citrusframework.org
-tags:
- - name: multiparttest-controller
-paths:
- /api/v2/multitest-file/{bucket}/{filename}/random:
- post:
- tags:
- - multiparttest-controller
- operationId: postRandom
- summary: Uploads random file.
- parameters:
- - name: bucket
- description: The name of an existing s3 bucket.
- in: path
- required: true
- schema:
- type: string
- - name: filename
- description: The name under which to store the random file.
- in: path
- required: true
- schema:
- type: string
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/PutObjectResult'
- 500:
- description: Internal Server Error
- /api/v2/multitest-file/{bucket}/{filename}:
- post:
- tags:
- - multiparttest-controller
- operationId: postFile
- summary: Uploads file.
- parameters:
- - name: bucket
- description: The name of an existing s3 bucket.
- in: path
- required: true
- schema:
- type: string
- - name: filename
- description: The name of the file which should be uploaded. It may override any existing file with the same name.
- in: path
- required: true
- schema:
- type: string
- requestBody:
- required: true
- content:
- multipart/form-data:
- schema:
- type: object
- properties:
- multipartFile:
- type: string
- format: binary
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/PutObjectResult'
- 500:
- description: Internal Server Error
- delete:
- tags:
- - multiparttest-controller
- operationId: deleteObject
- summary: Delete file.
- parameters:
- - name: bucket
- in: path
- required: true
- schema:
- type: string
- description: The name of an existing s3 bucket.
- - name: filename
- in: path
- required: true
- schema:
- type: string
- description: The name of the file which should be deleted.
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- type: boolean
- 500:
- description: Internal Server Error
- /api/v2/multitest-reportgeneration:
- post:
- tags:
- - multiparttest-controller
- operationId: generateReport
- summary: summary
- requestBody:
- required: true
- content:
- multipart/form-data:
- schema:
- type: object
- required: ['template']
- properties:
- template:
- description: |
- Content of the template.
- type: string
- additionalData:
- $ref: '#/components/schemas/AdditionalData'
- schema:
- description: |
- An optional JSON schema to validate the created report against.
- type: string
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/PutObjectResult'
- 500:
- description: Internal Server Error
- /api/v2/multitest-multipledatatypes:
- post:
- tags:
- - multiparttest-controller
- operationId: multipleDatatypes
- summary: summary
- requestBody:
- required: true
- content:
- multipart/form-data:
- schema:
- type: object
- properties:
- stringData:
- type: string
- booleanData:
- type: boolean
- integerData:
- type: integer
-
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/PutObjectResult'
- 500:
- description: Internal Server Error
- /api/v2/multitest-file/{bucket}/{filename}/exists:
- get:
- tags:
- - multiparttest-controller
- operationId: fileExists
- summary: Checks if file exist.
- parameters:
- - name: bucket
- description: The name of an existing s3 bucket.
- in: path
- required: true
- schema:
- type: string
- - name: filename
- description: The name of the file on which the status should be checked.
- in: path
- required: true
- schema:
- type: string
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- type: boolean
- 500:
- description: Internal Server Error
-components:
- schemas:
- Metadata:
- type: object
- properties:
- userMetadata:
- type: object
- additionalProperties:
- type: string
- rawMetadata:
- type: object
- additionalProperties:
- type: string
- httpExpiresDate:
- type: string
- format: date-time
- expirationTime:
- type: string
- format: date-time
- expirationTimeRuleId:
- type: string
- ongoingRestore:
- type: boolean
- restoreExpirationTime:
- type: string
- format: date-time
- bucketKeyEnabled:
- type: boolean
- PutObjectResult:
- type: object
- properties:
- versionId:
- type: string
- eTag:
- type: string
- expirationTime:
- type: string
- format: date-time
- expirationTimeRuleId:
- type: string
- contentMd5:
- type: string
- metadata:
- $ref: '#/components/schemas/Metadata'
- isRequesterCharged:
- type: boolean
- AdditionalData:
- description: |
- Additional data provided to the report. For each dataset requested, provide a json
- object with the name of the dataset.
- type: string
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore-extended-v3.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore-extended-v3.yaml
new file mode 100644
index 0000000000..865466c524
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore-extended-v3.yaml
@@ -0,0 +1,1230 @@
+openapi: 3.0.2
+info:
+ title: Extended Petstore API
+ description: |
+ This is an extended version of the Petstore API which includes additional operations,
+ such as updating a pet using form data and managing vaccination records.
+ version: 1.0.0
+servers:
+ - url: /api/v3/ext
+
+paths:
+ /pet/simple/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithSimpleStyleArray
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/simple/object/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithSimpleStyleObject
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: false
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/simple/exploded/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithSimpleStyleArrayExploded
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/simple/exploded/object/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithSimpleStyleObjectExploded
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: true
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/label/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithLabelStyleArray
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: label
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/label/object/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithLabelStyleObject
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: label
+ explode: false
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/label/exploded/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithLabelStyleArrayExploded
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: label
+ explode: true
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/label/exploded/object/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithLabelStyleObjectExploded
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: label
+ explode: true
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/matrix/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithMatrixStyleArray
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: matrix
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/matrix/object/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithMatrixStyleObject
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: matrix
+ explode: false
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/matrix/exploded/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithMatrixStyleArrayExploded
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: matrix
+ explode: true
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/matrix/exploded/object/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in path parameter
+ operationId: getPetWithMatrixStyleObjectExploded
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: path
+ description: IDs of pet to return
+ required: true
+ style: matrix
+ explode: true
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/header/simple:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithSimpleStyleHeader
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: header
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/header/simple/exploded:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithSimpleStyleExplodedHeader
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: header
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: true
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/header/simple/object:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithSimpleStyleObjectHeader
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: header
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: false
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/header/simple/exploded/object:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithSimpleStyleExplodedObjectHeader
+ description: "Returns multiple pets by ID using multiple ids in header parameter."
+ parameters:
+ - name: petId
+ in: header
+ description: IDs of pet to return
+ required: true
+ style: simple
+ explode: true
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/query/form:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithFormStyleQuery
+ description: "Returns multiple pets by ID using multiple ids in query parameter."
+ parameters:
+ - name: petId
+ in: query
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/query/form/object:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithFormStyleObjectQuery
+ description: "Returns multiple pets by ID using multiple ids in query parameter."
+ parameters:
+ - name: petId
+ in: query
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: false
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/query/form/exploded:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithFormStyleExplodedQuery
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: query
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: true
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/query/form/exploded/object:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithFormStyleExplodedObjectQuery
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: query
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: true
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/query/deep/object:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in header parameter
+ operationId: getPetWithDeepObjectTypeQuery
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: query
+ description: IDs of pet to return
+ required: true
+ style: deepObject
+ explode: true
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/cookie/form:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in cookie parameter
+ operationId: getPetWithFormStyleCookie
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: cookie
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/cookie/form/object:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in cookie parameter
+ operationId: getPetWithFormObjectStyleCookie
+ description: "Returns multiple pets by ID using multiple ids in path parameter."
+ parameters:
+ - name: petId
+ in: cookie
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: false
+ schema:
+ $ref: '#/components/schemas/PetIdentifier'
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/cookie/form/exploded:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet by id supporting multiple ids in cookie parameter
+ operationId: getPetWithFormExplodedStyleCookie
+ description: "Returns multiple pets by ID using multiple ids in cookie parameter."
+ parameters:
+ - name: petId
+ in: cookie
+ description: IDs of pet to return
+ required: true
+ style: form
+ explode: true
+ schema:
+ type: array
+ items:
+ type: integer
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet using a session cookie
+ operationId: getPetWithCookie
+ description: "Returns a single pet by ID, using a session ID stored in a cookie."
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: session_id
+ in: cookie
+ required: true
+ schema:
+ type: string
+ description: The session ID cookie
+ - name: opt_trx_id
+ in: cookie
+ schema:
+ type: string
+ description: The optional transaction ID cookie
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ put:
+ tags:
+ - extPet
+ summary: Updates a pet in the store with query data.
+ description: "Update the name, status, tags and nicknames of an existing pet using query data."
+ operationId: updatePetWithArrayQueryData
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ description: ID of the pet that needs to be updated
+ schema:
+ type: integer
+ format: int64
+ - name: name
+ in: query
+ required: true
+ description: Updated name of the pet
+ schema:
+ type: string
+ - name: status
+ in: query
+ required: true
+ description: Updated status of the pet
+ schema:
+ type: string
+ - name: tags
+ in: query
+ required: true
+ description: Updated tags of the pet
+ schema:
+ type: array
+ items:
+ type: string
+ - name: nicknames
+ in: query
+ required: true
+ description: Updated nicknames of the pet
+ schema:
+ type: array
+ items:
+ type: string
+ - name: sampleStringHeader
+ in: header
+ required: true
+ description: A sample string header
+ schema:
+ type: string
+ - name: sampleIntHeader
+ in: header
+ description: A sample int header
+ schema:
+ type: integer
+ responses:
+ '200':
+ description: Pet successfully updated
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ /pet/form/{petId}:
+ put:
+ tags:
+ - extPet
+ summary: Updates a pet in the store with form data
+ description: "Update the name or status of an existing pet using url encoded form data."
+ operationId: updatePetWithFormUrlEncoded
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ description: ID of the pet that needs to be updated
+ schema:
+ type: integer
+ format: int64
+ requestBody:
+ required: true
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ required: [ "name", "status", "tags", "age" ]
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+ age:
+ description: The age of the pet in years
+ type: integer
+ owners:
+ description: The number of pre owners
+ type: integer
+ tags:
+ type: array
+ items:
+ type: string
+ nicknames:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: Pet successfully updated
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ /secure-basic/pet/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet via basic authentication
+ description: "Returns a single pet by ID, requiring basic authentication."
+ operationId: getPetByIdWithBasicAuthentication
+ security:
+ - basicAuth: [ ]
+
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: allDetails
+ in: query
+ description: Requests all details.
+ required: true
+ schema:
+ type: boolean
+ - name: details
+ in: query
+ description: A list with detail specifiers.
+ schema:
+ type: array
+ items:
+ type: string
+ - name: requesterInformation
+ in: query
+ description: A list of specific requester information.
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /secure-bearer/pet/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet via basic authentication
+ description: "Returns a single pet by ID, requiring basic authentication."
+ operationId: getPetByIdWithBearerAuthentication
+ security:
+ - bearerAuth: [ ]
+
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: allDetails
+ in: query
+ description: Requests all details.
+ required: true
+ schema:
+ type: boolean
+ - name: details
+ in: query
+ description: A list with detail specifiers.
+ schema:
+ type: array
+ items:
+ type: string
+ - name: requesterInformation
+ in: query
+ description: A list of specific requester information.
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /secure-api-key/pet/{petId}:
+ get:
+ tags:
+ - extPet
+ summary: Get a pet via basic authentication
+ description: "Returns a single pet by ID, requiring basic authentication."
+ operationId: getPetByIdWithApiKeyAuthentication
+ security:
+ - api_key_header: [ ]
+ - api_key_query: [ ]
+ - api_key_cookie: [ ]
+
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: allDetails
+ in: query
+ description: Requests all details.
+ required: true
+ schema:
+ type: boolean
+ - name: details
+ in: query
+ description: A list with detail specifiers.
+ required: false
+ schema:
+ type: array
+ items:
+ type: string
+ - name: requesterInformation
+ in: query
+ description: A list of specific requester information.
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: './petstore-v3.yaml#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ /pet/vaccination/{bucket}/{filename}:
+ post:
+ tags:
+ - extPet
+ operationId: postVaccinationDocument
+ summary: Upload a pet vaccination document
+ description: "Uploads a vaccination document for a pet to a specified S3 bucket."
+ parameters:
+ - name: bucket
+ description: The name of an existing S3 bucket.
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: filename
+ description: The name under which to store the vaccination document.
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: Document successfully uploaded
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/VaccinationDocumentResult'
+ '400':
+ description: Bad Request - Invalid parameters supplied
+ '500':
+ description: Internal Server Error
+ /pet/vaccination/status-report:
+ post:
+ tags:
+ - extPet
+ operationId: generateVaccinationReport
+ summary: Generate a vaccination status report
+ description: "Generates a vaccination status report in PDF format based on the provided template and data."
+ requestBody:
+ required: true
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ required: [ 'template', "reqIntVal" ]
+ properties:
+ template:
+ description: |
+ Vaccination report template file.
+ type: string
+ format: binary
+ reqIntVal:
+ description: |
+ A required integer value.
+ type: integer
+ optIntVal:
+ description: |
+ An optional integer value.
+ type: integer
+ optBoolVal:
+ description: |
+ An optional boolean value.
+ type: boolean
+ optNumberVal:
+ description: |
+ An optional number value.
+ type: number
+ optStringVal:
+ description: |
+ An optional string value.
+ type: string
+ optDateVal:
+ description: |
+ An optional date value.
+ type: string
+ format: date
+ additionalData:
+ $ref: '#/components/schemas/HistoricalData'
+ schema:
+ description: |
+ An optional JSON schema file to validate the created report against.
+ type: string
+ format: binary
+ responses:
+ '200':
+ description: A vaccination report in PDF
+ content:
+ application/pdf:
+ schema:
+ type: string
+ format: binary
+ '422':
+ description: Unprocessable Entity - Validation error in the provided data
+ '500':
+ description: Internal Server Error
+ /pet/vaccination/form:
+ post:
+ tags:
+ - extPet
+ operationId: postVaccinationFormData
+ summary: Submit vaccination form data
+ description: "Submits vaccination details for a pet."
+ requestBody:
+ required: true
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ vaccine:
+ type: string
+ description: The name of the vaccine administered.
+ isFirstVaccination:
+ type: boolean
+ description: Indicates if this is the first vaccination or a repetition.
+ doseNumber:
+ type: integer
+ description: The dose number of the vaccine (e.g., 1 for first dose, 2 for second dose).
+ vaccinationDate:
+ type: string
+ format: date
+ description: The date when the vaccination was administered.
+ responses:
+ '201':
+ description: Form data successfully submitted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/VaccinationDocumentResult'
+ '400':
+ description: Bad Request - Invalid form data
+ '500':
+ description: Internal Server Error
+
+components:
+ securitySchemes:
+ basicAuth:
+ type: http
+ scheme: basic
+ bearerAuth:
+ type: http
+ scheme: bearer # Specifies Bearer token authentication
+ bearerFormat: JWT # Optional, specifies the format of the bearer token (e.g., JWT)
+ api_key_header:
+ type: apiKey
+ description: Header api key description
+ name: api_key_header
+ in: header
+ api_key_cookie:
+ type: apiKey
+ description: Cookie api key description
+ name: api_key_cookie
+ in: cookie
+ api_key_query:
+ type: apiKey
+ description: Query api key description
+ name: api_key_query
+ in: query
+
+ schemas:
+ HistoricalData:
+ description: |
+ Additional historical data for a vaccination report, not contained in internal storage.
+ type: object
+ properties:
+ lastVaccinationDate:
+ type: string
+ format: date
+ description: The date of the last vaccination.
+ vaccinationCount:
+ type: integer
+ description: The number of vaccinations the pet has received.
+ VaccinationDocumentResult:
+ type: object
+ properties:
+ documentId:
+ type: string
+ description: The unique ID of the uploaded vaccination document.
+ example: "abc123"
+ PetIdentifier:
+ type: object
+ properties:
+ name:
+ type: string
+ alias:
+ type: string
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore-v3.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore-v3.yaml
new file mode 100644
index 0000000000..6e38ce59fc
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore-v3.yaml
@@ -0,0 +1,803 @@
+openapi: 3.0.2
+info:
+ title: Swagger Petstore - OpenAPI 3.0
+ description: |-
+ This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
+ Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
+ You can now help us improve the API whether it's by making changes to the definition itself or to the code.
+ That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
+
+ Some useful links:
+ - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
+ - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
+ 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
+ version: 1.0.19
+externalDocs:
+ description: Find out more about Swagger
+ url: http://swagger.io
+servers:
+ - url: /api/v3
+tags:
+ - name: pet
+ description: Everything about your Pets
+ externalDocs:
+ description: Find out more
+ url: http://swagger.io
+ - name: store
+ description: Access to Petstore orders
+ externalDocs:
+ description: Find out more about our store
+ url: http://swagger.io
+ - name: user
+ description: Operations about user
+paths:
+ /pet:
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: Update an existing pet by Id
+ operationId: updatePet
+ requestBody:
+ description: Update an existent pet in the store
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ required: true
+ responses:
+ "200":
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ "400":
+ description: Invalid ID supplied
+ "404":
+ description: Pet not found
+ "405":
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: Add a new pet to the store
+ operationId: addPet
+ requestBody:
+ description: Create a new pet in the store
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ required: true
+ responses:
+ "200":
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ "405":
+ description: Invalid input
+ 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
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: false
+ explode: true
+ schema:
+ type: string
+ default: available
+ enum:
+ - available
+ - pending
+ - sold
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ "400":
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: "Multiple tags can be provided with comma separated strings. Use\
+ \ tag1, tag2, tag3 for testing."
+ operationId: findPetsByTags
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: false
+ explode: true
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ "400":
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ /pet/{petId}:
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ "400":
+ description: Invalid ID supplied
+ "404":
+ description: Pet not found
+ security:
+ - api_key: []
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ""
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: name
+ in: query
+ description: Name of pet that needs to be updated
+ schema:
+ type: string
+ - name: status
+ in: query
+ description: Status of pet that needs to be updated
+ schema:
+ type: string
+ responses:
+ "405":
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ""
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ description: ""
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ "400":
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ /pet/{petId}/uploadImage:
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ""
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: additionalMetadata
+ in: query
+ description: Additional Metadata
+ required: false
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ format: binary
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/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
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: Place a new order in the store
+ operationId: placeOrder
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/Order'
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ "405":
+ description: Invalid input
+ /store/order/{orderId}:
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: For valid response try integer IDs with value <= 5 or > 10. Other
+ values will generate exceptions.
+ operationId: getOrderById
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of order that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/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 value < 1000. Anything
+ above 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: integer
+ 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
+ requestBody:
+ description: Created user object
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/User'
+ responses:
+ default:
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: Creates list of users with given input array
+ operationId: createUsersWithListInput
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ responses:
+ "200":
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ default:
+ description: successful operation
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ""
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: false
+ schema:
+ type: string
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: false
+ schema:
+ type: string
+ responses:
+ "200":
+ description: successful operation
+ headers:
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ "400":
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ""
+ operationId: logoutUser
+ parameters: []
+ responses:
+ default:
+ description: successful operation
+ /user/{username}:
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ""
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: 'The name that needs to be fetched. Use user1 for testing. '
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ "400":
+ description: Invalid username supplied
+ "404":
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Update user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that needs to be updated
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: Update an existent user in the store
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/User'
+ responses:
+ default:
+ description: successful operation
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ "400":
+ description: Invalid username supplied
+ "404":
+ description: User not found
+components:
+ schemas:
+ Order:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 10
+ petId:
+ type: integer
+ format: int64
+ example: 198772
+ quantity:
+ type: integer
+ format: int32
+ example: 7
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ example: approved
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ xml:
+ name: order
+ Customer:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 100000
+ username:
+ type: string
+ example: fehguy
+ address:
+ type: array
+ xml:
+ name: addresses
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Address'
+ xml:
+ name: customer
+ Address:
+ type: object
+ properties:
+ street:
+ type: string
+ example: 437 Lytton
+ city:
+ type: string
+ example: Palo Alto
+ state:
+ type: string
+ example: CA
+ zip:
+ type: string
+ example: "94301"
+ xml:
+ name: address
+ Category:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 1
+ name:
+ type: string
+ example: Dogs
+ xml:
+ name: category
+ User:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 10
+ username:
+ type: string
+ example: theUser
+ firstName:
+ type: string
+ example: John
+ lastName:
+ type: string
+ example: James
+ email:
+ type: string
+ example: john@email.com
+ password:
+ type: string
+ example: "12345"
+ phone:
+ type: string
+ example: "12345"
+ userStatus:
+ type: integer
+ description: User Status
+ format: int32
+ example: 1
+ xml:
+ name: user
+ Tag:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: tag
+ Pet:
+ required:
+ - name
+ - photoUrls
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 10
+ name:
+ type: string
+ example: doggie
+ category:
+ $ref: '#/components/schemas/Category'
+ photoUrls:
+ type: array
+ xml:
+ wrapped: true
+ items:
+ type: string
+ xml:
+ name: photoUrl
+ tags:
+ type: array
+ xml:
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/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
+ xml:
+ name: '##default'
+ requestBodies:
+ Pet:
+ description: Pet object that needs to be added to the store
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ UserArray:
+ description: List of user object
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: https://petstore3.swagger.io/oauth/authorize
+ scopes:
+ write:pets: modify pets in your account
+ read:pets: read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore.yaml
deleted file mode 100644
index 79249f26ed..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore.yaml
+++ /dev/null
@@ -1,700 +0,0 @@
-swagger: '2.0'
-info:
- description: 'This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.'
- version: 1.0.0
- x-citrus-app: PETS
- x-citrus-api-name: petstore
- title: OpenAPI Petstore
- license:
- name: Apache-2.0
- url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
-host: petstore.swagger.io
-basePath: /v2
-tags:
- - name: pet
- description: Everything about your Pets
- - name: store
- description: Access to Petstore orders
- - name: user
- description: Operations about user
-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: csv
- 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: 'Multiple 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: csv
- 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: []
- - basicAuth: []
- 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 pet value
- 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/{order_id}':
- get:
- tags:
- - store
- summary: Find purchase order by ID
- description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions'
- operationId: getOrderById
- produces:
- - application/xml
- - application/json
- parameters:
- - name: order_id
- in: path
- description: ID of pet that needs to be fetched
- required: true
- type: integer
- maximum: 5
- minimum: 1
- 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 value < 1000. Anything above 1000 or nonintegers will generate API errors
- operationId: deleteOrder
- produces:
- - application/xml
- - application/json
- parameters:
- - name: order_id
- in: path
- description: ID of the order that needs to be deleted
- required: true
- type: string
- 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 toekn 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 deleted
- 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/api/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
- basicAuth:
- type: basic
-definitions:
- Order:
- title: Pet Order
- description: An order for a pets from the pet store
- 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:
- title: Pet category
- description: A category for a pet
- type: object
- properties:
- id:
- type: integer
- format: int64
- name:
- type: string
- xml:
- name: Category
- User:
- title: a User
- description: A User who is purchasing from the pet store
- 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:
- title: Pet Tag
- description: A tag for a pet
- type: object
- properties:
- id:
- type: integer
- format: int64
- name:
- type: string
- xml:
- name: Tag
- Pet:
- title: a Pet
- description: A pet for sale in the pet store
- 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:
- title: An uploaded response
- description: Describes the result of uploading an image resource
- type: object
- properties:
- code:
- type: integer
- format: int32
- type:
- type: string
- message:
- type: string
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore_reservedWords.yaml b/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore_reservedWords.yaml
deleted file mode 100644
index 7175b75f0e..0000000000
--- a/test-api-generator/citrus-test-api-generator-core/src/test/resources/apis/petstore_reservedWords.yaml
+++ /dev/null
@@ -1,120 +0,0 @@
-swagger: '2.0'
-info:
- description: 'This is a modified Petstore server, that uses the reserved word "name" as parameter name. This should be renamed to "_name" in the generated code.'
- version: 1.0.0
- title: OpenAPI Petstore
- license:
- name: Apache-2.0
- url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
-host: petstore.swagger.io
-basePath: /v2
-tags:
- - name: pet
- description: Everything about your Pets
-schemes:
- - http
-paths:
- /pet/findByName:
- get:
- tags:
- - pet
- summary: Finds Pet by name
- description: Name can be any text
- operationId: findPetByName
- produces:
- - application/xml
- - application/json
- parameters:
- # name is a reserved word and should be masked with an '_' in the generated api
- - name: name
- in: query
- description: Name of the pet
- required: true
- type: string
- responses:
- '200':
- description: successful operation
- schema:
- $ref: '#/definitions/Pet'
- '400':
- description: Invalid name value
- security:
- - petstore_auth:
- - 'write:pets'
- - 'read:pets'
-securityDefinitions:
- petstore_auth:
- type: oauth2
- authorizationUrl: 'http://petstore.swagger.io/api/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:
- Category:
- title: Pet category
- description: A category for a pet
- type: object
- properties:
- id:
- type: integer
- format: int64
- name:
- type: string
- xml:
- name: Category
- Tag:
- title: Pet Tag
- description: A tag for a pet
- type: object
- properties:
- id:
- type: integer
- format: int64
- name:
- type: string
- xml:
- name: Tag
- Pet:
- title: a Pet
- description: A pet for sale in the pet store
- 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
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/ExtPetStore.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/ExtPetStore.java
new file mode 100644
index 0000000000..b3ffdcb025
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/ExtPetStore.java
@@ -0,0 +1,11 @@
+package org.citrusframework.openapi.generator.rest.extpetstore;
+
+import java.net.URL;
+
+public class ExtPetStore {
+
+ public static URL extPetStoreApi() {
+ return ExtPetStore.class.getResource("ExtPetStore_openApi.yaml");
+ }
+
+}
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Category.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Category.java
new file mode 100644
index 0000000000..7f57903b45
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Category.java
@@ -0,0 +1,119 @@
+/*
+* Copyright the original author or authors.
+*
+* Licensed 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.citrusframework.openapi.generator.rest.extpetstore.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Category
+ */
+@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.CitrusJavaCodegen", date = "2024-10-05T19:07:46.194751400+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
+public class Category {
+ private Long id;
+
+ private String _name;
+
+ public Category() {
+ }
+
+ public Category id(Long id) {
+
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get id
+ * @return id
+ **/
+ @jakarta.annotation.Nullable
+
+ public Long getId() {
+ return id;
+ }
+
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+
+ public Category _name(String _name) {
+
+ this._name = _name;
+ return this;
+ }
+
+ /**
+ * Get _name
+ * @return _name
+ **/
+ @jakarta.annotation.Nullable
+
+ public String getName() {
+ return _name;
+ }
+
+
+ public void setName(String _name) {
+ this._name = _name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Category category = (Category) o;
+ return Objects.equals(this.id, category.id) &&
+ Objects.equals(this._name, category._name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, _name);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Category {\n");
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" _name: ").append(toIndentedString(_name)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/HistoricalData.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/HistoricalData.java
new file mode 100644
index 0000000000..1763cfd8c5
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/HistoricalData.java
@@ -0,0 +1,120 @@
+/*
+* Copyright the original author or authors.
+*
+* Licensed 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.citrusframework.openapi.generator.rest.extpetstore.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.time.LocalDate;
+
+/**
+ * Additional historical data for a vaccination report, not contained in internal storage.
+ */
+@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.CitrusJavaCodegen", date = "2024-10-05T19:07:46.194751400+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
+public class HistoricalData {
+ private LocalDate lastVaccinationDate;
+
+ private Integer vaccinationCount;
+
+ public HistoricalData() {
+ }
+
+ public HistoricalData lastVaccinationDate(LocalDate lastVaccinationDate) {
+
+ this.lastVaccinationDate = lastVaccinationDate;
+ return this;
+ }
+
+ /**
+ * The date of the last vaccination.
+ * @return lastVaccinationDate
+ **/
+ @jakarta.annotation.Nullable
+
+ public LocalDate getLastVaccinationDate() {
+ return lastVaccinationDate;
+ }
+
+
+ public void setLastVaccinationDate(LocalDate lastVaccinationDate) {
+ this.lastVaccinationDate = lastVaccinationDate;
+ }
+
+
+ public HistoricalData vaccinationCount(Integer vaccinationCount) {
+
+ this.vaccinationCount = vaccinationCount;
+ return this;
+ }
+
+ /**
+ * The number of vaccinations the pet has received.
+ * @return vaccinationCount
+ **/
+ @jakarta.annotation.Nullable
+
+ public Integer getVaccinationCount() {
+ return vaccinationCount;
+ }
+
+
+ public void setVaccinationCount(Integer vaccinationCount) {
+ this.vaccinationCount = vaccinationCount;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ HistoricalData historicalData = (HistoricalData) o;
+ return Objects.equals(this.lastVaccinationDate, historicalData.lastVaccinationDate) &&
+ Objects.equals(this.vaccinationCount, historicalData.vaccinationCount);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(lastVaccinationDate, vaccinationCount);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class HistoricalData {\n");
+ sb.append(" lastVaccinationDate: ").append(toIndentedString(lastVaccinationDate)).append("\n");
+ sb.append(" vaccinationCount: ").append(toIndentedString(vaccinationCount)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Pet.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Pet.java
new file mode 100644
index 0000000000..82b87e69b6
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Pet.java
@@ -0,0 +1,279 @@
+/*
+* Copyright the original author or authors.
+*
+* Licensed 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.citrusframework.openapi.generator.rest.extpetstore.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.citrusframework.openapi.generator.rest.extpetstore.model.Category;
+import org.citrusframework.openapi.generator.rest.extpetstore.model.Tag;
+
+/**
+ * Pet
+ */
+@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.CitrusJavaCodegen", date = "2024-10-05T19:07:46.194751400+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
+public class Pet {
+ private Long id;
+
+ private String _name;
+
+ private Category category;
+
+ private List photoUrls = new ArrayList<>();
+
+ private List tags = new ArrayList<>();
+
+ /**
+ * pet status in the store
+ */
+ public enum StatusEnum {
+ AVAILABLE("available"),
+
+ PENDING("pending"),
+
+ SOLD("sold");
+
+ private String value;
+
+ StatusEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ public static StatusEnum fromValue(String value) {
+ for (StatusEnum b : StatusEnum.values()) {
+ if (b.value.equals(value)) {
+ return b;
+ }
+ }
+ throw new IllegalArgumentException("Unexpected value '" + value + "'");
+ }
+ }
+
+ private StatusEnum status;
+
+ public Pet() {
+ }
+
+ public Pet id(Long id) {
+
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get id
+ * @return id
+ **/
+ @jakarta.annotation.Nullable
+
+ public Long getId() {
+ return id;
+ }
+
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+
+ public Pet _name(String _name) {
+
+ this._name = _name;
+ return this;
+ }
+
+ /**
+ * Get _name
+ * @return _name
+ **/
+ @jakarta.annotation.Nonnull
+
+ public String getName() {
+ return _name;
+ }
+
+
+ public void setName(String _name) {
+ this._name = _name;
+ }
+
+
+ public Pet category(Category category) {
+
+ this.category = category;
+ return this;
+ }
+
+ /**
+ * Get category
+ * @return category
+ **/
+ @jakarta.annotation.Nullable
+
+ public Category getCategory() {
+ return category;
+ }
+
+
+ public void setCategory(Category category) {
+ this.category = category;
+ }
+
+
+ public Pet photoUrls(List photoUrls) {
+
+ this.photoUrls = photoUrls;
+ return this;
+ }
+
+ public Pet addPhotoUrlsItem(String photoUrlsItem) {
+ if (this.photoUrls == null) {
+ this.photoUrls = new ArrayList<>();
+ }
+ this.photoUrls.add(photoUrlsItem);
+ return this;
+ }
+
+ /**
+ * Get photoUrls
+ * @return photoUrls
+ **/
+ @jakarta.annotation.Nonnull
+
+ public List getPhotoUrls() {
+ return photoUrls;
+ }
+
+
+ public void setPhotoUrls(List photoUrls) {
+ this.photoUrls = photoUrls;
+ }
+
+
+ public Pet tags(List tags) {
+
+ this.tags = tags;
+ return this;
+ }
+
+ public Pet addTagsItem(Tag tagsItem) {
+ if (this.tags == null) {
+ this.tags = new ArrayList<>();
+ }
+ this.tags.add(tagsItem);
+ return this;
+ }
+
+ /**
+ * Get tags
+ * @return tags
+ **/
+ @jakarta.annotation.Nullable
+
+ public List getTags() {
+ return tags;
+ }
+
+
+ public void setTags(List tags) {
+ this.tags = tags;
+ }
+
+
+ public Pet status(StatusEnum status) {
+
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * pet status in the store
+ * @return status
+ **/
+ @jakarta.annotation.Nullable
+
+ public StatusEnum getStatus() {
+ return status;
+ }
+
+
+ public void setStatus(StatusEnum status) {
+ this.status = status;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Pet pet = (Pet) o;
+ return Objects.equals(this.id, pet.id) &&
+ Objects.equals(this._name, pet._name) &&
+ Objects.equals(this.category, pet.category) &&
+ Objects.equals(this.photoUrls, pet.photoUrls) &&
+ Objects.equals(this.tags, pet.tags) &&
+ Objects.equals(this.status, pet.status);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, _name, category, photoUrls, tags, status);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Pet {\n");
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" _name: ").append(toIndentedString(_name)).append("\n");
+ sb.append(" category: ").append(toIndentedString(category)).append("\n");
+ sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
+ sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Tag.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Tag.java
new file mode 100644
index 0000000000..59471e20ad
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/Tag.java
@@ -0,0 +1,119 @@
+/*
+* Copyright the original author or authors.
+*
+* Licensed 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.citrusframework.openapi.generator.rest.extpetstore.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Tag
+ */
+@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.CitrusJavaCodegen", date = "2024-10-05T19:07:46.194751400+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
+public class Tag {
+ private Long id;
+
+ private String _name;
+
+ public Tag() {
+ }
+
+ public Tag id(Long id) {
+
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get id
+ * @return id
+ **/
+ @jakarta.annotation.Nullable
+
+ public Long getId() {
+ return id;
+ }
+
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+
+ public Tag _name(String _name) {
+
+ this._name = _name;
+ return this;
+ }
+
+ /**
+ * Get _name
+ * @return _name
+ **/
+ @jakarta.annotation.Nullable
+
+ public String getName() {
+ return _name;
+ }
+
+
+ public void setName(String _name) {
+ this._name = _name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Tag tag = (Tag) o;
+ return Objects.equals(this.id, tag.id) &&
+ Objects.equals(this._name, tag._name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, _name);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Tag {\n");
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" _name: ").append(toIndentedString(_name)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/VaccinationDocumentResult.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/VaccinationDocumentResult.java
new file mode 100644
index 0000000000..5713e91f12
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/model/VaccinationDocumentResult.java
@@ -0,0 +1,93 @@
+/*
+* Copyright the original author or authors.
+*
+* Licensed 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.citrusframework.openapi.generator.rest.extpetstore.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * VaccinationDocumentResult
+ */
+@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.CitrusJavaCodegen", date = "2024-10-05T19:07:46.194751400+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
+public class VaccinationDocumentResult {
+ private String documentId;
+
+ public VaccinationDocumentResult() {
+ }
+
+ public VaccinationDocumentResult documentId(String documentId) {
+
+ this.documentId = documentId;
+ return this;
+ }
+
+ /**
+ * The unique ID of the uploaded vaccination document.
+ * @return documentId
+ **/
+ @jakarta.annotation.Nullable
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+
+ public void setDocumentId(String documentId) {
+ this.documentId = documentId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ VaccinationDocumentResult vaccinationDocumentResult = (VaccinationDocumentResult) o;
+ return Objects.equals(this.documentId, vaccinationDocumentResult.documentId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(documentId);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class VaccinationDocumentResult {\n");
+ sb.append(" documentId: ").append(toIndentedString(documentId)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/request/ExtPetApi.java b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/request/ExtPetApi.java
new file mode 100644
index 0000000000..e8fcfb646e
--- /dev/null
+++ b/test-api-generator/citrus-test-api-generator-core/src/test/resources/org/citrusframework/openapi/generator/ExpectedCodeGenIT/expectedgen/rest/extpetstore/request/ExtPetApi.java
@@ -0,0 +1,4081 @@
+package org.citrusframework.openapi.generator.rest.extpetstore.request;
+
+import static java.lang.String.format;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptyMap;
+import static org.citrusframework.util.StringUtils.isEmpty;
+import static org.citrusframework.util.StringUtils.isNotEmpty;
+
+import jakarta.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.time.LocalDate;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import org.citrusframework.actions.ReceiveMessageAction;
+import org.citrusframework.actions.SendMessageAction;
+import org.citrusframework.endpoint.Endpoint;
+import org.citrusframework.openapi.OpenApiSpecification;
+import org.citrusframework.openapi.testapi.ApiActionBuilderCustomizer;
+import org.citrusframework.openapi.testapi.ParameterStyle;
+import org.citrusframework.openapi.testapi.RestApiSendMessageActionBuilder;
+import org.citrusframework.openapi.testapi.RestApiReceiveMessageActionBuilder;
+import org.citrusframework.openapi.testapi.TestApiUtils;
+import org.citrusframework.spi.Resource;
+import org.citrusframework.openapi.testapi.GeneratedApi;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+
+import org.citrusframework.openapi.generator.rest.extpetstore.ExtPetStore;
+import org.citrusframework.openapi.generator.rest.extpetstore.model.*;
+
+@SuppressWarnings("unused")
+@jakarta.annotation.Generated(value = "org.citrusframework.openapi.generator.CitrusJavaCodegen", date = "2024-10-05T19:07:46.194751400+02:00[Europe/Zurich]", comments = "Generator version: 7.5.0")
+public class ExtPetApi implements GeneratedApi
+{
+
+ @Value("${" + "extpetstore.base64-encode-api-key:#{false}}")
+ private boolean base64EncodeApiKey;
+
+ @Value("${" + "extpetstore.basic.username:#{null}}")
+ private String basicUsername;
+
+ @Value("${" + "extpetstore.basic.password:#{null}}")
+ private String basicPassword;
+
+ @Value("${" + "extpetstore.bearer.token:#{null}}")
+ private String basicAuthBearer;
+
+ @Value("${" + "extpetstore.api-key-header:#{null}}")
+ private String defaultApiKeyHeader;
+
+ @Value("${" + "extpetstore.api-key-cookie:#{null}}")
+ private String defaultApiKeyCookie;
+
+ @Value("${" + "extpetstore.api-key-query:#{null}}")
+ private String defaultApiKeyQuery;
+
+ private final List customizers;
+
+ private final Endpoint endpoint;
+
+ private final OpenApiSpecification openApiSpecification;
+
+ public ExtPetApi(Endpoint endpoint) {
+ this(endpoint, emptyList());
+ }
+
+ public ExtPetApi(Endpoint endpoint, List customizers) {
+ this.endpoint = endpoint;
+ this.customizers = customizers;
+
+ URL resource = ExtPetStore.class.getResource("ExtPetStore_openApi.yaml");
+ if (resource == null) {
+ throw new IllegalStateException(format("Cannot find resource '%s'. This resource is typically created during API generation and should therefore be present. Check API generation.", "ExtPetStore_openApi.yaml"));
+ }
+ openApiSpecification = OpenApiSpecification.from(resource);
+ }
+
+ public static ExtPetApi extPetApi(Endpoint endpoint) {
+ return new ExtPetApi(endpoint);
+ }
+
+ @Override
+ public String getApiTitle() {
+ return "Extended Petstore API";
+ }
+
+ @Override
+ public String getApiVersion() {
+ return "1.0.0";
+ }
+
+ @Override
+ public String getApiPrefix() {
+ return "ExtPetStore";
+ }
+
+ @Override
+ public Map getApiInfoExtensions() {
+ return emptyMap();
+ }
+
+ @Override
+ public Endpoint getEndpoint() {
+ return endpoint;
+ }
+
+ @Override
+ public List getCustomizers() {
+ return customizers;
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GenerateVaccinationReportSendActionBuilder sendGenerateVaccinationReport(Resource template, Integer reqIntVal) {
+ return new GenerateVaccinationReportSendActionBuilder(this, openApiSpecification, template, reqIntVal);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GenerateVaccinationReportSendActionBuilder sendGenerateVaccinationReport$(String templateExpression, String reqIntValExpression ) {
+ return new GenerateVaccinationReportSendActionBuilder(openApiSpecification, this, templateExpression, reqIntValExpression);
+ }
+
+ public GenerateVaccinationReportReceiveActionBuilder receiveGenerateVaccinationReport(@NotNull HttpStatus statusCode) {
+ return new GenerateVaccinationReportReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GenerateVaccinationReportReceiveActionBuilder receiveGenerateVaccinationReport(@NotNull String statusCode) {
+ return new GenerateVaccinationReportReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetByIdWithApiKeyAuthenticationSendActionBuilder sendGetPetByIdWithApiKeyAuthentication(Long petId, Boolean allDetails) {
+ GetPetByIdWithApiKeyAuthenticationSendActionBuilder builder = new GetPetByIdWithApiKeyAuthenticationSendActionBuilder(this, openApiSpecification, petId, allDetails);
+ builder.setBase64EncodeApiKey(base64EncodeApiKey);
+ return builder;
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetByIdWithApiKeyAuthenticationSendActionBuilder sendGetPetByIdWithApiKeyAuthentication$(String petIdExpression, String allDetailsExpression ) {
+ GetPetByIdWithApiKeyAuthenticationSendActionBuilder builder = new GetPetByIdWithApiKeyAuthenticationSendActionBuilder(openApiSpecification, this, petIdExpression, allDetailsExpression);
+ builder.setBase64EncodeApiKey(base64EncodeApiKey);
+ builder.setApiKeyQuery(defaultApiKeyQuery);
+ builder.setApiKeyHeader(defaultApiKeyHeader);
+ builder.setApiKeyCookie(defaultApiKeyCookie);
+ return builder;
+ }
+
+ public GetPetByIdWithApiKeyAuthenticationReceiveActionBuilder receiveGetPetByIdWithApiKeyAuthentication(@NotNull HttpStatus statusCode) {
+ return new GetPetByIdWithApiKeyAuthenticationReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetByIdWithApiKeyAuthenticationReceiveActionBuilder receiveGetPetByIdWithApiKeyAuthentication(@NotNull String statusCode) {
+ return new GetPetByIdWithApiKeyAuthenticationReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetByIdWithBasicAuthenticationSendActionBuilder sendGetPetByIdWithBasicAuthentication(Long petId, Boolean allDetails) {
+ GetPetByIdWithBasicAuthenticationSendActionBuilder builder = new GetPetByIdWithBasicAuthenticationSendActionBuilder(this, openApiSpecification, petId, allDetails);
+ return builder;
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetByIdWithBasicAuthenticationSendActionBuilder sendGetPetByIdWithBasicAuthentication$(String petIdExpression, String allDetailsExpression ) {
+ GetPetByIdWithBasicAuthenticationSendActionBuilder builder = new GetPetByIdWithBasicAuthenticationSendActionBuilder(openApiSpecification, this, petIdExpression, allDetailsExpression);
+ builder.setBasicAuthUsername(basicUsername);
+ builder.setBasicAuthPassword(basicPassword);
+ return builder;
+ }
+
+ public GetPetByIdWithBasicAuthenticationReceiveActionBuilder receiveGetPetByIdWithBasicAuthentication(@NotNull HttpStatus statusCode) {
+ return new GetPetByIdWithBasicAuthenticationReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetByIdWithBasicAuthenticationReceiveActionBuilder receiveGetPetByIdWithBasicAuthentication(@NotNull String statusCode) {
+ return new GetPetByIdWithBasicAuthenticationReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetByIdWithBearerAuthenticationSendActionBuilder sendGetPetByIdWithBearerAuthentication(Long petId, Boolean allDetails) {
+ GetPetByIdWithBearerAuthenticationSendActionBuilder builder = new GetPetByIdWithBearerAuthenticationSendActionBuilder(this, openApiSpecification, petId, allDetails);
+ return builder;
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetByIdWithBearerAuthenticationSendActionBuilder sendGetPetByIdWithBearerAuthentication$(String petIdExpression, String allDetailsExpression ) {
+ GetPetByIdWithBearerAuthenticationSendActionBuilder builder = new GetPetByIdWithBearerAuthenticationSendActionBuilder(openApiSpecification, this, petIdExpression, allDetailsExpression);
+ builder.setBasicAuthBearer(basicAuthBearer);
+ return builder;
+ }
+
+ public GetPetByIdWithBearerAuthenticationReceiveActionBuilder receiveGetPetByIdWithBearerAuthentication(@NotNull HttpStatus statusCode) {
+ return new GetPetByIdWithBearerAuthenticationReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetByIdWithBearerAuthenticationReceiveActionBuilder receiveGetPetByIdWithBearerAuthentication(@NotNull String statusCode) {
+ return new GetPetByIdWithBearerAuthenticationReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithCookieSendActionBuilder sendGetPetWithCookie(Long petId, String sessionId) {
+ return new GetPetWithCookieSendActionBuilder(this, openApiSpecification, petId, sessionId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithCookieSendActionBuilder sendGetPetWithCookie$(String petIdExpression, String sessionIdExpression ) {
+ return new GetPetWithCookieSendActionBuilder(openApiSpecification, this, petIdExpression, sessionIdExpression);
+ }
+
+ public GetPetWithCookieReceiveActionBuilder receiveGetPetWithCookie(@NotNull HttpStatus statusCode) {
+ return new GetPetWithCookieReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithCookieReceiveActionBuilder receiveGetPetWithCookie(@NotNull String statusCode) {
+ return new GetPetWithCookieReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithDeepObjectTypeQuerySendActionBuilder sendGetPetWithDeepObjectTypeQuery(PetIdentifier petId) {
+ return new GetPetWithDeepObjectTypeQuerySendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithDeepObjectTypeQuerySendActionBuilder sendGetPetWithDeepObjectTypeQuery$(String petIdExpression ) {
+ return new GetPetWithDeepObjectTypeQuerySendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithDeepObjectTypeQueryReceiveActionBuilder receiveGetPetWithDeepObjectTypeQuery(@NotNull HttpStatus statusCode) {
+ return new GetPetWithDeepObjectTypeQueryReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithDeepObjectTypeQueryReceiveActionBuilder receiveGetPetWithDeepObjectTypeQuery(@NotNull String statusCode) {
+ return new GetPetWithDeepObjectTypeQueryReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormExplodedStyleCookieSendActionBuilder sendGetPetWithFormExplodedStyleCookie(List petId) {
+ return new GetPetWithFormExplodedStyleCookieSendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormExplodedStyleCookieSendActionBuilder sendGetPetWithFormExplodedStyleCookie$(List petIdExpression ) {
+ return new GetPetWithFormExplodedStyleCookieSendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormExplodedStyleCookieReceiveActionBuilder receiveGetPetWithFormExplodedStyleCookie(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormExplodedStyleCookieReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormExplodedStyleCookieReceiveActionBuilder receiveGetPetWithFormExplodedStyleCookie(@NotNull String statusCode) {
+ return new GetPetWithFormExplodedStyleCookieReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormObjectStyleCookieSendActionBuilder sendGetPetWithFormObjectStyleCookie(PetIdentifier petId) {
+ return new GetPetWithFormObjectStyleCookieSendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormObjectStyleCookieSendActionBuilder sendGetPetWithFormObjectStyleCookie$(String petIdExpression ) {
+ return new GetPetWithFormObjectStyleCookieSendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormObjectStyleCookieReceiveActionBuilder receiveGetPetWithFormObjectStyleCookie(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormObjectStyleCookieReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormObjectStyleCookieReceiveActionBuilder receiveGetPetWithFormObjectStyleCookie(@NotNull String statusCode) {
+ return new GetPetWithFormObjectStyleCookieReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormStyleCookieSendActionBuilder sendGetPetWithFormStyleCookie(List petId) {
+ return new GetPetWithFormStyleCookieSendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormStyleCookieSendActionBuilder sendGetPetWithFormStyleCookie$(List petIdExpression ) {
+ return new GetPetWithFormStyleCookieSendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormStyleCookieReceiveActionBuilder receiveGetPetWithFormStyleCookie(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormStyleCookieReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormStyleCookieReceiveActionBuilder receiveGetPetWithFormStyleCookie(@NotNull String statusCode) {
+ return new GetPetWithFormStyleCookieReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormStyleExplodedObjectQuerySendActionBuilder sendGetPetWithFormStyleExplodedObjectQuery(PetIdentifier petId) {
+ return new GetPetWithFormStyleExplodedObjectQuerySendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormStyleExplodedObjectQuerySendActionBuilder sendGetPetWithFormStyleExplodedObjectQuery$(String petIdExpression ) {
+ return new GetPetWithFormStyleExplodedObjectQuerySendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormStyleExplodedObjectQueryReceiveActionBuilder receiveGetPetWithFormStyleExplodedObjectQuery(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormStyleExplodedObjectQueryReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormStyleExplodedObjectQueryReceiveActionBuilder receiveGetPetWithFormStyleExplodedObjectQuery(@NotNull String statusCode) {
+ return new GetPetWithFormStyleExplodedObjectQueryReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormStyleExplodedQuerySendActionBuilder sendGetPetWithFormStyleExplodedQuery(List petId) {
+ return new GetPetWithFormStyleExplodedQuerySendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormStyleExplodedQuerySendActionBuilder sendGetPetWithFormStyleExplodedQuery$(List petIdExpression ) {
+ return new GetPetWithFormStyleExplodedQuerySendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormStyleExplodedQueryReceiveActionBuilder receiveGetPetWithFormStyleExplodedQuery(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormStyleExplodedQueryReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormStyleExplodedQueryReceiveActionBuilder receiveGetPetWithFormStyleExplodedQuery(@NotNull String statusCode) {
+ return new GetPetWithFormStyleExplodedQueryReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormStyleObjectQuerySendActionBuilder sendGetPetWithFormStyleObjectQuery(PetIdentifier petId) {
+ return new GetPetWithFormStyleObjectQuerySendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormStyleObjectQuerySendActionBuilder sendGetPetWithFormStyleObjectQuery$(String petIdExpression ) {
+ return new GetPetWithFormStyleObjectQuerySendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormStyleObjectQueryReceiveActionBuilder receiveGetPetWithFormStyleObjectQuery(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormStyleObjectQueryReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormStyleObjectQueryReceiveActionBuilder receiveGetPetWithFormStyleObjectQuery(@NotNull String statusCode) {
+ return new GetPetWithFormStyleObjectQueryReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithFormStyleQuerySendActionBuilder sendGetPetWithFormStyleQuery(List petId) {
+ return new GetPetWithFormStyleQuerySendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithFormStyleQuerySendActionBuilder sendGetPetWithFormStyleQuery$(List petIdExpression ) {
+ return new GetPetWithFormStyleQuerySendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithFormStyleQueryReceiveActionBuilder receiveGetPetWithFormStyleQuery(@NotNull HttpStatus statusCode) {
+ return new GetPetWithFormStyleQueryReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithFormStyleQueryReceiveActionBuilder receiveGetPetWithFormStyleQuery(@NotNull String statusCode) {
+ return new GetPetWithFormStyleQueryReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithLabelStyleArraySendActionBuilder sendGetPetWithLabelStyleArray(List petId) {
+ return new GetPetWithLabelStyleArraySendActionBuilder(this, openApiSpecification, petId);
+ }
+
+ /**
+ * Builder with required parameters as string to allow for dynamic content.
+ */
+ public GetPetWithLabelStyleArraySendActionBuilder sendGetPetWithLabelStyleArray$(List petIdExpression ) {
+ return new GetPetWithLabelStyleArraySendActionBuilder(openApiSpecification, this, petIdExpression);
+ }
+
+ public GetPetWithLabelStyleArrayReceiveActionBuilder receiveGetPetWithLabelStyleArray(@NotNull HttpStatus statusCode) {
+ return new GetPetWithLabelStyleArrayReceiveActionBuilder(this, openApiSpecification, Integer.toString(statusCode.value()));
+ }
+
+ public GetPetWithLabelStyleArrayReceiveActionBuilder receiveGetPetWithLabelStyleArray(@NotNull String statusCode) {
+ return new GetPetWithLabelStyleArrayReceiveActionBuilder(this, openApiSpecification, statusCode);
+ }
+
+ /**
+ * Builder with type safe required parameters.
+ */
+ public GetPetWithLabelStyleArrayExplodedSendActionBuilder sendGetPetWithLabelStyleArrayExploded(List