Skip to content

Commit

Permalink
feat(citrusframework#1156): provide test api generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Schlathoelter committed May 15, 2024
1 parent e05ec95 commit ef64a21
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 458 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,44 @@

import java.util.Map;

/**
* Interface representing a generated API from an OpenAPI specification.
* Provides methods to retrieve metadata about the API such as title, version,
* prefix, and information extensions.
*/
public interface GeneratedApi {

/**
* @return the title of the open api
* Retrieves the title of the OpenAPI specification, as specified in the info section of the API.
*
* @return the title of the OpenAPI specification
*/
String getApiTitle();

/**
* @return the version of the open api
* Retrieves the version of the OpenAPI specification, as specified in the info section of the API.
*
* @return the version of the OpenAPI specification
*/
String getApiVersion();

/**
* @return the prefix used for the api
* Retrieves the prefix used for the API, as specified in the API generation configuration.
*
* @return the prefix used for the API
*/
String getApiPrefix();

/**
* @return the info extensions of the api
* Retrieves the specification extensions of the OpenAPI defined in the "info" section.
* <p>
* Specification extensions, also known as vendor extensions, are custom key-value pairs used to describe extra
* functionality not covered by the standard OpenAPI Specification. These properties start with "x-".
* This method collects only the extensions defined in the "info" section of the API.
* </p>
*
* @return a map containing the specification extensions defined in the "info" section of the API,
* where keys are extension names and values are extension values
*/
Map<String, String> getApiInfoExtensions();
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package org.citrusframework.testapi;

/**
* Interface representing a generated API request corresponding to an operation in an OpenAPI specification.
* Provides methods to retrieve metadata about the request such as operation name, HTTP method, and path.
*/
public interface GeneratedApiRequest {

/**
* @return the name of the open api operation
* Retrieves the name of the OpenAPI operation associated with the request.
*
* @return the name of the OpenAPI operation
*/
String getOperationName();

/**
* @return the http method used for the request
* Retrieves the HTTP method used for the request.
*
* @return the HTTP method used for the request (e.g., GET, POST)
*/
String getMethod();

/**
* Retrieves the path used for the request.
*
* @return the path used for the request
*/
String getPath();
Expand Down
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<maven.nexus-staging.plugin.version>1.6.13</maven.nexus-staging.plugin.version>
<maven.plugin.plugin.version>3.9.0</maven.plugin.plugin.version>
<maven.plugin.annotations.version>3.12.0</maven.plugin.annotations.version>
<maven.plugin.testing.harness.version>3.3.0</maven.plugin.testing.harness.version>
<maven.release.plugin.version>3.0.1</maven.release.plugin.version>
<maven.resource.plugin.version>3.3.1</maven.resource.plugin.version>
<maven.scm.plugin.version>1.11.2</maven.scm.plugin.version>
Expand Down Expand Up @@ -247,12 +248,14 @@
<mockftpserver.version>3.1.0</mockftpserver.version>
<netty.version>4.1.105.Final</netty.version>
<okhttp.version>4.12.0</okhttp.version>
<openapi-generator-maven-plugin>7.5.0</openapi-generator-maven-plugin>
<picoli-version>4.7.5</picoli-version>
<saaj.version>3.0.3</saaj.version>
<selenium.version>4.19.1</selenium.version>
<slf4j.version>2.0.11</slf4j.version>
<snappy.version>1.1.10.5</snappy.version>
<snakeyaml.version>2.2</snakeyaml.version>
<spring.boot.test.version>3.2.5</spring.boot.test.version>
<spring.version>6.1.6</spring.version>
<spring.ws.version>4.0.10</spring.ws.version>
<spring.integration.version>6.2.4</spring.integration.version>
Expand Down Expand Up @@ -512,6 +515,13 @@
<version>${wsdl4j.version}</version>
</dependency>

<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator</artifactId>
<version>${openapi-generator-maven-plugin}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down Expand Up @@ -860,6 +870,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
Expand Down
Loading

0 comments on commit ef64a21

Please sign in to comment.