Compare commits

..

5 Commits

Author SHA1 Message Date
William Cheng
b798dc0cb4 Merge branch 'master' of https://github.com/WannabeSoftwareEngineer/openapi-generator into WannabeSoftwareEngineer-master 2025-09-25 16:43:16 +08:00
William Cheng
258d971f42 kotlin client: add docstring to new function (#22025)
* kotlin client: add docstring

* fix
2025-09-25 15:09:47 +08:00
daberni
5e8dcc9f07 [kotlin] Fix defaultValue in query parameters (#22002) 2025-09-25 15:02:15 +08:00
William Cheng
67b24330c9 Add tests for jaxrs cxf swagger2 client (#22019)
* add test for jaxrs cxf swagger2 client

* revert
2025-09-24 17:15:08 +08:00
WannabeSoftwareEngineer
f371a91d15 FIX #21407 - use referenced string enum schema in requestBody if available 2025-06-13 12:47:26 +02:00
58 changed files with 2483 additions and 197 deletions

View File

@@ -5,6 +5,7 @@ on:
paths:
- 'samples/client/petstore/java/**'
- samples/client/petstore/jaxrs-cxf-client/**
- samples/client/petstore/jaxrs-cxf-client-swagger2/**
- samples/client/petstore/java-micronaut-client/**
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
@@ -27,6 +28,7 @@ on:
paths:
- 'samples/client/petstore/java/**'
- samples/client/petstore/jaxrs-cxf-client/**
- samples/client/petstore/jaxrs-cxf-client-swagger2/**
- samples/client/petstore/java-micronaut-client/**
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
@@ -54,6 +56,7 @@ jobs:
matrix:
sample:
# clients
- samples/client/petstore/jaxrs-cxf-client-swagger2
- samples/client/petstore/jaxrs-cxf-client
- samples/client/petstore/java/native
- samples/client/petstore/java/native-async

View File

@@ -1,43 +0,0 @@
name: Samples Ruby
on:
push:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
pull_request:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
jobs:
build:
name: Build Ruby
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/ruby-httpx/'
- 'samples/client/echo_api/ruby-faraday/'
- 'samples/client/echo_api/ruby-typhoeus/'
steps:
- uses: actions/checkout@v5
- name: Setup node.js
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install
- name: Run rspec
working-directory: ${{ matrix.sample }}
run: rspec

View File

@@ -1,18 +1,16 @@
name: Samples Ruby
name: Samples Ruby
on:
push:
paths:
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
pull_request:
paths:
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
jobs:
build:
@@ -22,28 +20,21 @@ jobs:
fail-fast: false
matrix:
sample:
- samples/client/petstore/ruby/
#- samples/client/petstore/ruby-faraday/
#- samples/client/petstore/ruby-httpx/
#- samples/client/petstore/ruby-autoload/
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
- 'samples/client/echo_api/ruby-httpx/'
- 'samples/client/echo_api/ruby-faraday/'
- 'samples/client/echo_api/ruby-typhoeus/'
steps:
- uses: actions/checkout@v5
#- name: Add hosts to /etc/hosts
# run: |
# sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
# cat /etc/hosts
- uses: ruby/setup-ruby@v1
- name: Setup node.js
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- uses: actions/setup-ruby@v1
with:
ruby-version: '3.4' # Not needed with a .ruby-version, .tool-versions or mise.toml
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
ruby-version: 3.0
bundler-cache: true
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install

View File

@@ -0,0 +1,8 @@
generatorName: jaxrs-cxf-client
outputDir: samples/client/petstore/jaxrs-cxf-client-swagger2
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/cxf
additionalProperties:
artifactId: jaxrs-cxf-petstore-swagger2
documentationProvider: swagger2
annotationLibrary: swagger2

View File

@@ -7805,8 +7805,13 @@ public class DefaultCodegen implements CodegenConfig {
}
}
protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, Set<String> imports, String bodyParameterName) {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, String name, Set<String> imports, String bodyParameterName) {
if (!StringUtils.isEmpty(name)) {
addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false);
} else {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
}
if (ModelUtils.isByteArraySchema(schema)) {
codegenParameter.setIsString(false);
codegenParameter.isByteArray = true;
@@ -8007,7 +8012,7 @@ public class DefaultCodegen implements CodegenConfig {
// swagger v2 only, type file
codegenParameter.isFile = true;
} else if (ModelUtils.isStringSchema(schema)) {
updateRequestBodyForString(codegenParameter, schema, imports, bodyParameterName);
updateRequestBodyForString(codegenParameter, schema, name, imports, bodyParameterName);
} else if (ModelUtils.isNumberSchema(schema)) {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
codegenParameter.isNumeric = Boolean.TRUE;

View File

@@ -996,6 +996,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
}
return objs;
}
private Stream<List<CodegenProperty>> getAllVarProperties(CodegenModel model) {
return Stream.of(model.vars, model.allVars, model.optionalVars, model.requiredVars, model.readOnlyVars, model.readWriteVars);
}
@@ -1113,6 +1114,27 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
return false;
}
@Override
public void postProcessParameter(CodegenParameter parameter) {
super.postProcessParameter(parameter);
adjustEnumRefDefault(parameter);
}
/**
* Properly set the default value for enum (reference).
*
* @param param codegen parameter
*/
private void adjustEnumRefDefault(CodegenParameter param) {
if (StringUtils.isEmpty(param.defaultValue) || !(param.isEnum || param.isEnumRef)) {
return;
}
String type = StringUtils.defaultIfEmpty(param.datatypeWithEnum, param.dataType);
param.enumDefaultValue = toEnumVarName(param.defaultValue, type);
param.defaultValue = type + "." + param.enumDefaultValue;
}
@Override
public void postProcess() {
System.out.println("################################################################################");

View File

@@ -8,7 +8,9 @@ import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
import {{javaxPackage}}.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ClientConfiguration;

View File

@@ -48,6 +48,7 @@ import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.SemVer;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
@@ -5044,4 +5045,40 @@ public class DefaultCodegenTest {
if (props == null) return null;
return props.stream().map(v -> v.name).collect(Collectors.toList());
}
}
@Test
public void testRequestBodyWithStringEnumSchema() {
// Given
OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_21407.yaml");
DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
String path = "/v1/resource-class/send-using-schema";
// When
CodegenOperation codegenOperation = codegen.fromOperation(path, "POST", openAPI.getPaths().get(path).getPost(), null);
// Then
assertThat(codegenOperation.bodyParam).satisfies(bodyParam -> {
assertThat(bodyParam).isNotNull();
assertThat(bodyParam.getDataType()).isEqualTo("Letter");
});
}
@Test
public void testRequestBodyWithStringSchema() {
// Given
OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_21407.yaml");
DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
String path = "/v1/resource-class/send-using-string";
// When
CodegenOperation codegenOperation = codegen.fromOperation(path, "POST", openAPI.getPaths().get(path).getPost(), null);
// Then
assertThat(codegenOperation.bodyParam).satisfies(bodyParam -> {
assertThat(bodyParam).isNotNull();
assertThat(bodyParam.getDataType()).isEqualTo("String");
});
}
}

View File

@@ -91,6 +91,24 @@ public class KotlinClientCodegenApiTest {
assertFileContainsLine(lines, "suspend fun deletePet(@Path(\"petId\") petId: kotlin.Long, @Header(\"api_key\") apiKey: kotlin.String? = null)" + expectedUnitResponse);
}
@Test
public void testEnumDefaultForReferencedSchemaParameterJvmOkhttp4() throws IOException {
OpenAPI openAPI = readOpenAPI("3_0/kotlin/enum-default-query.yaml");
KotlinClientCodegen codegen = createCodegen(ClientLibrary.JVM_OKHTTP4);
codegen.additionalProperties().put("enumPropertyNaming", "UPPERCASE");
ClientOptInput input = createClientOptInput(openAPI, codegen);
DefaultGenerator generator = new DefaultGenerator();
enableOnlyApiGeneration(generator);
List<File> files = generator.opts(input).generate();
File statusApi = files.stream().filter(file -> file.getName().equals("StatusApi.kt")).findAny().orElseThrow();
assertFileContains(statusApi.toPath(), "state: PetStatus? = PetStatus.AVAILABLE");
}
private static void assertFileContainsLine(List<String> lines, String line) {
Assert.assertListContains(lines, s -> s.equals(line), line);
}

View File

@@ -0,0 +1,48 @@
openapi: 3.0.1
info:
title: sample spec
description: "Sample spec"
version: 0.0.1
tags:
- name: ResourceClass
paths:
/v1/resource-class/send-using-schema:
post:
tags:
- ResourceClass
description: Add @Operation annotation to provide a description
operationId: send-using-schema
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Letter"
responses:
"200":
description: OK - the request has succeeded.
content:
application/json:
schema:
$ref: "#/components/schemas/Letter"
/v1/resource-class/send-using-string:
post:
tags:
- ResourceClass
description: Add @Operation annotation to provide a description
operationId: send-using-string
requestBody:
content:
application/json:
schema:
type: string
responses:
"204":
description: "No Content - the request has been successfully processed,\
\ but there is no additional content."
components:
schemas:
Letter:
type: string
enum:
- A
- B

View File

@@ -0,0 +1,26 @@
openapi: 3.0.1
info:
title: Enum default test
version: 1.0.0
paths:
/status:
get:
tags:
- Status
operationId: getStatus
parameters:
- name: state
in: query
schema:
$ref: '#/components/schemas/PetStatus'
responses:
'200':
description: OK
components:
schemas:
PetStatus:
type: string
enum:
- available
- pending
default: available

View File

@@ -31,7 +31,6 @@ paths:
$ref: '#/components/schemas/Foo'
/pet:
servers:
- url: 'http://127.0.0.1/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
@@ -189,7 +188,6 @@ paths:
deprecated: true
'/pet/{petId}':
servers:
- url: 'http://127.0.0.1/v2'
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
@@ -1360,8 +1358,6 @@ paths:
200:
description: OK
servers:
- url: https://127.0.0.1/v2
description: The local server without variables
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
variables:
@@ -1384,6 +1380,8 @@ servers:
- 'v1'
- 'v2'
default: 'v2'
- url: https://127.0.0.1/no_varaible
description: The local server without variables
- url: http://server.{version}.openapi-generator.tech
description: The openapi-generator test server
variables:

View File

@@ -52,13 +52,13 @@ try {
| **pathDefault** | **kotlin.String**| path default | |
| **pathNullable** | **kotlin.String**| path_nullable | |
| **queryDefault** | **kotlin.String**| query default | [optional] [default to &quot;available&quot;] |
| **queryDefaultEnum** | **kotlin.String**| query default enum | [optional] [default to B] [enum: A, B, C] |
| **queryDefaultEnum** | **kotlin.String**| query default enum | [optional] [default to QueryDefaultEnum.B] [enum: A, B, C] |
| **queryDefaultInt** | **java.math.BigDecimal**| query default int | [optional] [default to 3] |
| **headerDefault** | **kotlin.String**| header default | [optional] [default to &quot;available&quot;] |
| **headerDefaultEnum** | **kotlin.String**| header default enum | [optional] [default to B] [enum: A, B, C] |
| **headerDefaultEnum** | **kotlin.String**| header default enum | [optional] [default to HeaderDefaultEnum.B] [enum: A, B, C] |
| **headerDefaultInt** | **java.math.BigDecimal**| header default int | [optional] [default to 3] |
| **cookieDefault** | **kotlin.String**| cookie default | [optional] [default to &quot;available&quot;] |
| **cookieDefaultEnum** | **kotlin.String**| cookie default enum | [optional] [default to B] [enum: A, B, C] |
| **cookieDefaultEnum** | **kotlin.String**| cookie default enum | [optional] [default to CookieDefaultEnum.B] [enum: A, B, C] |
| **cookieDefaultInt** | **java.math.BigDecimal**| cookie default int | [optional] [default to 3] |
| **queryNullable** | **kotlin.String**| query nullable | [optional] |
| **headerNullable** | **kotlin.String**| header nullable | [optional] |

View File

@@ -105,13 +105,13 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory
* @param pathDefault path default
* @param pathNullable path_nullable
* @param queryDefault query default (optional, default to "available")
* @param queryDefaultEnum query default enum (optional, default to B)
* @param queryDefaultEnum query default enum (optional, default to QueryDefaultEnum.B)
* @param queryDefaultInt query default int (optional, default to 3)
* @param headerDefault header default (optional, default to "available")
* @param headerDefaultEnum header default enum (optional, default to B)
* @param headerDefaultEnum header default enum (optional, default to HeaderDefaultEnum.B)
* @param headerDefaultInt header default int (optional, default to 3)
* @param cookieDefault cookie default (optional, default to "available")
* @param cookieDefaultEnum cookie default enum (optional, default to B)
* @param cookieDefaultEnum cookie default enum (optional, default to CookieDefaultEnum.B)
* @param cookieDefaultInt cookie default int (optional, default to 3)
* @param queryNullable query nullable (optional)
* @param headerNullable header nullable (optional)
@@ -150,13 +150,13 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory
* @param pathDefault path default
* @param pathNullable path_nullable
* @param queryDefault query default (optional, default to "available")
* @param queryDefaultEnum query default enum (optional, default to B)
* @param queryDefaultEnum query default enum (optional, default to QueryDefaultEnum.B)
* @param queryDefaultInt query default int (optional, default to 3)
* @param headerDefault header default (optional, default to "available")
* @param headerDefaultEnum header default enum (optional, default to B)
* @param headerDefaultEnum header default enum (optional, default to HeaderDefaultEnum.B)
* @param headerDefaultInt header default int (optional, default to 3)
* @param cookieDefault cookie default (optional, default to "available")
* @param cookieDefaultEnum cookie default enum (optional, default to B)
* @param cookieDefaultEnum cookie default enum (optional, default to CookieDefaultEnum.B)
* @param cookieDefaultInt cookie default int (optional, default to 3)
* @param queryNullable query nullable (optional)
* @param headerNullable header nullable (optional)
@@ -181,13 +181,13 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory
* @param pathDefault path default
* @param pathNullable path_nullable
* @param queryDefault query default (optional, default to "available")
* @param queryDefaultEnum query default enum (optional, default to B)
* @param queryDefaultEnum query default enum (optional, default to QueryDefaultEnum.B)
* @param queryDefaultInt query default int (optional, default to 3)
* @param headerDefault header default (optional, default to "available")
* @param headerDefaultEnum header default enum (optional, default to B)
* @param headerDefaultEnum header default enum (optional, default to HeaderDefaultEnum.B)
* @param headerDefaultInt header default int (optional, default to 3)
* @param cookieDefault cookie default (optional, default to "available")
* @param cookieDefaultEnum cookie default enum (optional, default to B)
* @param cookieDefaultEnum cookie default enum (optional, default to CookieDefaultEnum.B)
* @param cookieDefaultInt cookie default int (optional, default to 3)
* @param queryNullable query nullable (optional)
* @param headerNullable header nullable (optional)

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,10 @@
pom.xml
src/gen/java/org/openapitools/api/PetApi.java
src/gen/java/org/openapitools/api/StoreApi.java
src/gen/java/org/openapitools/api/UserApi.java
src/gen/java/org/openapitools/model/Category.java
src/gen/java/org/openapitools/model/ModelApiResponse.java
src/gen/java/org/openapitools/model/Order.java
src/gen/java/org/openapitools/model/Pet.java
src/gen/java/org/openapitools/model/Tag.java
src/gen/java/org/openapitools/model/User.java

View File

@@ -0,0 +1 @@
7.16.0-SNAPSHOT

View File

@@ -0,0 +1,197 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>jaxrs-cxf-petstore-swagger2</artifactId>
<packaging>jar</packaging>
<name>jaxrs-cxf-petstore-swagger2</name>
<description>This is a sample server Petstore server. For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.</description>
<version>1.0.0</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!--plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
</webApp>
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
<stopPort>8079</stopPort>
<stopKey>stopit</stopKey>
<httpConnector>
<port></port>
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/gen/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson-jaxrs-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<!-- CXF Client -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<!-- CXF server -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId>
<version>${cxf-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
<version>${cxf-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-wsdl</artifactId>
<version>${cxf-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-jaxrs-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-jaxrs-version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.13</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-annotations-version>2.2.7</swagger-annotations-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<junit-version>4.13.2</junit-version>
<logback-version>1.5.13</logback-version>
<cxf-version>3.5.9</cxf-version>
<jackson-jaxrs-version>2.17.1</jackson-jaxrs-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@@ -0,0 +1,161 @@
package org.openapitools.api;
import java.io.File;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.Pet;
import java.util.List;
import java.util.Map;
import javax.ws.rs.*;
import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
/**
* OpenAPI Petstore
*
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/pet")
@OpenAPIDefinition(
info = @Info(
title = "OpenAPI Petstore",
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"
)
)
public interface PetApi {
/**
* Add a new pet to the store
*
*
*
*/
@POST
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "addPet", summary = "Add a new pet to the store", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))),
@ApiResponse(responseCode = "405", description = "Invalid input") })
public Pet addPet(Pet pet);
/**
* Deletes a pet
*
*
*
*/
@DELETE
@Path("/{petId}")
@Operation(operationId = "deletePet", summary = "Deletes a pet", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "400", description = "Invalid pet value") })
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
/**
* Finds Pets by status
*
* Multiple status values can be provided with comma separated strings
*
*/
@GET
@Path("/findByStatus")
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "findPetsByStatus", summary = "Finds Pets by status", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))),
@ApiResponse(responseCode = "400", description = "Invalid status value") })
public List<Pet> findPetsByStatus(@QueryParam("status") List<String> status);
/**
* Finds Pets by tags
*
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
*/
@GET
@Path("/findByTags")
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "findPetsByTags", summary = "Finds Pets by tags", deprecated = true, tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))),
@ApiResponse(responseCode = "400", description = "Invalid tag value") })
public List<Pet> findPetsByTags(@QueryParam("tags") List<String> tags);
/**
* Find pet by ID
*
* Returns a single pet
*
*/
@GET
@Path("/{petId}")
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "getPetById", summary = "Find pet by ID", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))),
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
@ApiResponse(responseCode = "404", description = "Pet not found") })
public Pet getPetById(@PathParam("petId") Long petId);
/**
* Update an existing pet
*
*
*
*/
@PUT
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "updatePet", summary = "Update an existing pet", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))),
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
@ApiResponse(responseCode = "404", description = "Pet not found"),
@ApiResponse(responseCode = "405", description = "Validation exception") })
public Pet updatePet(Pet pet);
/**
* Updates a pet in the store with form data
*
*
*
*/
@POST
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@Operation(operationId = "updatePetWithForm", summary = "Updates a pet in the store with form data", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "405", description = "Invalid input") })
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
/**
* uploads an image
*
*
*
*/
@POST
@Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@Operation(operationId = "uploadFile", summary = "uploads an image", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) })
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail);
}

