Merge remote-tracking branch 'origin' into 4.0.x

This commit is contained in:
William Cheng 2018-11-30 10:16:16 +08:00
commit b226f52d13
188 changed files with 1199 additions and 6335 deletions

View File

@ -343,20 +343,26 @@ cd /vagrant
### [1.7 - NPM](#table-of-contents)
There is also an [NPM package wrapper](https://github.com/HarmoWatch/openapi-generator-cli), available.
Please see the [docs](https://github.com/HarmoWatch/openapi-generator-cli) there for more information.
There is also an [NPM package wrapper](https://www.npmjs.com/package/@openapitools/openapi-generator-cli) available for different platforms (e.g. Linux, Mac, Windows). (JVM is still required)
Please see the [project's README](https://github.com/openapitools/openapi-generator-cli) there for more information.
Install it globally to get the CLI available on the command line:
```sh
npm install @harmowatch/openapi-generator-cli -g
npm install @openapitools/openapi-generator-cli -g
openapi-generator version
```
Or you install it as dev-dependency like this:
Or install a particualar OpenAPI Generator version (e.g. v3.3.3):
```sh
npm install @harmowatch/openapi-generator-cli -D
npm install @openapitools/openapi-generator-cli@cli-3.3.3 -g
```
Or install it as dev-dependency:
```sh
npm install @openapitools/openapi-generator-cli -D
```
## [2 - Getting Started](#table-of-contents)
@ -476,6 +482,15 @@ Please refer to [integration.md](docs/integration.md) on how to integrate OpenAP
### [3.3 - Online OpenAPI generator](#table-of-contents)
Here are the public online services:
- latest stable version: http://api.openapi-generator.tech
- latest master: http://api-latest-master.openapi-generator.tech (updated with latest master every hour)
The server is sponsored by [Linode](https://www.linode.com/) [![Linode Logo](https://www.linode.com/media/images/logos/standard/light/linode-logo_standard_light_small.png)](https://www.linode.com/)
(These services are beta and do not have any guarantee on service level)
Please refer to [online-openapi-generator.md](docs/online-openapi-generator.md) on how to run and use the `openapi-generator-online` - a web service for `openapi-generator`.
### [3.4 - License information on Generated Code](#table-of-contents)
@ -491,6 +506,7 @@ When code is generated from this project, it shall be considered **AS IS** and o
Here are some companies/projects (alphabetical order) using OpenAPI Generator in production. To add your company/project to the list, please visit [README.md](README.md) and click on the icon to edit the page.
- [Angular.Schule](https://angular.schule/)
- [b<>com](https://b-com.com/en)
- [Bithost GmbH](https://www.bithost.ch)
- [Boxever](https://www.boxever.com/)
- [GMO Pepabo](https://pepabo.com/en/)
@ -518,7 +534,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2018/08/22 - [OpenAPI Generatorのプロジェクト構成などのメモ](https://yinm.info/20180822/) by [Yusuke Iinuma](https://github.com/yinm)
- 2018/10/31 - [A node package wrapper for openapi-generator](https://github.com/HarmoWatch/openapi-generator-cli)
- 2018/11/03 - [OpenAPI Generator + golang + Flutter でアプリ開発](http://ryuichi111std.hatenablog.com/entry/2018/11/03/214005) by [Ryuichi Daigo](https://github.com/ryuichi111)
- 2018/11/19 - [OpenAPIs are everywhere](https://youtu.be/-lDot4Yn7Dg) by [Jeremie Bresson (Unblu)](https://github.com/jmini) at [EclipseCon Europe 2018](https://www.eclipsecon.org/europe2018)
## [6 - About Us](#table-of-contents)

View File

@ -25,6 +25,11 @@ then
mvn clean package
fi
# purge lib/doc folder
echo "purge ruby petstore lib, docs folder"
rm -Rf samples/openapi3/client/petstore/ruby/lib
rm -Rf samples/openapi3/client/petstore/ruby/docs
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/openapi3/client/petstore/ruby -DskipFormModel=true $@"

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test\resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test\resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -28,4 +28,9 @@ CONFIG OPTIONS for kotlin
java8 - Java 8 native JSR310
threetenbp - Threetenbp
collectionType
Option. Collection type to use
array - kotlin.Array
list - kotlin.collections.List
Back to the [generators list](README.md)

View File

@ -170,6 +170,9 @@ CONFIG OPTIONS for spring
hateoas
Use Spring HATEOAS library to allow adding HATEOAS links (Default: false)
returnSuccessCode
Generated server returns 2xx code (Default: false)
library
library template (sub-template) to use (Default: spring-boot)
spring-boot - Spring-boot Server application using the SpringFox integration.

View File

@ -1,8 +1,17 @@
## Online OpenAPI generator
One can also generate API client or server using the online openapi-generator.
One can also generate API clients or server stubs using the online openapi-generator.
Here are the steps to run it locally:
Here are the public online services:
- latest stable version: http://api.openapi-generator.tech
- latest master: http://api-latest-master.openapi-generator.tech (updated with latest master every hour)
The server is sponsored by [Linode](https://www.linode.com/) [![Linode Logo](https://www.linode.com/media/images/logos/standard/light/linode-logo_standard_light_small.png)](https://www.linode.com/)
(These services are beta and do not have any guarantee on service level)
If you prefer to run the service locally, here are the steps:
```
mvn clean install
cd modules/openapi-generator-online

View File

@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.*;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
@ -246,6 +247,11 @@ public class Generate implements Runnable {
}
if (isNotEmpty(spec)) {
if (!spec.matches("^http(s)?://.*") && !new File(spec).exists()) {
System.err.println("[error] The spec file is not found: " + spec);
System.err.println("[error] Check the path of the OpenAPI spec and try again.");
System.exit(1);
}
configurator.setInputSpec(spec);
}

View File

@ -64,7 +64,7 @@ public class GenerateTest {
@Test
public void testRequiredArgs_ShortArgs() throws Exception {
setupAndRunTest("-i", "swagger.yaml", "-g", "java", "-o", "src/main/java", false, null);
setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null);
new FullVerifications() {
{
}
@ -73,7 +73,7 @@ public class GenerateTest {
@Test
public void testRequiredArgs_LongArgs() throws Exception {
setupAndRunTest("--input-spec", "swagger.yaml", "--generator-name", "java", "--output",
setupAndRunTest("--input-spec", "src/test/resources/swagger.yaml", "--generator-name", "java", "--output",
"src/main/java", false, null);
new FullVerifications() {
{
@ -220,7 +220,7 @@ public class GenerateTest {
@Test
public void testConfig() throws Exception {
setupAndRunTest("-i", "swagger.yaml", "-g", "java", "-o", "src/main/java", true,
setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true,
"config.json", "-c", "config.json");
new FullVerifications() {
@ -228,7 +228,7 @@ public class GenerateTest {
}
};
setupAndRunTest("-i", "swagger.yaml", "-g", "java", "-o", "src/main/java", true,
setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true,
"config.json", "--config", "config.json");
new FullVerifications() {
@ -570,7 +570,7 @@ public class GenerateTest {
}
private void setupAndRunGenericTest(String... additionalParameters) {
setupAndRunTest("-i", "swagger.yaml", "-g", "java", "-o", "src/main/java", false, null,
setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null,
additionalParameters);
}
}

View File

@ -0,0 +1,109 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: A paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Create a pet
operationId: createPets
tags:
- pets
responses:
'201':
description: Null response
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/pets/{petId}:
get:
summary: Info for a specific pet
operationId: showPetById
tags:
- pets
parameters:
- name: petId
in: path
required: true
description: The id of the pet to retrieve
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string

View File

@ -56,6 +56,10 @@ import org.sonatype.plexus.build.incremental.DefaultBuildContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
/**
* Goal which generates client/server code from a OpenAPI json/yaml definition.
*/
@ -317,6 +321,12 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "skip", property = "codegen.skip", required = false, defaultValue = "false")
private Boolean skip;
/**
* Skip the execution if the source file is older than the output folder.
*/
@Parameter(name = "skipIfSpecIsUnchanged", property = "codegen.skipIfSpecIsUnchanged", required = false, defaultValue = "false")
private Boolean skipIfSpecIsUnchanged;
/**
* Add the output directory to the project as a source root, so that the generated java types
* are compiled and included in the project artifact.
@ -368,6 +378,21 @@ public class CodeGenMojo extends AbstractMojo {
}
}
if (skipIfSpecIsUnchanged) {
if (inputSpecFile.exists()) {
File storedInputSpecHashFile = getHashFile(inputSpecFile);
if(storedInputSpecHashFile.exists()) {
String inputSpecHash = Files.asByteSource(inputSpecFile).hash(Hashing.sha256()).toString();
String storedInputSpecHash = Files.asCharSource(storedInputSpecHashFile, Charsets.UTF_8).read();
if (inputSpecHash.equals(storedInputSpecHash)) {
getLog().info(
"Code generation is skipped because input was unchanged");
return;
}
}
}
}
// attempt to read from config file
CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
@ -606,6 +631,17 @@ public class CodeGenMojo extends AbstractMojo {
if (buildContext != null) {
buildContext.refresh(new File(getCompileSourceRoot()));
}
// Store a checksum of the input spec
File storedInputSpecHashFile = getHashFile(inputSpecFile);
String inputSpecHash = Files.asByteSource(inputSpecFile).hash(Hashing.sha256()).toString();
if (storedInputSpecHashFile.getParent() != null && !new File(storedInputSpecHashFile.getParent()).exists()) {
File parent = new File(storedInputSpecHashFile.getParent());
parent.mkdirs();
}
Files.asCharSink(storedInputSpecHashFile, Charsets.UTF_8).write(inputSpecHash);
} catch (Exception e) {
// Maven logs exceptions thrown by plugins only if invoked with -e
// I find it annoying to jump through hoops to get basic diagnostic information,
@ -618,7 +654,11 @@ public class CodeGenMojo extends AbstractMojo {
"Code generation failed. See above for the full exception.");
}
}
private File getHashFile(File inputSpecFile) {
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + inputSpecFile.getName() + ".sha256");
}
private String getCompileSourceRoot() {
final Object sourceFolderObject =
configOptions == null ? null : configOptions
@ -647,10 +687,10 @@ public class CodeGenMojo extends AbstractMojo {
}
}
/**
* This method enables conversion of true/false strings in
* This method enables conversion of true/false strings in
* config.additionalProperties (configuration/configOptions) to proper booleans.
* This enables mustache files to handle the properties better.
*
*
* @param config
*/
private void adjustAdditionalProperties(final CodegenConfig config) {

View File

@ -27,6 +27,7 @@ import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.servers.ServerVariable;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -261,4 +262,9 @@ public interface CodegenConfig {
public void setEnablePostProcessFile(boolean isEnablePostProcessFile);
// set OpenAPI and schemas
public void setGlobalOpenAPI(OpenAPI openAPI);
public void setGlobalSchemas(OpenAPI openAPI);
}

View File

@ -137,6 +137,9 @@ public class DefaultCodegen implements CodegenConfig {
// flag to indicate whether to use environment variable to post process file
protected boolean enablePostProcessFile = false;
// make openapi and schemas available to all methods
protected OpenAPI globalOpenAPI;
protected Map<String, Schema> globalSchemas;
public List<CliOption> cliOptions() {
return cliOptions;
@ -383,6 +386,32 @@ public class DefaultCodegen implements CodegenConfig {
}
}
/**
* Set global OpenAPI based on OpenAPI object
*
* @param openAPI OpenAPI object
*/
public void setGlobalOpenAPI(OpenAPI openAPI) {
this.globalOpenAPI = openAPI;
}
/**
* Set global schema based on OpenAPI object
*
* @param openAPI OpenAPI object
*/
public void setGlobalSchemas(OpenAPI openAPI) {
if (openAPI != null && openAPI.getComponents() != null) {
this.globalSchemas = openAPI.getComponents().getSchemas();
}
if (this.globalSchemas == null) { // initalize with empty map if it's null
this.globalSchemas = new HashMap<String, Schema>();
}
}
// override with any special post-processing
@SuppressWarnings("static-method")
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
@ -1762,6 +1791,7 @@ public class DefaultCodegen implements CodegenConfig {
return org.openapitools.codegen.utils.StringUtils.camelize(toVarName(name));
}
/**
* Convert OAS Property object to Codegen Property object
*
@ -1775,6 +1805,10 @@ public class DefaultCodegen implements CodegenConfig {
return null;
}
LOGGER.debug("debugging fromProperty for " + name + " : " + p);
// unalias schema
p = ModelUtils.unaliasSchema(globalSchemas, p);
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
property.name = toVarName(name);
property.baseName = name;
@ -2003,7 +2037,8 @@ public class DefaultCodegen implements CodegenConfig {
if (itemName == null) {
itemName = property.name;
}
CodegenProperty cp = fromProperty(itemName, ((ArraySchema) p).getItems());
Schema innerSchema = ModelUtils.unaliasSchema(globalSchemas, ((ArraySchema) p).getItems());
CodegenProperty cp = fromProperty(itemName, innerSchema);
updatePropertyForArray(property, cp);
} else if (ModelUtils.isMapSchema(p)) {
property.isContainer = true;
@ -2014,7 +2049,8 @@ public class DefaultCodegen implements CodegenConfig {
property.maxItems = p.getMaxProperties();
// handle inner property
CodegenProperty cp = fromProperty("inner", ModelUtils.getAdditionalProperties(p));
Schema innerSchema = ModelUtils.unaliasSchema(globalSchemas, ModelUtils.getAdditionalProperties(p));
CodegenProperty cp = fromProperty("inner", innerSchema);
updatePropertyForMap(property, cp);
} else if (ModelUtils.isFreeFormObject(p)) {
property.isFreeFormObject = true;
@ -2308,10 +2344,8 @@ public class DefaultCodegen implements CodegenConfig {
op.responses.get(op.responses.size() - 1).hasMore = false;
if (methodResponse != null) {
Schema responseSchema = ModelUtils.getSchemaFromResponse(methodResponse);
if (openAPI != null && openAPI.getComponents() != null) { // has models/aliases defined
responseSchema = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), responseSchema);
}
Schema responseSchema = ModelUtils.unaliasSchema(globalSchemas, ModelUtils.getSchemaFromResponse(methodResponse));
if (responseSchema != null) {
CodegenProperty cm = fromProperty("response", responseSchema);
@ -2331,7 +2365,13 @@ public class DefaultCodegen implements CodegenConfig {
}
// generate examples
op.examples = new ExampleGenerator(schemas, openAPI).generateFromResponseSchema(responseSchema, getProducesInfo(openAPI, operation));
String exampleStatusCode = "200";
for (String key : operation.getResponses().keySet()) {
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
exampleStatusCode = key;
}
}
op.examples = new ExampleGenerator(schemas, openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(openAPI, operation));
op.defaultResponse = toDefaultValue(responseSchema);
op.returnType = cm.dataType;
op.hasReference = schemas != null && schemas.containsKey(op.returnBaseType);
@ -2559,7 +2599,12 @@ public class DefaultCodegen implements CodegenConfig {
} else {
r.code = responseCode;
}
final Schema responseSchema = ModelUtils.getSchemaFromResponse(response);
Schema responseSchema;
if (openAPI != null && openAPI.getComponents() != null) {
responseSchema = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), ModelUtils.getSchemaFromResponse(response));
} else { // no model/alias defined
responseSchema = ModelUtils.getSchemaFromResponse(response);
}
r.schema = responseSchema;
r.message = escapeText(response.getDescription());
// TODO need to revise and test examples in responses
@ -2573,6 +2618,7 @@ public class DefaultCodegen implements CodegenConfig {
r.hasHeaders = !r.headers.isEmpty();
if (r.schema != null) {
Map<String, Schema> allSchemas = null;
CodegenProperty cp = fromProperty("response", responseSchema);
if (ModelUtils.isArraySchema(responseSchema)) {
@ -3209,6 +3255,7 @@ public class DefaultCodegen implements CodegenConfig {
String description = headers.getValue().getDescription();
// follow the $ref
Header header = ModelUtils.getReferencedHeader(openAPI, headers.getValue());
CodegenProperty cp = fromProperty(headers.getKey(), header.getSchema());
cp.setDescription(escapeText(description));
cp.setUnescapedDescription(description);

View File

@ -38,7 +38,6 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
//import org.openapitools.codegen.languages.AbstractJavaCodegen;
import org.openapitools.codegen.utils.ImplementationVersion;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.URLPathUtils;
@ -181,6 +180,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
config.processOpts();
config.preprocessOpenAPI(openAPI);
// set OpenAPI and schemas to make these available to all methods
config.setGlobalOpenAPI(openAPI);
config.setGlobalSchemas(openAPI);
config.additionalProperties().put("generatorVersion", ImplementationVersion.read());
config.additionalProperties().put("generatedDate", ZonedDateTime.now().toString());
config.additionalProperties().put("generatedYear", String.valueOf(ZonedDateTime.now().getYear()));
@ -424,6 +428,25 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
}
Schema schema = schemas.get(name);
// check to see if it's a "map" model
if (ModelUtils.isMapSchema(schema)) {
if (schema.getProperties() == null || schema.getProperties().isEmpty()) {
// schema without property, i.e. alias to map
LOGGER.info("Model " + name + " not generated since it's an alias to map (without property)");
continue;
}
}
// check to see if it's an "array" model
if (ModelUtils.isArraySchema(schema)) {
if (schema.getProperties() == null || schema.getProperties().isEmpty()) {
// schema without property, i.e. alias to array
LOGGER.info("Model " + name + " not generated since it's an alias to array (without property)");
continue;
}
}
Map<String, Schema> schemaMap = new HashMap<>();
schemaMap.put(name, schema);
Map<String, Object> models = processModels(config, schemaMap, schemas);

View File

@ -42,6 +42,7 @@ public class ExampleGenerator {
private static final String NONE = "none";
private static final String URL = "url";
private static final String URI = "uri";
private static final String STATUS_CODE = "statusCode";
protected Map<String, Schema> examples;
private OpenAPI openAPI;
@ -54,7 +55,20 @@ public class ExampleGenerator {
this.random = new Random("ExampleGenerator".hashCode());
}
public List<Map<String, String>> generateFromResponseSchema(Schema responseSchema, Set<String> producesInfo) {
public List<Map<String, String>> generateFromResponseSchema(String statusCode, Schema responseSchema, Set<String> producesInfo) {
List<Map<String, String>> examples = generateFromResponseSchema(responseSchema, producesInfo);
if (examples == null) {
return null;
}
for (Map<String, String> example : examples) {
example.put(STATUS_CODE, statusCode);
}
return examples;
}
private List<Map<String, String>> generateFromResponseSchema(Schema responseSchema, Set<String> producesInfo) {
if (responseSchema.getExample() == null && StringUtils.isEmpty(responseSchema.get$ref()) && !ModelUtils.isArraySchema(responseSchema)) {
// no example provided
return null;

View File

@ -147,20 +147,7 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf
}
public String toRegularExpression(String pattern) {
if (StringUtils.isEmpty(pattern)) {
return pattern;
}
// We don't escape \ in string since Ruby doesn't like \ escaped in regex literal
String regexString = pattern;
if (!regexString.startsWith("/")) {
regexString = "/" + regexString;
}
if (StringUtils.countMatches(regexString, '/') == 1) {
// we only have forward slash inserted at start... adding one to end
regexString = regexString + "/";
}
return regexString;
return addRegularExpressionDelimiter(pattern);
}
@Override

View File

@ -654,6 +654,9 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
sb.append(param.dataType);
} else if (param.isFile || param.isBinary) {
sb.append("String.t");
} else if ("String.t".equals(param.dataType)) {
// uuid, password, etc
sb.append(param.dataType);
} else {
// <module>.Model.<type>.t
sb.append(moduleName);
@ -693,6 +696,8 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
// Primitive return type, don't even try to decode
if (returnBaseType == null || (returnSimpleType && returnTypeIsPrimitive)) {
return "false";
} else if (isListContainer && languageSpecificPrimitives().contains(returnBaseType)) {
return "[]";
}
StringBuilder sb = new StringBuilder();
if (isListContainer) {

View File

@ -31,9 +31,11 @@ import java.util.Map;
public class KotlinClientCodegen extends AbstractKotlinCodegen {
public static final String DATE_LIBRARY = "dateLibrary";
public static final String COLLECTION_TYPE = "collectionType";
private static final Logger LOGGER = LoggerFactory.getLogger(KotlinClientCodegen.class);
protected String dateLibrary = DateLibrary.JAVA8.value;
protected String collectionType = CollectionType.ARRAY.value;
public enum DateLibrary {
STRING("string"),
@ -47,6 +49,17 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
}
}
public enum CollectionType {
ARRAY("array"),
LIST("list");
public final String value;
CollectionType(String value) {
this.value = value;
}
}
/**
* Constructs an instance of `KotlinClientCodegen`.
*/
@ -74,6 +87,13 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
dateOptions.put(DateLibrary.JAVA8.value, "Java 8 native JSR310");
dateLibrary.setEnum(dateOptions);
cliOptions.add(dateLibrary);
CliOption collectionType = new CliOption(COLLECTION_TYPE, "Option. Collection type to use");
Map<String, String> collectionOptions = new HashMap<>();
collectionOptions.put(CollectionType.ARRAY.value, "kotlin.Array");
collectionOptions.put(CollectionType.LIST.value, "kotlin.collections.List");
collectionType.setEnum(collectionOptions);
cliOptions.add(collectionType);
}
public CodegenType getTag() {
@ -92,6 +112,10 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
this.dateLibrary = library;
}
public void setCollectionType(String collectionType) {
this.collectionType = collectionType;
}
@Override
public void processOpts() {
super.processOpts();
@ -116,6 +140,15 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
additionalProperties.put(DateLibrary.JAVA8.value, true);
}
if (additionalProperties.containsKey(COLLECTION_TYPE)) {
setCollectionType(additionalProperties.get(COLLECTION_TYPE).toString());
}
if (CollectionType.LIST.value.equals(collectionType)) {
typeMapping.put("array", "kotlin.collections.List");
typeMapping.put("list", "kotlin.collections.List");
}
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle"));
supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));

View File

@ -77,6 +77,7 @@ public class SpringCodegen extends AbstractJavaCodegen
public static final String OPENAPI_DOCKET_CONFIG = "swaggerDocketConfig";
public static final String API_FIRST = "apiFirst";
public static final String HATEOAS = "hateoas";
public static final String RETURN_SUCCESS_CODE = "returnSuccessCode";
protected String title = "OpenAPI Spring";
protected String configPackage = "org.openapitools.configuration";
@ -98,6 +99,7 @@ public class SpringCodegen extends AbstractJavaCodegen
protected boolean useOptional = false;
protected boolean virtualService = false;
protected boolean hateoas = false;
protected boolean returnSuccessCode = false;
public SpringCodegen() {
super();
@ -131,6 +133,7 @@ public class SpringCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(API_FIRST, "Generate the API from the OAI spec at server compile time (API first approach)", apiFirst));
cliOptions.add(CliOption.newBoolean(USE_OPTIONAL,"Use Optional container for optional parameters", useOptional));
cliOptions.add(CliOption.newBoolean(HATEOAS, "Use Spring HATEOAS library to allow adding HATEOAS links", hateoas));
cliOptions.add(CliOption.newBoolean(RETURN_SUCCESS_CODE, "Generated server returns 2xx code", returnSuccessCode));
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application using the SpringFox integration.");
supportedLibraries.put(SPRING_MVC_LIBRARY, "Spring-MVC Server application using the SpringFox integration.");
@ -277,6 +280,10 @@ public class SpringCodegen extends AbstractJavaCodegen
this.setHateoas(Boolean.valueOf(additionalProperties.get(HATEOAS).toString()));
}
if (additionalProperties.containsKey(RETURN_SUCCESS_CODE)) {
this.setReturnSuccessCode(Boolean.valueOf(additionalProperties.get(RETURN_SUCCESS_CODE).toString()));
}
typeMapping.put("file", "Resource");
importMapping.put("Resource", "org.springframework.core.io.Resource");
@ -721,6 +728,10 @@ public class SpringCodegen extends AbstractJavaCodegen
this.hateoas = hateoas;
}
public void setReturnSuccessCode(boolean returnSuccessCode) {
this.returnSuccessCode = returnSuccessCode;
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);

View File

@ -771,22 +771,15 @@ public class ModelUtils {
return schema;
} else if (isFreeFormObject(ref)) {
return schema;
} else if (isArraySchema(ref) || isComposedSchema(ref)) { // array def should be created as models
} else if (isArraySchema(ref)) {
return unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())));
} else if (isComposedSchema(ref)) {
return schema;
} else if (isMapSchema(ref)) {
if (ref.getProperties() != null && !ref.getProperties().isEmpty()) // has properties
return schema; // treat it as model
else {
// treat it as a typical map
/* TODO unalias the map item if it's an alias
if (ref.getAdditionalProperties() != null) {
Schema innerSchema = (Schema) ref.getAdditionalProperties();
if (StringUtils.isNotEmpty(innerSchema.get$ref())) { // map item is a ref to something else
//Schema unaliasInnerSchema = unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(innerSchema.get$ref())));
//ref.setAdditionalProperties(unaliasInnerSchema);
}
}*/
return unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())));
}
} else if (isObjectSchema(ref)) { // model

View File

@ -0,0 +1,169 @@
# {{artifactId}}
{{appName}}
- API version: {{appVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
{{#appDescription}}{{{appDescription}}}{{/appDescription}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
## Requirements
Building the API client library requires:
1. Java {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}+
2. Maven/Gradle
## Installation
To install the API client library to your local Maven repository, simply execute:
```shell
mvn clean install
```
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
```shell
mvn clean deploy
```
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>{{{groupId}}}</groupId>
<artifactId>{{{artifactId}}}</artifactId>
<version>{{{artifactVersion}}}</version>
<scope>compile</scope>
</dependency>
```
### Gradle users
Add this dependency to your project's build file:
```groovy
compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}"
```
### Others
At first generate the JAR by executing:
```shell
mvn clean package
```
Then manually install the following JARs:
* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar`
* `target/lib/*.jar`
## Getting Started
Please follow the [installation](#installation) instruction and execute the following Java code:
```java
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
import {{{invokerPackage}}}.*;
import {{{invokerPackage}}}.auth.*;
import {{{modelPackage}}}.*;
import {{{package}}}.{{{classname}}};
import java.io.File;
import java.util.*;
public class {{{classname}}}Example {
public static void main(String[] args) {
{{#hasAuthMethods}}ApiClient defaultClient = Configuration.getDefaultApiClient();
{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
{{{name}}}.setUsername("YOUR USERNAME");
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
{{{name}}}.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
{{{classname}}} apiInstance = new {{{classname}}}();
{{#allParams}}
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try {
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}}
.{{{paramName}}}({{{paramName}}}){{/optionalParams}}
.execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}}
System.out.println(result);{{/returnType}}
} catch (ApiException e) {
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
e.printStackTrace();
}
}
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
## Documentation for API Endpoints
All URIs are relative to *{{basePath}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation for Models
{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}
## Documentation for Authorization
{{^authMethods}}All endpoints do not require authorization.
{{/authMethods}}Authentication schemes defined for the API:
{{#authMethods}}### {{name}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## Recommendation
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
## Author
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
{{/hasMore}}{{/apis}}{{/apiInfo}}

View File

@ -63,7 +63,7 @@ public class {{classname}} {
}
{{#operation}}
/**
{{^vendorExtensions.x-group-parameters}}/**
* Build call for {{operationId}}{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
* @param progressListener Progress listener
@ -81,7 +81,7 @@ public class {{classname}} {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public com.squareup.okhttp.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} com.squareup.okhttp.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}};
// create path and map variables
@ -185,6 +185,7 @@ public class {{classname}} {
{{/performBeanValidation}}
}
{{^vendorExtensions.x-group-parameters}}
/**
* {{summary}}
* {{notes}}{{#allParams}}
@ -206,8 +207,9 @@ public class {{classname}} {
{{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
return {{localVariablePrefix}}resp.getData();{{/returnType}}
}
{{/vendorExtensions.x-group-parameters}}
/**
{{^vendorExtensions.x-group-parameters}}/**
* {{summary}}
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
@ -224,13 +226,13 @@ public class {{classname}} {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null, null);
{{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}}
}
/**
{{^vendorExtensions.x-group-parameters}}/**
* {{summary}} (asynchronously)
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
@ -248,7 +250,7 @@ public class {{classname}} {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public com.squareup.okhttp.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException {
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} com.squareup.okhttp.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
@ -274,6 +276,119 @@ public class {{classname}} {
{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType, {{localVariablePrefix}}callback);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}callback);{{/returnType}}
return {{localVariablePrefix}}call;
}
{{#vendorExtensions.x-group-parameters}}
public class API{{operationId}}Request {
{{#requiredParams}}
private final {{{dataType}}} {{localVariablePrefix}}{{paramName}};
{{/requiredParams}}
{{#optionalParams}}
private {{{dataType}}} {{localVariablePrefix}}{{paramName}};
{{/optionalParams}}
private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}) {
{{#requiredParams}}
this.{{localVariablePrefix}}{{paramName}} = {{paramName}};
{{/requiredParams}}
}
{{#optionalParams}}
/**
* Set {{paramName}}
* @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}})
* @return API{{operationId}}Request
*/
public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) {
this.{{localVariablePrefix}}{{paramName}} = {{paramName}};
return this;
}
{{/optionalParams}}
/**
* Build call for {{operationId}}
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public com.squareup.okhttp.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
return {{operationId}}Call({{#allParams}}{{localVariablePrefix}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener);
}
/**
* Execute {{operationId}} request{{#returnType}}
* @return {{returnType}}{{/returnType}}
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} execute() throws ApiException {
{{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
return {{localVariablePrefix}}resp.getData();{{/returnType}}
}
/**
* Execute {{operationId}} request with HTTP info returned
* @return ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException {
return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
}
/**
* Execute {{operationId}} request (asynchronously)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public com.squareup.okhttp.Call executeAsync(final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> callback) throws ApiException {
return {{operationId}}Async({{#allParams}}{{localVariablePrefix}}{{paramName}}, {{/allParams}}callback);
}
}
/**
* {{summary}}
* {{notes}}{{#requiredParams}}
* @param {{paramName}} {{description}} (required){{/requiredParams}}
* @return API{{operationId}}Request
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}) {
return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}});
}
{{/vendorExtensions.x-group-parameters}}
{{/operation}}
}
{{/operations}}

View File

@ -0,0 +1,85 @@
# {{classname}}{{#description}}
{{description}}{{/description}}
All URIs are relative to *{{basePath}}*
Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}
{{#operations}}
{{#operation}}
<a name="{{operationId}}"></a>
# **{{operationId}}**{{^vendorExtensions.x-group-parameters}}
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}}.{{paramName}}({{paramName}}){{/optionalParams}}.execute();{{/vendorExtensions.x-group-parameters}}
{{summary}}{{#notes}}
{{notes}}{{/notes}}
### Example
```java
// Import classes:{{#hasAuthMethods}}
//import {{{invokerPackage}}}.ApiClient;{{/hasAuthMethods}}
//import {{{invokerPackage}}}.ApiException;{{#hasAuthMethods}}
//import {{{invokerPackage}}}.Configuration;
//import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
//import {{{package}}}.{{{classname}}};
{{#hasAuthMethods}}
ApiClient defaultClient = Configuration.getDefaultApiClient();
{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
{{{name}}}.setUsername("YOUR USERNAME");
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
{{{name}}}.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
{{{classname}}} apiInstance = new {{{classname}}}();
{{#allParams}}
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try {
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}}
.{{{paramName}}}({{{paramName}}}){{/optionalParams}}
.execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}}
System.out.println(result);{{/returnType}}
} catch (ApiException e) {
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
e.printStackTrace();
}
```
### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}}
{{/allParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}
### Authorization
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
### HTTP request headers
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
{{/operation}}
{{/operations}}

View File

@ -0,0 +1,47 @@
{{>licenseInfo}}
package {{package}};
import {{invokerPackage}}.ApiException;
{{#imports}}import {{import}};
{{/imports}}
import org.junit.Test;
import org.junit.Ignore;
{{^fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{/fullJavaUtil}}
/**
* API tests for {{classname}}
*/
@Ignore
public class {{classname}}Test {
private final {{classname}} api = new {{classname}}();
{{#operations}}{{#operation}}
/**
* {{summary}}
*
* {{notes}}
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void {{operationId}}Test() throws ApiException {
{{#allParams}}
{{{dataType}}} {{paramName}} = null;
{{/allParams}}
{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}}
.{{paramName}}({{paramName}}){{/optionalParams}}
.execute();{{/vendorExtensions.x-group-parameters}}
// TODO: test validations
}
{{/operation}}{{/operations}}
}

View File

@ -16,7 +16,7 @@ return CompletableFuture.supplyAsync(()-> {
{{#jdk8}}
{{#async}} {{/async}} });
{{/jdk8}}
{{#async}} {{/async}} return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
{{#async}} {{/async}} return new ResponseEntity<>({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
{{#jdk8}}
{{#async}}
}, Runnable::run);
@ -25,14 +25,14 @@ return CompletableFuture.supplyAsync(()-> {
{{/-last}}
{{/examples}}
{{^examples}}
return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#jdk8}}{{#async}}){{/async}}{{/jdk8}};
return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{#jdk8}}{{#async}}){{/async}}{{/jdk8}};
{{/examples}}
{{/reactive}}
{{#reactive}}
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
Mono<Void> result = Mono.empty();
{{#examples}}
{{#-first}}
exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
{{/-first}}
if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
@ -43,5 +43,8 @@ exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
}
{{/-last}}
{{/examples}}
{{^examples}}
exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
{{/examples}}
return result.then(Mono.empty());
{{/reactive}}

View File

@ -49,7 +49,7 @@ defmodule {{moduleName}}.Api.{{classname}} do
|> url("{{replacedPathName}}")
{{#requiredParams}}
{{^isPathParam}}
|> add_param({{#isBodyParam}}:body{{/isBodyParam}}{{#isFormParam}}{{#isMultipart}}{{#isFile}}:file{{/isFile}}{{^isFile}}:form{{/isFile}}{{/isMultipart}}{{^isMultipart}}:form{{/isMultipart}}{{/isFormParam}}{{#isQueryParam}}:query{{/isQueryParam}}{{#isHeaderParam}}:headers{{/isHeaderParam}}, :"{{baseName}}", {{#underscored}}{{paramName}}{{/underscored}})
|> add_param({{#isBodyParam}}:body{{/isBodyParam}}{{#isFormParam}}{{#isMultipart}}{{#isFile}}:file{{/isFile}}{{^isFile}}:form{{/isFile}}{{/isMultipart}}{{^isMultipart}}:form{{/isMultipart}}{{/isFormParam}}{{#isQueryParam}}:query{{/isQueryParam}}{{#isHeaderParam}}:headers{{/isHeaderParam}}, {{#isBodyParam}}:body, {{/isBodyParam}}{{^isBodyParam}}:"{{baseName}}", {{/isBodyParam}}{{#underscored}}{{paramName}}{{/underscored}})
{{/isPathParam}}
{{/requiredParams}}
{{#optionalParams}}

View File

@ -11,7 +11,7 @@
]
@type t :: %__MODULE__{
{{#vars}}:"{{baseName}}" => {{{dataType}}}{{#hasMore}},
{{#vars}}:"{{baseName}}" => {{{datatype}}}{{#isNullable}} | nil{{/isNullable}}{{^isNullable}}{{^required}} | nil{{/required}}{{/isNullable}}{{#hasMore}},
{{/hasMore}}{{/vars}}
}
end

View File

@ -85,6 +85,10 @@ defmodule {{moduleName}}.RequestBuilder do
|> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)
|> Map.update!(:body, &(Tesla.Multipart.add_field(&1, key, Poison.encode!(value), headers: [{:"Content-Type", "application/json"}])))
end
def add_param(request, :headers, key, value) do
request
|> Map.update(:headers, %{key => value}, &(Map.put(&1, key, value)))
end
def add_param(request, :file, name, path) do
request
|> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)

View File

@ -30,7 +30,7 @@ To install the bindings via [Composer](http://getcomposer.org/), add the followi
{
"repositories": [
{
"type": "git",
"type": "vcs",
"url": "https://github.com/{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}.git"
}
],

View File

@ -199,6 +199,33 @@ public class KotlinClientCodegenModelTest {
Assert.assertTrue(property.isContainer);
}
@Test(description = "convert a model with array property to a kotlin.collections.List")
public void listPropertyTest() {
final Schema model = getArrayTestSchema();
final KotlinClientCodegen codegen = new KotlinClientCodegen();
codegen.setCollectionType(KotlinClientCodegen.CollectionType.LIST.value);
codegen.processOpts();
final CodegenModel generated = codegen.fromModel("sample", model, Collections.singletonMap("sample", model));
Assert.assertEquals(generated.name, "sample");
Assert.assertEquals(generated.classname, "Sample");
Assert.assertEquals(generated.description, "a sample model");
Assert.assertEquals(generated.vars.size(), 2);
final CodegenProperty property = generated.vars.get(1);
Assert.assertEquals(property.baseName, "examples");
Assert.assertEquals(property.getter, "getExamples");
Assert.assertEquals(property.setter, "setExamples");
Assert.assertEquals(property.dataType, "kotlin.collections.List<kotlin.String>");
Assert.assertEquals(property.name, "examples");
Assert.assertEquals(property.defaultValue, "null");
Assert.assertEquals(property.baseType, "kotlin.collections.List");
Assert.assertEquals(property.containerType, "array");
Assert.assertFalse(property.required);
Assert.assertTrue(property.isContainer);
}
@Test(description = "convert a model with a map property")
public void mapPropertyTest() {
final Schema schema = getMapSchema();

View File

@ -319,13 +319,7 @@ public class RubyClientCodegenTest {
Assert.assertEquals(op.allParams.get(0).pattern, "/^pattern$/");
// pattern_two_slashes '/^pattern$/i'
Assert.assertEquals(op.allParams.get(1).pattern, "/^pattern$/i");
// pattern_one_slash_start '/^pattern$'
Assert.assertEquals(op.allParams.get(2).pattern, "/^pattern$/");
// pattern_one_slash_end '^pattern$/'
Assert.assertEquals(op.allParams.get(3).pattern, "/^pattern$/");
// pattern_one_slash_near_end '^pattern$/im'
Assert.assertEquals(op.allParams.get(4).pattern, "/^pattern$/im");
// pattern_dont_escape_backslash '/^pattern\d{3}$/i' NOTE: the double \ is to escape \ in string but is read as single \
Assert.assertEquals(op.allParams.get(5).pattern, "/^pattern\\d{3}$/i");
Assert.assertEquals(op.allParams.get(2).pattern, "/^pattern\\d{3}$/i");
}
}

View File

@ -25,21 +25,6 @@ paths:
schema:
type: string
pattern: '/^pattern$/i'
- name: pattern_one_slash_start
in: header
schema:
type: string
pattern: '/^pattern$'
- name: pattern_one_slash_end
in: header
schema:
type: string
pattern: '^pattern$/'
- name: pattern_one_slash_near_end
in: header
schema:
type: string
pattern: '^pattern$/im'
- name: pattern_dont_escape_backslash
in: header
schema:

View File

@ -1019,11 +1019,11 @@
</activation>
<modules>
<!-- clients -->
<module>samples/client/petstore/c</module>
<!--<module>samples/client/petstore/c</module>-->
<module>samples/client/petstore/dart-jaguar/openapi</module>
<module>samples/client/petstore/dart-jaguar/flutter_petstore/openapi</module>
<!--<module>samples/client/petstore/dart2/petstore</module>-->
<module>samples/client/petstore/haskell-http-client</module>
<!--<module>samples/client/petstore/dart2/petstore</module>-->
<!--<module>samples/client/petstore/haskell-http-client</module>-->
<module>samples/client/petstore/elm-0.18</module>
<module>samples/client/petstore/groovy</module>
<module>samples/client/petstore/rust</module>

View File

@ -19,7 +19,7 @@ To install the bindings via [Composer](http://getcomposer.org/), add the followi
{
"repositories": [
{
"type": "git",
"type": "vcs",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],

View File

@ -138,7 +138,6 @@ Class | Method | HTTP request | Description
- [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Model.Animal](docs/Animal.md)
- [Model.AnimalFarm](docs/AnimalFarm.md)
- [Model.ApiResponse](docs/ApiResponse.md)
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
@ -169,7 +168,6 @@ Class | Method | HTTP request | Description
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.Return](docs/Return.md)
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.StringBooleanMap](docs/StringBooleanMap.md)
- [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md)

View File

@ -30,7 +30,7 @@ defmodule OpenapiPetstore.Api.AnotherFake do
%{}
|> method(:patch)
|> url("/another-fake/dummy")
|> add_param(:body, :"Client", client)
|> add_param(:body, :body, client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpenapiPetstore.Model.Client{})

View File

@ -137,7 +137,7 @@ defmodule OpenapiPetstore.Api.Fake do
%{}
|> method(:put)
|> url("/fake/body-with-file-schema")
|> add_param(:body, :"FileSchemaTestClass", file_schema_test_class)
|> add_param(:body, :body, file_schema_test_class)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
@ -162,7 +162,7 @@ defmodule OpenapiPetstore.Api.Fake do
|> method(:put)
|> url("/fake/body-with-query-params")
|> add_param(:query, :"query", query)
|> add_param(:body, :"User", user)
|> add_param(:body, :body, user)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
@ -187,7 +187,7 @@ defmodule OpenapiPetstore.Api.Fake do
%{}
|> method(:patch)
|> url("/fake")
|> add_param(:body, :"Client", client)
|> add_param(:body, :body, client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpenapiPetstore.Model.Client{})
@ -345,7 +345,7 @@ defmodule OpenapiPetstore.Api.Fake do
%{}
|> method(:post)
|> url("/fake/inline-additionalProperties")
|> add_param(:body, :"request_body", request_body)
|> add_param(:body, :body, request_body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)

View File

@ -30,7 +30,7 @@ defmodule OpenapiPetstore.Api.FakeClassnameTags123 do
%{}
|> method(:patch)
|> url("/fake_classname_test")
|> add_param(:body, :"Client", client)
|> add_param(:body, :body, client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpenapiPetstore.Model.Client{})

View File

@ -29,7 +29,7 @@ defmodule OpenapiPetstore.Api.Pet do
%{}
|> method(:post)
|> url("/pet")
|> add_param(:body, :"Pet", pet)
|> add_param(:body, :body, pet)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
@ -155,7 +155,7 @@ defmodule OpenapiPetstore.Api.Pet do
%{}
|> method(:put)
|> url("/pet")
|> add_param(:body, :"Pet", pet)
|> add_param(:body, :body, pet)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)

View File

@ -100,7 +100,7 @@ defmodule OpenapiPetstore.Api.Store do
%{}
|> method(:post)
|> url("/store/order")
|> add_param(:body, :"Order", order)
|> add_param(:body, :body, order)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpenapiPetstore.Model.Order{})

View File

@ -30,7 +30,7 @@ defmodule OpenapiPetstore.Api.User do
%{}
|> method(:post)
|> url("/user")
|> add_param(:body, :"User", user)
|> add_param(:body, :body, user)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
@ -54,7 +54,7 @@ defmodule OpenapiPetstore.Api.User do
%{}
|> method(:post)
|> url("/user/createWithArray")
|> add_param(:body, :"User", user)
|> add_param(:body, :body, user)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
@ -78,7 +78,7 @@ defmodule OpenapiPetstore.Api.User do
%{}
|> method(:post)
|> url("/user/createWithList")
|> add_param(:body, :"User", user)
|> add_param(:body, :body, user)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
@ -199,7 +199,7 @@ defmodule OpenapiPetstore.Api.User do
%{}
|> method(:put)
|> url("/user/#{username}")
|> add_param(:body, :"User", user)
|> add_param(:body, :body, user)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.AdditionalPropertiesClass do
]
@type t :: %__MODULE__{
:"map_property" => %{optional(String.t) => String.t},
:"map_of_map_property" => %{optional(String.t) => %{optional(String.t) => String.t}}
:"map_property" => %{optional(String.t) => String.t} | nil,
:"map_of_map_property" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil
}
end

View File

@ -15,7 +15,7 @@ defmodule OpenapiPetstore.Model.Animal do
@type t :: %__MODULE__{
:"className" => String.t,
:"color" => String.t
:"color" => String.t | nil
}
end

View File

@ -15,9 +15,9 @@ defmodule OpenapiPetstore.Model.ApiResponse do
]
@type t :: %__MODULE__{
:"code" => integer(),
:"type" => String.t,
:"message" => String.t
:"code" => integer() | nil,
:"type" => String.t | nil,
:"message" => String.t | nil
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.ArrayOfArrayOfNumberOnly do
]
@type t :: %__MODULE__{
:"ArrayArrayNumber" => [[float()]]
:"ArrayArrayNumber" => [[float()]] | nil
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.ArrayOfNumberOnly do
]
@type t :: %__MODULE__{
:"ArrayNumber" => [float()]
:"ArrayNumber" => [float()] | nil
}
end

View File

@ -15,9 +15,9 @@ defmodule OpenapiPetstore.Model.ArrayTest do
]
@type t :: %__MODULE__{
:"array_of_string" => [String.t],
:"array_array_of_integer" => [[integer()]],
:"array_array_of_model" => [[ReadOnlyFirst]]
:"array_of_string" => [String.t] | nil,
:"array_array_of_integer" => [[integer()]] | nil,
:"array_array_of_model" => [[ReadOnlyFirst]] | nil
}
end

View File

@ -18,12 +18,12 @@ defmodule OpenapiPetstore.Model.Capitalization do
]
@type t :: %__MODULE__{
:"smallCamel" => String.t,
:"CapitalCamel" => String.t,
:"small_Snake" => String.t,
:"Capital_Snake" => String.t,
:"SCA_ETH_Flow_Points" => String.t,
:"ATT_NAME" => String.t
:"smallCamel" => String.t | nil,
:"CapitalCamel" => String.t | nil,
:"small_Snake" => String.t | nil,
:"Capital_Snake" => String.t | nil,
:"SCA_ETH_Flow_Points" => String.t | nil,
:"ATT_NAME" => String.t | nil
}
end

View File

@ -16,8 +16,8 @@ defmodule OpenapiPetstore.Model.Cat do
@type t :: %__MODULE__{
:"className" => String.t,
:"color" => String.t,
:"declawed" => boolean()
:"color" => String.t | nil,
:"declawed" => boolean() | nil
}
end

View File

@ -14,7 +14,7 @@ defmodule OpenapiPetstore.Model.Category do
]
@type t :: %__MODULE__{
:"id" => integer(),
:"id" => integer() | nil,
:"name" => String.t
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.ClassModel do
]
@type t :: %__MODULE__{
:"_class" => String.t
:"_class" => String.t | nil
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.Client do
]
@type t :: %__MODULE__{
:"client" => String.t
:"client" => String.t | nil
}
end

View File

@ -16,8 +16,8 @@ defmodule OpenapiPetstore.Model.Dog do
@type t :: %__MODULE__{
:"className" => String.t,
:"color" => String.t,
:"breed" => String.t
:"color" => String.t | nil,
:"breed" => String.t | nil
}
end

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.EnumArrays do
]
@type t :: %__MODULE__{
:"just_symbol" => String.t,
:"array_enum" => [String.t]
:"just_symbol" => String.t | nil,
:"array_enum" => [String.t] | nil
}
end

View File

@ -17,11 +17,11 @@ defmodule OpenapiPetstore.Model.EnumTest do
]
@type t :: %__MODULE__{
:"enum_string" => String.t,
:"enum_string" => String.t | nil,
:"enum_string_required" => String.t,
:"enum_integer" => integer(),
:"enum_number" => float(),
:"outerEnum" => OuterEnum
:"enum_integer" => integer() | nil,
:"enum_number" => float() | nil,
:"outerEnum" => OuterEnum | nil
}
end

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.FileSchemaTestClass do
]
@type t :: %__MODULE__{
:"file" => File,
:"files" => [File]
:"file" => File | nil,
:"files" => [File] | nil
}
end

View File

@ -25,18 +25,18 @@ defmodule OpenapiPetstore.Model.FormatTest do
]
@type t :: %__MODULE__{
:"integer" => integer(),
:"int32" => integer(),
:"int64" => integer(),
:"integer" => integer() | nil,
:"int32" => integer() | nil,
:"int64" => integer() | nil,
:"number" => float(),
:"float" => float(),
:"double" => float(),
:"string" => String.t,
:"float" => float() | nil,
:"double" => float() | nil,
:"string" => String.t | nil,
:"byte" => binary(),
:"binary" => String.t,
:"binary" => String.t | nil,
:"date" => Date.t,
:"dateTime" => DateTime.t,
:"uuid" => String.t,
:"dateTime" => DateTime.t | nil,
:"uuid" => String.t | nil,
:"password" => String.t
}
end

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.HasOnlyReadOnly do
]
@type t :: %__MODULE__{
:"bar" => String.t,
:"foo" => String.t
:"bar" => String.t | nil,
:"foo" => String.t | nil
}
end

View File

@ -16,10 +16,10 @@ defmodule OpenapiPetstore.Model.MapTest do
]
@type t :: %__MODULE__{
:"map_map_of_string" => %{optional(String.t) => %{optional(String.t) => String.t}},
:"map_of_enum_string" => %{optional(String.t) => String.t},
:"direct_map" => %{optional(String.t) => boolean()},
:"indirect_map" => %{optional(String.t) => boolean()}
:"map_map_of_string" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil,
:"map_of_enum_string" => %{optional(String.t) => String.t} | nil,
:"direct_map" => %{optional(String.t) => boolean()} | nil,
:"indirect_map" => %{optional(String.t) => boolean()} | nil
}
end

View File

@ -15,9 +15,9 @@ defmodule OpenapiPetstore.Model.MixedPropertiesAndAdditionalPropertiesClass do
]
@type t :: %__MODULE__{
:"uuid" => String.t,
:"dateTime" => DateTime.t,
:"map" => %{optional(String.t) => Animal}
:"uuid" => String.t | nil,
:"dateTime" => DateTime.t | nil,
:"map" => %{optional(String.t) => Animal} | nil
}
end

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.Model200Response do
]
@type t :: %__MODULE__{
:"name" => integer(),
:"class" => String.t
:"name" => integer() | nil,
:"class" => String.t | nil
}
end

View File

@ -17,9 +17,9 @@ defmodule OpenapiPetstore.Model.Name do
@type t :: %__MODULE__{
:"name" => integer(),
:"snake_case" => integer(),
:"property" => String.t,
:"123Number" => integer()
:"snake_case" => integer() | nil,
:"property" => String.t | nil,
:"123Number" => integer() | nil
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.NumberOnly do
]
@type t :: %__MODULE__{
:"JustNumber" => float()
:"JustNumber" => float() | nil
}
end

View File

@ -18,12 +18,12 @@ defmodule OpenapiPetstore.Model.Order do
]
@type t :: %__MODULE__{
:"id" => integer(),
:"petId" => integer(),
:"quantity" => integer(),
:"shipDate" => DateTime.t,
:"status" => String.t,
:"complete" => boolean()
:"id" => integer() | nil,
:"petId" => integer() | nil,
:"quantity" => integer() | nil,
:"shipDate" => DateTime.t | nil,
:"status" => String.t | nil,
:"complete" => boolean() | nil
}
end

View File

@ -15,9 +15,9 @@ defmodule OpenapiPetstore.Model.OuterComposite do
]
@type t :: %__MODULE__{
:"my_number" => float(),
:"my_string" => String.t,
:"my_boolean" => boolean()
:"my_number" => float() | nil,
:"my_string" => String.t | nil,
:"my_boolean" => boolean() | nil
}
end

View File

@ -18,12 +18,12 @@ defmodule OpenapiPetstore.Model.Pet do
]
@type t :: %__MODULE__{
:"id" => integer(),
:"category" => Category,
:"id" => integer() | nil,
:"category" => Category | nil,
:"name" => String.t,
:"photoUrls" => [String.t],
:"tags" => [Tag],
:"status" => String.t
:"tags" => [Tag] | nil,
:"status" => String.t | nil
}
end

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.ReadOnlyFirst do
]
@type t :: %__MODULE__{
:"bar" => String.t,
:"baz" => String.t
:"bar" => String.t | nil,
:"baz" => String.t | nil
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.Return do
]
@type t :: %__MODULE__{
:"return" => integer()
:"return" => integer() | nil
}
end

View File

@ -13,7 +13,7 @@ defmodule OpenapiPetstore.Model.SpecialModelName do
]
@type t :: %__MODULE__{
:"$special[property.name]" => integer()
:"$special[property.name]" => integer() | nil
}
end

View File

@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.Tag do
]
@type t :: %__MODULE__{
:"id" => integer(),
:"name" => String.t
:"id" => integer() | nil,
:"name" => String.t | nil
}
end

View File

@ -20,14 +20,14 @@ defmodule OpenapiPetstore.Model.User do
]
@type t :: %__MODULE__{
:"id" => integer(),
:"username" => String.t,
:"firstName" => String.t,
:"lastName" => String.t,
:"email" => String.t,
:"password" => String.t,
:"phone" => String.t,
:"userStatus" => integer()
:"id" => integer() | nil,
:"username" => String.t | nil,
:"firstName" => String.t | nil,
:"lastName" => String.t | nil,
:"email" => String.t | nil,
:"password" => String.t | nil,
:"phone" => String.t | nil,
:"userStatus" => integer() | nil
}
end

View File

@ -88,6 +88,10 @@ defmodule OpenapiPetstore.RequestBuilder do
|> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)
|> Map.update!(:body, &(Tesla.Multipart.add_field(&1, key, Poison.encode!(value), headers: [{:"Content-Type", "application/json"}])))
end
def add_param(request, :headers, key, value) do
request
|> Map.update(:headers, %{key => value}, &(Map.put(&1, key, value)))
end
def add_param(request, :file, name, path) do
request
|> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)

View File

@ -71,7 +71,6 @@ Class | Method | HTTP request | Description
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Animal](docs/Animal.md)
- [AnimalFarm](docs/AnimalFarm.md)
- [ApiResponse](docs/ApiResponse.md)
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
@ -102,7 +101,6 @@ Class | Method | HTTP request | Description
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Return](docs/Return.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [StringBooleanMap](docs/StringBooleanMap.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)

View File

@ -1,9 +0,0 @@
# AnimalFarm
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,9 +0,0 @@
# StringBooleanMap
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,13 +0,0 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package petstore
type AnimalFarm struct {
}

View File

@ -1,13 +0,0 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package petstore
type StringBooleanMap struct {
}

View File

@ -278,34 +278,6 @@ mkAnimal animalClassName =
, animalColor = Nothing
}
-- ** AnimalFarm
-- | AnimalFarm
data AnimalFarm = AnimalFarm
{
} deriving (P.Show, P.Eq, P.Typeable)
-- | FromJSON AnimalFarm
instance A.FromJSON AnimalFarm where
parseJSON = A.withObject "AnimalFarm" $ \o ->
pure AnimalFarm
-- | ToJSON AnimalFarm
instance A.ToJSON AnimalFarm where
toJSON AnimalFarm =
_omitNulls
[
]
-- | Construct a value of type 'AnimalFarm' (by applying it's required fields, if any)
mkAnimalFarm
:: AnimalFarm
mkAnimalFarm =
AnimalFarm
{
}
-- ** ApiResponse
-- | ApiResponse
data ApiResponse = ApiResponse
@ -1326,34 +1298,6 @@ mkSpecialModelName =
{ specialModelNameSpecialPropertyName = Nothing
}
-- ** StringBooleanMap
-- | StringBooleanMap
data StringBooleanMap = StringBooleanMap
{
} deriving (P.Show, P.Eq, P.Typeable)
-- | FromJSON StringBooleanMap
instance A.FromJSON StringBooleanMap where
parseJSON = A.withObject "StringBooleanMap" $ \o ->
pure StringBooleanMap
-- | ToJSON StringBooleanMap
instance A.ToJSON StringBooleanMap where
toJSON StringBooleanMap =
_omitNulls
[
]
-- | Construct a value of type 'StringBooleanMap' (by applying it's required fields, if any)
mkStringBooleanMap
:: StringBooleanMap
mkStringBooleanMap =
StringBooleanMap
{
}
-- ** Tag
-- | Tag
data Tag = Tag

View File

@ -64,10 +64,6 @@ animalColorL f Animal{..} = (\animalColor -> Animal { animalColor, ..} ) <$> f a
-- * AnimalFarm
-- * ApiResponse
-- | 'apiResponseCode' Lens
@ -603,10 +599,6 @@ specialModelNameSpecialPropertyNameL f SpecialModelName{..} = (\specialModelName
-- * StringBooleanMap
-- * Tag
-- | 'tagId' Lens

View File

@ -101,11 +101,6 @@ instance Arbitrary Animal where
<$> arbitrary -- animalClassName :: Text
<*> arbitrary -- animalColor :: Maybe Text
instance Arbitrary AnimalFarm where
arbitrary =
pure AnimalFarm
instance Arbitrary ApiResponse where
arbitrary =
ApiResponse
@ -301,11 +296,6 @@ instance Arbitrary SpecialModelName where
SpecialModelName
<$> arbitrary -- specialModelNameSpecialPropertyName :: Maybe Integer
instance Arbitrary StringBooleanMap where
arbitrary =
pure StringBooleanMap
instance Arbitrary Tag where
arbitrary =
Tag

View File

@ -22,7 +22,6 @@ main =
pure ()
propMimeEq MimeJSON (Proxy :: Proxy AdditionalPropertiesClass)
propMimeEq MimeJSON (Proxy :: Proxy Animal)
propMimeEq MimeJSON (Proxy :: Proxy AnimalFarm)
propMimeEq MimeJSON (Proxy :: Proxy ApiResponse)
propMimeEq MimeJSON (Proxy :: Proxy ArrayOfArrayOfNumberOnly)
propMimeEq MimeJSON (Proxy :: Proxy ArrayOfNumberOnly)
@ -53,7 +52,6 @@ main =
propMimeEq MimeJSON (Proxy :: Proxy Pet)
propMimeEq MimeJSON (Proxy :: Proxy ReadOnlyFirst)
propMimeEq MimeJSON (Proxy :: Proxy SpecialModelName)
propMimeEq MimeJSON (Proxy :: Proxy StringBooleanMap)
propMimeEq MimeJSON (Proxy :: Proxy Tag)
propMimeEq MimeJSON (Proxy :: Proxy User)

View File

@ -1,66 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,66 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,66 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,66 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import org.apache.commons.lang3.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return ObjectUtils.hashCodeMulti(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,64 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import org.apache.commons.lang3.ObjectUtils;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return ObjectUtils.hashCodeMulti(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,66 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,66 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -1,65 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -470,7 +470,7 @@ No authorization required
<a name="testGroupParameters"></a>
# **testGroupParameters**
> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group)
> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute();
Fake endpoint to test group parameters (optional)
@ -491,7 +491,11 @@ Integer stringGroup = 56; // Integer | String in group parameters
Boolean booleanGroup = true; // Boolean | Boolean in group parameters
Long int64Group = 56L; // Long | Integer in group parameters
try {
apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group)
.stringGroup(stringGroup)
.booleanGroup(booleanGroup)
.int64Group(int64Group)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testGroupParameters");
e.printStackTrace();

View File

@ -1305,20 +1305,7 @@ public class FakeApi {
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for testGroupParameters
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
private com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -1406,52 +1393,13 @@ public class FakeApi {
}
/**
* Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
}
/**
* Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
com.squareup.okhttp.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, null);
return apiClient.execute(call);
}
/**
* Fake endpoint to test group parameters (optional) (asynchronously)
* Fake endpoint to test group parameters (optional)
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback<Void> callback) throws ApiException {
private com.squareup.okhttp.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
@ -1476,6 +1424,101 @@ public class FakeApi {
apiClient.executeAsync(call, callback);
return call;
}
public class APItestGroupParametersRequest {
private final Integer requiredStringGroup;
private final Boolean requiredBooleanGroup;
private final Long requiredInt64Group;
private Integer stringGroup;
private Boolean booleanGroup;
private Long int64Group;
private APItestGroupParametersRequest(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group) {
this.requiredStringGroup = requiredStringGroup;
this.requiredBooleanGroup = requiredBooleanGroup;
this.requiredInt64Group = requiredInt64Group;
}
/**
* Set stringGroup
* @param stringGroup String in group parameters (optional)
* @return APItestGroupParametersRequest
*/
public APItestGroupParametersRequest stringGroup(Integer stringGroup) {
this.stringGroup = stringGroup;
return this;
}
/**
* Set booleanGroup
* @param booleanGroup Boolean in group parameters (optional)
* @return APItestGroupParametersRequest
*/
public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) {
this.booleanGroup = booleanGroup;
return this;
}
/**
* Set int64Group
* @param int64Group Integer in group parameters (optional)
* @return APItestGroupParametersRequest
*/
public APItestGroupParametersRequest int64Group(Long int64Group) {
this.int64Group = int64Group;
return this;
}
/**
* Build call for testGroupParameters
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener);
}
/**
* Execute testGroupParameters request
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void execute() throws ApiException {
testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
}
/**
* Execute testGroupParameters request with HTTP info returned
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> executeWithHttpInfo() throws ApiException {
return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
}
/**
* Execute testGroupParameters request (asynchronously)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call executeAsync(final ApiCallback<Void> callback) throws ApiException {
return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, callback);
}
}
/**
* Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @return APItestGroupParametersRequest
*/
public APItestGroupParametersRequest testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group) {
return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group);
}
/**
* Build call for testInlineAdditionalProperties
* @param requestBody request body (required)

View File

@ -1,94 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
import android.os.Parcelable;
import android.os.Parcel;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> implements Parcelable {
public AnimalFarm() {
super();
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public void writeToParcel(Parcel out, int flags) {
out.writeList(this);
}
AnimalFarm(Parcel in) {
in.readTypedList(this, Animal.CREATOR);
}
public int describeContents() {
return 0;
}
public static final Parcelable.Creator<AnimalFarm> CREATOR = new Parcelable.Creator<AnimalFarm>() {
public AnimalFarm createFromParcel(Parcel in) {
AnimalFarm result = new AnimalFarm();
result.addAll(in.readArrayList(Animal.class.getClassLoader()));
return result;
}
public AnimalFarm[] newArray(int size) {
return new AnimalFarm[size];
}
};
}

View File

@ -1,91 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 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.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> implements Parcelable {
public StringBooleanMap() {
super();
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
}
StringBooleanMap(Parcel in) {
super(in);
}
public int describeContents() {
return 0;
}
public static final Parcelable.Creator<StringBooleanMap> CREATOR = new Parcelable.Creator<StringBooleanMap>() {
public StringBooleanMap createFromParcel(Parcel in) {
return new StringBooleanMap(in);
}
public StringBooleanMap[] newArray(int size) {
return new StringBooleanMap[size];
}
};
}

Some files were not shown because too many files have changed in this diff Show More