View File

@@ -0,0 +1,97 @@
package org.openapitools.api;
import org.openapitools.model.Order;
import java.util.List;
import java.util.Map;
import javax.ws.rs.*;
import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
/**
* OpenAPI Petstore
*
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/store")
@OpenAPIDefinition(
info = @Info(
title = "OpenAPI Petstore",
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"
)
)
public interface StoreApi {
/**
* Delete purchase order by ID
*
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
*/
@DELETE
@Path("/order/{orderId}")
@Operation(operationId = "deleteOrder", summary = "Delete purchase order by ID", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
@ApiResponse(responseCode = "404", description = "Order not found") })
public void deleteOrder(@PathParam("orderId") String orderId);
/**
* Returns pet inventories by status
*
* Returns a map of status codes to quantities
*
*/
@GET
@Path("/inventory")
@Produces({ "application/json" })
@Operation(operationId = "getInventory", summary = "Returns pet inventories by status", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))) })
public Map<String, Integer> getInventory();
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
*
*/
@GET
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "getOrderById", summary = "Find purchase order by ID", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Order.class))),
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
@ApiResponse(responseCode = "404", description = "Order not found") })
public Order getOrderById(@PathParam("orderId") Long orderId);
/**
* Place an order for a pet
*
*
*
*/
@POST
@Path("/order")
@Consumes({ "application/json" })
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "placeOrder", summary = "Place an order for a pet", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Order.class))),
@ApiResponse(responseCode = "400", description = "Invalid Order") })
public Order placeOrder(Order order);
}

View File

@@ -0,0 +1,153 @@
package org.openapitools.api;
import java.util.Date;
import org.openapitools.model.User;
import java.util.List;
import java.util.Map;
import javax.ws.rs.*;
import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
/**
* OpenAPI Petstore
*
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/user")
@OpenAPIDefinition(
info = @Info(
title = "OpenAPI Petstore",
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"
)
)
public interface UserApi {
/**
* Create user
*
* This can only be done by the logged in user.
*
*/
@POST
@Consumes({ "application/json" })
@Operation(operationId = "createUser", summary = "Create user", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation") })
public void createUser(User user);
/**
* Creates list of users with given input array
*
*
*
*/
@POST
@Path("/createWithArray")
@Consumes({ "application/json" })
@Operation(operationId = "createUsersWithArrayInput", summary = "Creates list of users with given input array", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation") })
public void createUsersWithArrayInput(List<User> user);
/**
* Creates list of users with given input array
*
*
*
*/
@POST
@Path("/createWithList")
@Consumes({ "application/json" })
@Operation(operationId = "createUsersWithListInput", summary = "Creates list of users with given input array", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation") })
public void createUsersWithListInput(List<User> user);
/**
* Delete user
*
* This can only be done by the logged in user.
*
*/
@DELETE
@Path("/{username}")
@Operation(operationId = "deleteUser", summary = "Delete user", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "400", description = "Invalid username supplied"),
@ApiResponse(responseCode = "404", description = "User not found") })
public void deleteUser(@PathParam("username") String username);
/**
* Get user by user name
*
*
*
*/
@GET
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "getUserByName", summary = "Get user by user name", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = User.class))),
@ApiResponse(responseCode = "400", description = "Invalid username supplied"),
@ApiResponse(responseCode = "404", description = "User not found") })
public User getUserByName(@PathParam("username") String username);
/**
* Logs user into the system
*
*
*
*/
@GET
@Path("/login")
@Produces({ "application/xml", "application/json" })
@Operation(operationId = "loginUser", summary = "Logs user into the system", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "400", description = "Invalid username/password supplied") })
public String loginUser(@QueryParam("username") String username, @QueryParam("password") String password);
/**
* Logs out current logged in user session
*
*
*
*/
@GET
@Path("/logout")
@Operation(operationId = "logoutUser", summary = "Logs out current logged in user session", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation") })
public void logoutUser();
/**
* Updated user
*
* This can only be done by the logged in user.
*
*/
@PUT
@Path("/{username}")
@Consumes({ "application/json" })
@Operation(operationId = "updateUser", summary = "Updated user", tags={ })
@ApiResponses(value = {
@ApiResponse(responseCode = "400", description = "Invalid user supplied"),
@ApiResponse(responseCode = "404", description = "User not found") })
public void updateUser(@PathParam("username") String username, User user);
}

View File

@@ -0,0 +1,98 @@
package org.openapitools.model;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A category for a pet
*/
@Schema(description="A category for a pet")
public class Category {
@Schema(description = "")
private Long id;
@Schema(description = "")
private String name;
/**
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Category id(Long id) {
this.id = id;
return this;
}
/**
* Get name
* @return name
**/
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Category name(String name) {
this.name = name;
return this;
}
@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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,122 @@
package org.openapitools.model;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Describes the result of uploading an image resource
*/
@Schema(description="Describes the result of uploading an image resource")
public class ModelApiResponse {
@Schema(description = "")
private Integer code;
@Schema(description = "")
private String type;
@Schema(description = "")
private String message;
/**
* Get code
* @return code
**/
@JsonProperty("code")
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public ModelApiResponse code(Integer code) {
this.code = code;
return this;
}
/**
* Get type
* @return type
**/
@JsonProperty("type")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public ModelApiResponse type(String type) {
this.type = type;
return this;
}
/**
* Get message
* @return message
**/
@JsonProperty("message")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ModelApiResponse message(String message) {
this.message = message;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelApiResponse {\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,231 @@
package org.openapitools.model;
import java.util.Date;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* An order for a pets from the pet store
*/
@Schema(description="An order for a pets from the pet store")
public class Order {
@Schema(description = "")
private Long id;
@Schema(description = "")
private Long petId;
@Schema(description = "")
private Integer quantity;
@Schema(description = "")
private Date shipDate;
public enum StatusEnum {
PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered"));
private String value;
StatusEnum (String v) {
value = v;
}
public String value() {
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 + "'");
}
}
/**
* Order Status
*/
@Schema(description = "Order Status")
private StatusEnum status;
@Schema(description = "")
private Boolean complete = false;
/**
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Order id(Long id) {
this.id = id;
return this;
}
/**
* Get petId
* @return petId
**/
@JsonProperty("petId")
public Long getPetId() {
return petId;
}
public void setPetId(Long petId) {
this.petId = petId;
}
public Order petId(Long petId) {
this.petId = petId;
return this;
}
/**
* Get quantity
* @return quantity
**/
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
/**
* Get shipDate
* @return shipDate
**/
@JsonProperty("shipDate")
public Date getShipDate() {
return shipDate;
}
public void setShipDate(Date shipDate) {
this.shipDate = shipDate;
}
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
}
/**
* Order Status
* @return status
**/
@JsonProperty("status")
public String getStatus() {
if (status == null) {
return null;
}
return status.value();
}
public void setStatus(StatusEnum status) {
this.status = status;
}
public Order status(StatusEnum status) {
this.status = status;
return this;
}
/**
* Get complete
* @return complete
**/
@JsonProperty("complete")
public Boolean getComplete() {
return complete;
}
public void setComplete(Boolean complete) {
this.complete = complete;
}
public Order complete(Boolean complete) {
this.complete = complete;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" complete: ").append(toIndentedString(complete)).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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,245 @@
package org.openapitools.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.model.Category;
import org.openapitools.model.Tag;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A pet for sale in the pet store
*/
@Schema(description="A pet for sale in the pet store")
public class Pet {
@Schema(description = "")
private Long id;
@Schema(description = "")
private Category category;
@Schema(description = "", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> photoUrls = new ArrayList<>();
@Schema(description = "")
private List<Tag> tags = new ArrayList<>();
public enum StatusEnum {
AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold"));
private String value;
StatusEnum (String v) {
value = v;
}
public String value() {
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 + "'");
}
}
/**
* pet status in the store
*/
@Schema(description = "pet status in the store")
private StatusEnum status;
/**
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Pet id(Long id) {
this.id = id;
return this;
}
/**
* Get category
* @return category
**/
@JsonProperty("category")
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public Pet category(Category category) {
this.category = category;
return this;
}
/**
* Get name
* @return name
**/
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Pet name(String name) {
this.name = name;
return this;
}
/**
* Get photoUrls
* @return photoUrls
**/
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
public Pet addPhotoUrlsItem(String photoUrlsItem) {
this.photoUrls.add(photoUrlsItem);
return this;
}
/**
* Get tags
* @return tags
**/
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
}
public Pet addTagsItem(Tag tagsItem) {
this.tags.add(tagsItem);
return this;
}
/**
* pet status in the store
* @return status
**/
@JsonProperty("status")
public String getStatus() {
if (status == null) {
return null;
}
return status.value();
}
public void setStatus(StatusEnum status) {
this.status = status;
}
public Pet status(StatusEnum status) {
this.status = status;
return this;
}
@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.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
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, category, name, 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(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,98 @@
package org.openapitools.model;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A tag for a pet
*/
@Schema(description="A tag for a pet")
public class Tag {
@Schema(description = "")
private Long id;
@Schema(description = "")
private String name;
/**
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Tag id(Long id) {
this.id = id;
return this;
}
/**
* Get name
* @return name
**/
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Tag name(String name) {
this.name = name;
return this;
}
@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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,245 @@
package org.openapitools.model;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A User who is purchasing from the pet store
*/
@Schema(description="A User who is purchasing from the pet store")
public class User {
@Schema(description = "")
private Long id;
@Schema(description = "")
private String username;
@Schema(description = "")
private String firstName;
@Schema(description = "")
private String lastName;
@Schema(description = "")
private String email;
@Schema(description = "")
private String password;
@Schema(description = "")
private String phone;
/**
* User Status
*/
@Schema(description = "User Status")
private Integer userStatus;
/**
* Get id
* @return id
**/
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public User id(Long id) {
this.id = id;
return this;
}
/**
* Get username
* @return username
**/
@JsonProperty("username")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public User username(String username) {
this.username = username;
return this;
}
/**
* Get firstName
* @return firstName
**/
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public User firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* Get lastName
* @return lastName
**/
@JsonProperty("lastName")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public User lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* Get email
* @return email
**/
@JsonProperty("email")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public User email(String email) {
this.email = email;
return this;
}
/**
* Get password
* @return password
**/
@JsonProperty("password")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public User password(String password) {
this.password = password;
return this;
}
/**
* Get phone
* @return phone
**/
@JsonProperty("phone")
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public User phone(String phone) {
this.phone = phone;
return this;
}
/**
* User Status
* @return userStatus
**/
@JsonProperty("userStatus")
public Integer getUserStatus() {
return userStatus;
}
public void setUserStatus(Integer userStatus) {
this.userStatus = userStatus;
}
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,213 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import java.io.File;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.Pet;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* OpenAPI Petstore
*
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* API tests for PetApi
*/
public class PetApiTest {
private PetApi api;
@Before
public void setup() {
JacksonJsonProvider provider = new JacksonJsonProvider();
List providers = new ArrayList();
providers.add(provider);
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", PetApi.class, providers);
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
ClientConfiguration config = WebClient.getConfig(client);
}
/**
* Add a new pet to the store
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void addPetTest() {
Pet pet = null;
//Pet response = api.addPet(pet);
//assertNotNull(response);
// TODO: test validations
}
/**
* Deletes a pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deletePetTest() {
Long petId = null;
String apiKey = null;
//api.deletePet(petId, apiKey);
// TODO: test validations
}
/**
* Finds Pets by status
*
* Multiple status values can be provided with comma separated strings
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void findPetsByStatusTest() {
List<String> status = null;
//List<Pet> response = api.findPetsByStatus(status);
//assertNotNull(response);
// TODO: test validations
}
/**
* Finds Pets by tags
*
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void findPetsByTagsTest() {
List<String> tags = null;
//List<Pet> response = api.findPetsByTags(tags);
//assertNotNull(response);
// TODO: test validations
}
/**
* Find pet by ID
*
* Returns a single pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getPetByIdTest() {
Long petId = null;
//Pet response = api.getPetById(petId);
//assertNotNull(response);
// TODO: test validations
}
/**
* Update an existing pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetTest() {
Pet pet = null;
//Pet response = api.updatePet(pet);
//assertNotNull(response);
// TODO: test validations
}
/**
* Updates a pet in the store with form data
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetWithFormTest() {
Long petId = null;
String name = null;
String status = null;
//api.updatePetWithForm(petId, name, status);
// TODO: test validations
}
/**
* uploads an image
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileTest() {
Long petId = null;
String additionalMetadata = null;
File _file = null;
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file);
//assertNotNull(response);
// TODO: test validations
}
}

View File

@@ -0,0 +1,133 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.openapitools.model.Order;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* OpenAPI Petstore
*
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* API tests for StoreApi
*/
public class StoreApiTest {
private StoreApi api;
@Before
public void setup() {
JacksonJsonProvider provider = new JacksonJsonProvider();
List providers = new ArrayList();
providers.add(provider);
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", StoreApi.class, providers);
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
ClientConfiguration config = WebClient.getConfig(client);
}
/**
* Delete purchase order by ID
*
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deleteOrderTest() {
String orderId = null;
//api.deleteOrder(orderId);
// TODO: test validations
}
/**
* Returns pet inventories by status
*
* Returns a map of status codes to quantities
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getInventoryTest() {
//Map<String, Integer> response = api.getInventory();
//assertNotNull(response);
// TODO: test validations
}
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getOrderByIdTest() {
Long orderId = null;
//Order response = api.getOrderById(orderId);
//assertNotNull(response);
// TODO: test validations
}
/**
* Place an order for a pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void placeOrderTest() {
Order order = null;
//Order response = api.placeOrder(order);
//assertNotNull(response);
// TODO: test validations
}
}

View File

@@ -0,0 +1,208 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import java.util.Date;
import org.openapitools.model.User;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* OpenAPI Petstore
*
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* API tests for UserApi
*/
public class UserApiTest {
private UserApi api;
@Before
public void setup() {
JacksonJsonProvider provider = new JacksonJsonProvider();
List providers = new ArrayList();
providers.add(provider);
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", UserApi.class, providers);
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
ClientConfiguration config = WebClient.getConfig(client);
}
/**
* Create user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUserTest() {
User user = null;
//api.createUser(user);
// TODO: test validations
}
/**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithArrayInputTest() {
List<User> user = null;
//api.createUsersWithArrayInput(user);
// TODO: test validations
}
/**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithListInputTest() {
List<User> user = null;
//api.createUsersWithListInput(user);
// TODO: test validations
}
/**
* Delete user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deleteUserTest() {
String username = null;
//api.deleteUser(username);
// TODO: test validations
}
/**
* Get user by user name
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getUserByNameTest() {
String username = null;
//User response = api.getUserByName(username);
//assertNotNull(response);
// TODO: test validations
}
/**
* Logs user into the system
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void loginUserTest() {
String username = null;
String password = null;
//String response = api.loginUser(username, password);
//assertNotNull(response);
// TODO: test validations
}
/**
* Logs out current logged in user session
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void logoutUserTest() {
//api.logoutUser();
// TODO: test validations
}
/**
* Updated user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updateUserTest() {
String username = null;
User user = null;
//api.updateUser(username, user);
// TODO: test validations
}
}

View File

@@ -72,7 +72,7 @@ end
## Documentation for API Endpoints
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@@ -1,6 +1,6 @@
# Petstore::AnotherFakeApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::DefaultApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeClassnameTags123Api
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::PetApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::StoreApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::UserApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -156,8 +156,8 @@ module Petstore
attr_accessor :force_ending_format
def initialize
@scheme = 'https'
@host = '127.0.0.1'
@scheme = 'http'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -290,10 +290,6 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "https://127.0.0.1/v2",
description: "The local server without variables",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -331,6 +327,10 @@ module Petstore
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
url: "http://server.{version}.openapi-generator.tech",
description: "The openapi-generator test server",
@@ -351,10 +351,6 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -402,10 +398,6 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -453,10 +445,6 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -504,10 +492,6 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -555,10 +539,6 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",

View File

@@ -72,7 +72,7 @@ end
## Documentation for API Endpoints
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@@ -1,6 +1,6 @@
# Petstore::AnotherFakeApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::DefaultApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeClassnameTags123Api
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::PetApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::StoreApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::UserApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -127,8 +127,8 @@ module Petstore
attr_accessor :force_ending_format
def initialize
@scheme = 'https'
@host = '127.0.0.1'
@scheme = 'http'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -254,10 +254,6 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "https://127.0.0.1/v2",
description: "The local server without variables",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -295,6 +291,10 @@ module Petstore
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
url: "http://server.{version}.openapi-generator.tech",
description: "The openapi-generator test server",
@@ -315,10 +315,6 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -366,10 +362,6 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -417,10 +409,6 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -468,10 +456,6 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -519,10 +503,6 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",

View File

@@ -21,7 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
#
#
#
#

View File

@@ -72,7 +72,7 @@ end
## Documentation for API Endpoints
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@@ -1,6 +1,6 @@
# Petstore::AnotherFakeApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::DefaultApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::FakeClassnameTags123Api
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::PetApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::StoreApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -1,6 +1,6 @@
# Petstore::UserApi
All URIs are relative to *https://127.0.0.1/v2*
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |

View File

@@ -157,8 +157,8 @@ module Petstore
attr_accessor :force_ending_format
def initialize
@scheme = 'https'
@host = '127.0.0.1'
@scheme = 'http'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = nil
@server_operation_index = {}
@@ -286,10 +286,6 @@ module Petstore
# Returns an array of Server setting
def server_settings
[
{
url: "https://127.0.0.1/v2",
description: "The local server without variables",
},
{
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
@@ -327,6 +323,10 @@ module Petstore
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
},
{
url: "http://server.{version}.openapi-generator.tech",
description: "The openapi-generator test server",
@@ -347,10 +347,6 @@ module Petstore
def operation_server_settings
{
"PetApi.add_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -398,10 +394,6 @@ module Petstore
}
],
"PetApi.delete_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -449,10 +441,6 @@ module Petstore
}
],
"PetApi.get_pet_by_id": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -500,10 +488,6 @@ module Petstore
}
],
"PetApi.update_pet": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",
@@ -551,10 +535,6 @@ module Petstore
}
],
"PetApi.update_pet_with_form": [
{
url: "http://127.0.0.1/v2",
description: "No description provided",
},
{
url: "http://petstore.swagger.io/v2",
description: "No description provided",