Compare commits

..

36 Commits

Author SHA1 Message Date
William Cheng
4e511d9c99 test py libs with experimental 2020-09-28 09:59:45 +08:00
William Cheng
7a98580f45 Merge branch 'master' of https://github.com/openapitools/openapi-generator 2020-09-28 09:35:24 +08:00
William Cheng
b72d5ca81e comment out php test to fix travis failure 2020-09-28 09:29:36 +08:00
henryh-force
ec815ca33a [Apex] better handling of different content-type in the response (#7515)
* PR7500

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-09-27 21:10:14 +08:00
Dalibor Karlović
2c59f1dc8c [php] Small tweaks for php generator (#7376) 2020-09-27 12:42:51 +03:00
Grigory Entin
a5ee2e0454 [Swift5] Fixed spelling for promise. (#7516) 2020-09-27 16:13:21 +08:00
Jim Schubert
cb4b03fcf3 [Core, HTML2] Rendered docs are incomplete (#7510)
Co-authored-by: Malachi Jones <malachi.jones@metaswitch.com>
2020-09-25 09:07:18 -04:00
Hui Yu
f608803a40 [C][Client]Support data callback function (#7467) 2020-09-25 20:34:17 +08:00
翠 / green
9ace82ae14 [typescript-axios] replace optional chaining (#7476)
To avoid requiring TypeScript above 3.7.2.
refs #7455
2020-09-25 14:27:29 +02:00
翠 / green
5472943134 [typescript-axios] fix refining query (#7475) 2020-09-25 14:01:04 +02:00
Ghufran Zahidi
d6bfecf2ef [powershell] Updated the Api doc with httpsiging script snippet. (#7499)
* Added the httpsigning code snippet for api doc

* Updated the sample

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-09-25 16:54:14 +08:00
Hippolyte HENRY
9ba943318a [go][client] Fix API docs example generation (#7489)
* [go][client] Fix API docs example

* Generate samples
2020-09-25 14:45:18 +08:00
Jim Schubert
f3fbc7d782 [ci][test] Fix samples (#7509) 2020-09-24 23:42:04 -04:00
Marvin1912
5f3d974a08 [bug][Java] Honor instantiationMap for default values for array, map, set (#4982)
Co-authored-by: Jim Schubert <james.schubert@gmail.com>
2020-09-24 23:25:13 -04:00
Aidan Hobson Sayers
9778d970ac Fix stringifying of ~= (#7460)
Fixes #4069
2020-09-25 10:48:57 +08:00
William Cheng
5dffbabc74 minor formatting change (#7503) 2020-09-25 10:16:26 +08:00
Hippolyte HENRY
7b1563326a [ruby] Fix generation when generateAliasAsModel is enabled (#7419) 2020-09-24 22:08:57 -04:00
Jim Schubert
49760f7a34 [sonar][ci] Fixes some new recommended "bug" fixes found via Sonar (#7508) 2020-09-24 22:02:11 -04:00
William Cheng
596bbb9c58 Add option to set recursion limit (#7491)
* add option to set recursion limit

* fix test failure

* update doc

* add tests

* add missing import

* rename option to recursionLimit
2020-09-24 11:47:22 -07:00
William Cheng
29ca272a95 regenerate java pkmst petstore samples (#7502) 2020-09-25 00:25:23 +08:00
William Cheng
5ebf26e0d2 fix issue without http signature auth (#7504) 2020-09-24 23:56:50 +08:00
Jiri Kuncar
bc799b2488 [ruby] Support for per-operation servers (#7415)
* Support server configuration per operation

* regenerated+tests

* base_url fix

* support not templated urls

* revert update of ruby docs
2020-09-24 11:21:43 -04:00
William Cheng
7dd4fd1d98 Add a link to react native tutorial (#7505)
Add a link to react native tutorial
2020-09-24 22:24:56 +08:00
Thomas Beckmann
bdc964a6c1 update of Objective-C model-body.mustache to support discriminator.mappedModels (#7471)
Co-authored-by: Thomas Beckmann <thomas.beckmann@mway.io>
2020-09-24 17:44:14 +08:00
William Cheng
6612c16624 update samples 2020-09-24 16:37:20 +08:00
Jim Schubert
874c2a19d8 [ci] Sonar bug fixes (#7497)
* Fixing java:S3599 - Avoid double brace initializer

Because Double Brace Initialization (DBI) creates an anonymous class with a
reference to the instance of the owning object, its use can lead to memory
leaks if the anonymous inner class is returned and held by other objects. Even
when there's no leak, DBI is so obscure that it's bound to confuse most
maintainers.

* Fix incorrect List.contains typed check

* Avoid potential NPE in DefaultCodegen

* [fsharp] Remove unused boolean and log

* Fix potential NPE in Haskell http client

* Fix potential bugs in JavaCXFExtServerCodegen, found by static analysis
2020-09-24 00:20:40 -04:00
Ghufran Zahidi
94ed8187f9 fixed the backslash issue (#7492) 2020-09-24 10:07:19 +08:00
Ghufran Zahidi
56c9f0dc1e Fix the range check condition (#7482) 2020-09-24 10:02:04 +08:00
Jim Schubert
6e937ba9f9 [batch] Option to clean files before generation (#7465) 2020-09-23 08:50:23 -04:00
Jim Schubert
1716ee3154 [java][groovy] Fix mangled src paths in outputs on Windows (#7487) 2020-09-23 00:03:37 -04:00
William Cheng
d2aabc5f80 remove haskell stack installation in shippable ci (#7481) 2020-09-23 11:49:03 +08:00
William Cheng
8c78f13a41 remove hardcoded PetApi (#7483) 2020-09-22 11:45:29 -07:00
William Cheng
04b39cc86b remove SWGApiResponse.m (not used) (#7478) 2020-09-22 22:34:48 +08:00
William Cheng
2157d526e1 update samples 2020-09-22 20:45:22 +08:00
翠 / green
a5fcb17416 [typescript-axios] support "x-enum-descriptions" (#7477)
refs #1693 #1752
2020-09-22 12:55:09 +02:00
William Cheng
96bba3769b switch to another spec with more oneOf def (#7470) 2020-09-22 08:50:57 +08:00
633 changed files with 49752 additions and 15578 deletions

View File

@@ -777,6 +777,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2020-08-25 - [OpenAPI Generator と TypeScript で型安全にフロントエンド開発をしている話](https://tech.smarthr.jp/entry/2020/08/25/135631) at [SmartHR Tech Blog](https://tech.smarthr.jp/)
- 2020-09-10 - [Introduction to OpenAPI with Instana](https://www.instana.com/blog/introduction-to-openapi-with-instana/) by [Cedric Ziel](https://www.instana.com/blog/author/cedricziel/) at [Instana Blog](https://www.instana.com/blog/)
- 2020-09-17 - [Generate PowerShellSDK using openapi-generator](https://medium.com/@ghufz.learn/generate-powershellsdk-using-openapi-generator-33b700891e33) by [Ghufran Zahidi](https://medium.com/@ghufz.learn)
- 2020-09-24 - [How to automate API code generation (OpenAPI/Swagger) and boost productivity - Tutorial with React Native featuring TypeScript](https://medium.com/@sceleski/how-to-automate-api-code-generation-openapi-swagger-and-boost-productivity-1176a0056d8a) by [Sanjin Celeski](https://medium.com/@sceleski)
## [6 - About Us](#table-of-contents)

View File

@@ -1,6 +1,7 @@
# for .net standard
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,6 +1,6 @@
generatorName: dart
outputDir: samples/client/petstore/dart2/petstore_client_lib
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart2
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,4 +1,4 @@
generatorName: python
generatorName: python-experimental
outputDir: samples/client/petstore/python-asyncio
library: asyncio
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

View File

@@ -4,3 +4,4 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/python-experimental/
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
recursionLimit: "1234"

View File

@@ -1,4 +1,4 @@
generatorName: python
generatorName: python-experimental
outputDir: samples/client/petstore/python-tornado
library: tornado
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

View File

@@ -0,0 +1,9 @@
generatorName: ruby
outputDir: samples/openapi3/client/features/dynamic-servers/ruby/
inputSpec: modules/openapi-generator/src/test/resources/3_0/features/dynamic-servers.yaml
templateDir: modules/openapi-generator/src/main/resources/ruby-client
additionalProperties:
gemVersion: 1.0.0
moduleName: DynamicServers
gemName: dynamic_servers
skipFormModel: "true"

View File

@@ -0,0 +1,12 @@
generatorName: ruby
outputDir: samples/openapi3/client/features/generate-alias-as-model/ruby-client/
library: typhoeus
inputSpec: modules/openapi-generator/src/test/resources/3_0/features/generate-alias-as-model.yaml
templateDir: modules/openapi-generator/src/main/resources/ruby-client
additionalProperties:
gemVersion: 1.0.0
moduleName: Petstore
gemName: petstore
skipFormModel: "true"
strictSpecBehavior: false
generateAliasAsModel: true

View File

@@ -11,6 +11,7 @@ if [ ! -f "$executable" ]; then
fi
export JAVA_OPTS="${JAVA_OPTS} -ea -server -Duser.timezone=UTC"
export BATCH_OPTS="${BATCH_OPTS:-}"
files=()
args=()
@@ -61,6 +62,6 @@ else
# shellcheck disable=SC2086
# shellcheck disable=SC2068
java ${JAVA_OPTS} -jar "$executable" batch --includes-base-dir "${root}" --fail-fast -- ${files[@]}
java ${JAVA_OPTS} -jar "$executable" batch ${BATCH_OPTS} --includes-base-dir "${root}" --fail-fast -- ${files[@]}
fi

View File

@@ -12,6 +12,7 @@ sidebar_label: python-experimental
|packageUrl|python package URL.| |null|
|packageVersion|python package version.| |1.0.0|
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|useNose|use the nose test framework| |false|
## IMPORT MAPPING

View File

@@ -12,6 +12,7 @@ sidebar_label: python
|packageUrl|python package URL.| |null|
|packageVersion|python package version.| |1.0.0|
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|useNose|use the nose test framework| |false|

View File

@@ -34,6 +34,9 @@ sidebar_label: ruby-on-rails
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
|map|Hash|
|set|Set|
## LANGUAGE PRIMITIVES

View File

@@ -33,6 +33,9 @@ sidebar_label: ruby-sinatra
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
|map|Hash|
|set|Set|
## LANGUAGE PRIMITIVES

View File

@@ -35,6 +35,9 @@ sidebar_label: ruby
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
|map|Hash|
|set|Set|
## LANGUAGE PRIMITIVES

View File

@@ -34,6 +34,7 @@ import com.fasterxml.jackson.databind.util.TokenBuffer;
import io.airlift.airline.Arguments;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenConfig;
@@ -46,6 +47,7 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -77,6 +79,9 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
@Option(name = {"--fail-fast"}, description = "fail fast on any errors")
private Boolean failFast;
@Option(name = {"--clean"}, description = "clean output of previously written files before generation")
private Boolean clean;
@Option(name = {"--timeout"}, description = "execution timeout (minutes)")
private Integer timeout;
@@ -149,7 +154,10 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
ExecutorService executor = Executors.newFixedThreadPool(numThreads);
// Execute each configurator on a separate pooled thread.
configurators.forEach(configurator -> executor.execute(new GenerationRunner(configurator, rootDir, Boolean.TRUE.equals(failFast))));
configurators.forEach(configurator -> {
GenerationRunner runner = new GenerationRunner(configurator, rootDir, Boolean.TRUE.equals(failFast), Boolean.TRUE.equals(clean));
executor.execute(runner);
});
executor.shutdown();
@@ -178,11 +186,13 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
private final CodegenConfigurator configurator;
private final Path rootDir;
private final boolean exitOnError;
private final boolean clean;
private GenerationRunner(CodegenConfigurator configurator, Path rootDir, boolean failFast) {
private GenerationRunner(CodegenConfigurator configurator, Path rootDir, boolean failFast, boolean clean) {
this.configurator = configurator;
this.rootDir = rootDir;
this.exitOnError = failFast;
this.clean = clean;
}
/**
@@ -198,7 +208,7 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
*/
@Override
public void run() {
String name = "";
String name = null;
try {
GlobalSettings.reset();
@@ -210,6 +220,10 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
Path updated = rootDir.resolve(target);
config.setOutputDir(updated.toString());
if (this.clean) {
cleanPreviousFiles(name, updated);
}
System.out.printf(Locale.ROOT, "[%s] Generating %s (outputs to %s)…%n", Thread.currentThread().getName(), name, updated.toString());
DefaultGenerator defaultGenerator = new DefaultGenerator();
@@ -234,6 +248,28 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
GlobalSettings.reset();
}
}
private void cleanPreviousFiles(final String name, Path outDir) throws IOException {
System.out.printf(Locale.ROOT, "[%s] Cleaning previous contents for %s in %s…%n", Thread.currentThread().getName(), name, outDir.toString());
Path filesMeta = Paths.get(outDir.toAbsolutePath().toString(), ".openapi-generator", "FILES");
if (filesMeta.toFile().exists()) {
FileUtils.readLines(filesMeta.toFile(), StandardCharsets.UTF_8).forEach(relativePath -> {
if (!StringUtils.startsWith(relativePath, ".")) {
Path file = outDir.resolve(relativePath).toAbsolutePath();
// hack: disallow directory traversal outside of output directory. we don't want to delete wrong files.
if (file.toString().startsWith(outDir.toAbsolutePath().toString())) {
try {
Files.delete(file);
} catch (Throwable e) {
System.out.printf(Locale.ROOT, "[%s] Generator %s failed to clean file %s…%n", Thread.currentThread().getName(), name, file);
}
}
} else {
System.out.printf(Locale.ROOT, "[%s] Generator %s skip cleaning special filename %s…%n", Thread.currentThread().getName(), name, relativePath);
}
});
}
}
}
static SimpleModule getCustomDeserializationModel(final File includesDir) {

View File

@@ -394,19 +394,17 @@ public class DefaultCodegen implements CodegenConfig {
if (this.useOneOfInterfaces) {
// First, add newly created oneOf interfaces
for (CodegenModel cm : addOneOfInterfaces) {
Map<String, Object> modelValue = new HashMap<String, Object>() {{
putAll(additionalProperties());
put("model", cm);
}};
Map<String, Object> modelValue = new HashMap<>(additionalProperties());
modelValue.put("model", cm);
List<Object> modelsValue = Arrays.asList(modelValue);
List<Map<String, String>> importsValue = new ArrayList<Map<String, String>>();
Map<String, Object> objsValue = new HashMap<String, Object>() {{
put("models", modelsValue);
put("package", modelPackage());
put("imports", importsValue);
put("classname", cm.classname);
putAll(additionalProperties);
}};
Map<String, Object> objsValue = new HashMap<>();
objsValue.put("models", modelsValue);
objsValue.put("package", modelPackage());
objsValue.put("imports", importsValue);
objsValue.put("classname", cm.classname);
objsValue.putAll(additionalProperties);
objs.put(cm.name, objsValue);
}
@@ -1578,6 +1576,7 @@ public class DefaultCodegen implements CodegenConfig {
specialCharReplacements.put("<=", "Less_Than_Or_Equal_To");
specialCharReplacements.put(">=", "Greater_Than_Or_Equal_To");
specialCharReplacements.put("!=", "Not_Equal");
specialCharReplacements.put("~=", "Tilde_Equal");
}
/**
@@ -2704,7 +2703,8 @@ public class DefaultCodegen implements CodegenConfig {
if (foundDisc != null) {
return foundDisc;
}
if (!!this.getLegacyDiscriminatorBehavior()) {
if (this.getLegacyDiscriminatorBehavior()) {
return null;
}
Discriminator disc = new Discriminator();
@@ -2742,7 +2742,7 @@ public class DefaultCodegen implements CodegenConfig {
throw new RuntimeException("The oneOf schemas have conflicting discriminator property names. " +
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
}
if ((hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
disc.setPropertyName(foundDisc.getPropertyName());
disc.setMapping(foundDisc.getMapping());
return disc;
@@ -2771,7 +2771,7 @@ public class DefaultCodegen implements CodegenConfig {
throw new RuntimeException("The anyOf schemas have conflicting discriminator property names. " +
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
}
if ((hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
disc.setPropertyName(foundDisc.getPropertyName());
disc.setMapping(foundDisc.getMapping());
return disc;
@@ -2860,8 +2860,12 @@ public class DefaultCodegen implements CodegenConfig {
List<MappedModel> descendentSchemas = new ArrayList();
Map<String, Schema> schemas = ModelUtils.getSchemas(openAPI);
String currentSchemaName = thisSchemaName;
while (true) {
for (String childName : schemas.keySet()) {
Set<String> keys = schemas.keySet();
int count = 0;
// hack: avoid infinite loop on potential self-references in event our checks fail.
while (100000 > count++) {
for (String childName : keys) {
if (childName.equals(thisSchemaName)) {
continue;
}
@@ -2879,8 +2883,8 @@ public class DefaultCodegen implements CodegenConfig {
continue;
}
String parentName = ModelUtils.getSimpleRef(ref);
if (parentName.equals(currentSchemaName)) {
if (queue.contains(childName) || descendentSchemas.contains(childName)) {
if (parentName != null && parentName.equals(currentSchemaName)) {
if (queue.contains(childName) || descendentSchemas.stream().anyMatch(i -> childName.equals(i.getMappingName()))) {
throw new RuntimeException("Stack overflow hit when looking for " + thisSchemaName + " an infinite loop starting and ending at " + childName + " was seen");
}
queue.add(childName);
@@ -3600,7 +3604,10 @@ public class DefaultCodegen implements CodegenConfig {
op.hasReference = schemas != null && schemas.containsKey(op.returnBaseType);
// lookup discriminator
Schema schema = schemas.get(op.returnBaseType);
Schema schema = null;
if (schemas != null) {
schema = schemas.get(op.returnBaseType);
}
if (schema != null) {
CodegenModel cmod = fromModel(op.returnBaseType, schema);
op.discriminator = cmod.discriminator;

View File

@@ -85,7 +85,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected String licenseUrl = "http://unlicense.org";
protected String projectFolder = "src/main";
protected String projectTestFolder = "src/test";
protected String sourceFolder = projectFolder + File.separator + "java";
// this must not be OS-specific
protected String sourceFolder = projectFolder + "/java";
protected String testFolder = projectTestFolder + "/java";
protected boolean fullJavaUtil;
protected boolean discriminatorCaseSensitive = true; // True if the discriminator value lookup should be case-sensitive.
@@ -806,17 +807,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
if (ModelUtils.isArraySchema(schema)) {
final String pattern;
if (ModelUtils.isSet(schema)) {
if (fullJavaUtil) {
pattern = "new java.util.LinkedHashSet<%s>()";
} else {
pattern = "new LinkedHashSet<%s>()";
}
String mapInstantiationType = instantiationTypes().getOrDefault("set", "LinkedHashSet");
pattern = "new " + mapInstantiationType + "<%s>()";
} else {
if (fullJavaUtil) {
pattern = "new java.util.ArrayList<%s>()";
} else {
pattern = "new ArrayList<%s>()";
}
String arrInstantiationType = instantiationTypes().getOrDefault("array", "ArrayList");
pattern = "new " + arrInstantiationType + "<%s>()";
}
Schema<?> items = getSchemaItems((ArraySchema) schema);
@@ -839,12 +834,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
return null;
}
final String pattern;
if (fullJavaUtil) {
pattern = "new java.util.HashMap<%s>()";
} else {
pattern = "new HashMap<%s>()";
}
String mapInstantiationType = instantiationTypes().getOrDefault("map", "HashMap");
final String pattern = "new " + mapInstantiationType + "<%s>()";
if (getAdditionalProperties(schema) == null) {
return null;
}

View File

@@ -86,6 +86,10 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
typeMapping.put("ByteArray", "String");
typeMapping.put("UUID", "String");
typeMapping.put("URI", "String");
instantiationTypes.put("map", "Hash");
instantiationTypes.put("array", "Array");
instantiationTypes.put("set", "Set");
}
@Override
@@ -118,6 +122,22 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
return super.getTypeDeclaration(schema);
}
@Override
public String toInstantiationType(Schema schema) {
if (ModelUtils.isMapSchema(schema)) {
return instantiationTypes.get("map");
} else if (ModelUtils.isArraySchema(schema)) {
String parentType;
if (ModelUtils.isSet(schema)) {
parentType = "set";
} else {
parentType = "array";
}
return instantiationTypes.get(parentType);
}
return super.toInstantiationType(schema);
}
@Override
public String toDefaultValue(Schema p) {
if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) {

View File

@@ -176,7 +176,6 @@ public class FsharpGiraffeServerCodegen extends AbstractFSharpCodegen {
@Override
public void processOpts() {
super.processOpts();
boolean isLibrary = false;
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_GUID)) {
setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID));
@@ -191,10 +190,6 @@ public class FsharpGiraffeServerCodegen extends AbstractFSharpCodegen {
additionalProperties.put(PROJECT_SDK, projectSdk);
// TODO - should we be supporting a Giraffe class library?
if (isLibrary)
LOGGER.warn("Library flag not currently supported.");
String authFolder = sourceFolder + File.separator + "auth";
String implFolder = sourceFolder + File.separator + "impl";
String helperFolder = sourceFolder + File.separator + "helpers";

View File

@@ -60,7 +60,8 @@ public class GroovyClientCodegen extends AbstractJavaCodegen {
languageSpecificPrimitives.add("File");
languageSpecificPrimitives.add("Map");
sourceFolder = projectFolder + File.separator +"groovy";
// this must not be OS-specific
sourceFolder = projectFolder + "/groovy";
outputFolder = "generated-code/groovy";
modelTemplateFiles.put("model.mustache", ".groovy");
apiTemplateFiles.put("api.mustache", ".groovy");

View File

@@ -1274,9 +1274,11 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
if (dataType == null && cm.isArrayModel) { // isAlias + arrayModelType missing "datatype"
dataType = "[" + cm.arrayModelType + "]";
}
cm.vendorExtensions.put(VENDOR_EXTENSION_X_DATA_TYPE, dataType);
if (dataType.equals("Maybe A.Value")) {
cm.vendorExtensions.put(VENDOR_EXTENSION_X_IS_MAYBE_VALUE, true);
if (dataType != null) {
cm.vendorExtensions.put(VENDOR_EXTENSION_X_DATA_TYPE, dataType);
if (dataType.equals("Maybe A.Value")) {
cm.vendorExtensions.put(VENDOR_EXTENSION_X_IS_MAYBE_VALUE, true);
}
}
}
for (CodegenProperty var : cm.vars) {

View File

@@ -282,7 +282,7 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
return f;
});
private static final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000;
private static final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000L;
private static final long MIN_DATE;
@@ -551,10 +551,13 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
short inclusiveMax = (short) (var == null || !var.exclusiveMaximum ? 1 : 0);
byte randomByte = (byte) (min + exclusiveMin + ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile)
var.addTestData(randomByte);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomByte);
}
} else {
buffer.append(String.format(Locale.getDefault(), "(byte)%0#2x", randomByte));
}
}
}
@@ -568,10 +571,13 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
char inclusiveMax = (char) (var == null || !var.exclusiveMaximum ? 1 : 0);
char randomChar = (char) (min + exclusiveMin + ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile)
var.addTestData(randomChar);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomChar);
}
} else {
buffer.append(String.format(Locale.getDefault(), "'%c'", randomChar));
}
}
}
@@ -607,24 +613,26 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
BigDecimal exclusiveMinLong = new BigDecimal(var != null && var.exclusiveMinimum ? 1 : 0);
BigDecimal inclusiveMaxLong = new BigDecimal(var == null || !var.exclusiveMaximum ? 1 : 0);
long randomDateLong = minLong.add(exclusiveMinLong).add(maxLong.add(inclusiveMaxLong).subtract(minLong)
.subtract(exclusiveMinLong).multiply(new BigDecimal(Math.random()))).longValue();
.subtract(exclusiveMinLong).multiply(BigDecimal.valueOf(Math.random()))).longValue();
// If it's just a date without a time, round downwards to the nearest day.
if ("date".equals(var.dataFormat))
if (var != null && "date".equals(var.dataFormat))
randomDateLong = (randomDateLong % MILLIS_PER_DAY) * MILLIS_PER_DAY;
// NOTE: By default Jackson serializes Date as long milliseconds since epoch date, but that conflicts with
// the OpenAPI 2.0/3.0 specs, which mandates the ISO-8601 full-date or date-time formats. Accordingly, date
// and date-time fields are annotated with @JsonFormat to specify the appropriate ISO format.
if (loadTestDataFromFile) {
Date randomDate = new Date(randomDateLong);
switch (var.dataFormat) {
case "date":
var.addTestData(ISO8601_DATE_FORMAT.get().format(randomDate));
break;
case "date-time":
var.addTestData(ISO8601_DATETIME_FORMAT.get().format(randomDate));
break;
if (var != null) {
Date randomDate = new Date(randomDateLong);
switch (var.dataFormat) {
case "date":
var.addTestData(ISO8601_DATE_FORMAT.get().format(randomDate));
break;
case "date-time":
var.addTestData(ISO8601_DATETIME_FORMAT.get().format(randomDate));
break;
}
}
} else {
buffer.append("new Date(").append(randomDateLong).append(')');
@@ -635,19 +643,20 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
private void appendRandomDouble(StringBuilder buffer, CodegenOperation op, CodegenVariable var) {
if (!appendRandomEnum(buffer, op, var)) {
// NOTE: use BigDecimal to hold double values, to avoid numeric overflow.
BigDecimal min = new BigDecimal(
var == null || var.minimum == null ? Long.MIN_VALUE : Double.parseDouble(var.minimum));
BigDecimal max = new BigDecimal(
var == null || var.maximum == null ? Long.MAX_VALUE : Double.parseDouble(var.maximum));
BigDecimal min = BigDecimal.valueOf(var == null || var.minimum == null ? Long.MIN_VALUE : Double.parseDouble(var.minimum));
BigDecimal max = BigDecimal.valueOf(var == null || var.maximum == null ? Long.MAX_VALUE : Double.parseDouble(var.maximum));
BigDecimal exclusiveMin = new BigDecimal(var != null && var.exclusiveMinimum ? 1 : 0);
BigDecimal inclusiveMax = new BigDecimal(var == null || !var.exclusiveMaximum ? 1 : 0);
BigDecimal randomBigDecimal = min.add(exclusiveMin).add(max.add(inclusiveMax).subtract(min)
.subtract(exclusiveMin).multiply(new BigDecimal(String.valueOf(Math.random()))));
if (loadTestDataFromFile)
var.addTestData(randomBigDecimal);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomBigDecimal);
}
} else {
buffer.append(randomBigDecimal.toString()).append('D');
}
}
}
@@ -704,10 +713,13 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
float randomFloat = (float) (min + exclusiveMin
+ ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile)
var.addTestData(randomFloat);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomFloat);
}
} else {
buffer.append(String.format(Locale.getDefault(), "%g", randomFloat)).append('F');
}
}
}
@@ -720,10 +732,13 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
long inclusiveMax = var == null || !var.exclusiveMaximum ? 1 : 0;
int randomInt = (int) (min + exclusiveMin + ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile)
var.addTestData(randomInt);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomInt);
}
} else {
buffer.append(randomInt);
}
}
}
@@ -737,13 +752,16 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
BigDecimal exclusiveMin = new BigDecimal(var != null && var.exclusiveMinimum ? 1 : 0);
BigDecimal inclusiveMax = new BigDecimal(var == null || !var.exclusiveMaximum ? 1 : 0);
long randomLong = min.add(exclusiveMin).add(
max.add(inclusiveMax).subtract(min).subtract(exclusiveMin).multiply(new BigDecimal(Math.random())))
max.add(inclusiveMax).subtract(min).subtract(exclusiveMin).multiply(BigDecimal.valueOf(Math.random())))
.longValue();
if (loadTestDataFromFile)
var.addTestData(randomLong);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomLong);
}
} else {
buffer.append(randomLong).append('L');
}
}
}
@@ -757,10 +775,13 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
short randomShort = (short) (min + exclusiveMin
+ ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile)
var.addTestData(randomShort);
else
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomShort);
}
} else {
buffer.append(String.format(Locale.getDefault(), "(short)%d", randomShort));
}
}
}
@@ -769,7 +790,9 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
String randomString = generateRandomString(var);
if (loadTestDataFromFile) {
var.addTestData(randomString);
if (var != null) {
var.addTestData(randomString);
}
} else {
buffer.append('"').append(randomString).append('"');
}
@@ -1375,13 +1398,15 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
break;
}
}
supportingFiles.remove(supportingFile);
SupportingFile updated = new SupportingFile(
supportingFile.getTemplateFile(),
supportingFile.getFolder(),
"ApplicationContext-" + invokerPackage + ".xml"
);
supportingFiles.add(updated);
if (supportingFile != null) {
supportingFiles.remove(supportingFile);
SupportingFile updated = new SupportingFile(
supportingFile.getTemplateFile(),
supportingFile.getFolder(),
"ApplicationContext-" + invokerPackage + ".xml"
);
supportingFiles.add(updated);
}
}
}
}

View File

@@ -818,11 +818,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
}
if (addImports) {
Map<String, String> imports2Classnames = new HashMap<String, String>() {{
put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable");
put("NoSuchElementException", "java.util.NoSuchElementException");
put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore");
}};
Map<String, String> imports2Classnames = new HashMap<>();
imports2Classnames.put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable");
imports2Classnames.put("NoSuchElementException", "java.util.NoSuchElementException");
imports2Classnames.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore");
for (Map.Entry<String, String> entry : imports2Classnames.entrySet()) {
cm.imports.add(entry.getKey());
Map<String, String> importsItem = new HashMap<String, String>();
@@ -976,9 +976,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen
@Override
public void addImportsToOneOfInterface(List<Map<String, String>> imports) {
for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo")) {
Map<String, String> oneImport = new HashMap<String, String>() {{
put("import", importMapping.get(i));
}};
Map<String, String> oneImport = new HashMap<>();
oneImport.put("import", importMapping.get(i));
if (!imports.contains(oneImport)) {
imports.add(oneImport);
}

View File

@@ -701,7 +701,6 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
StringEscapeUtils.escapeJava(input)
.replace("\\/", "/"))
.replaceAll("[\\t\\n\\r]", " ")
.replace("\\", "\\\\")
.replace("\"", "\"\""));
}

View File

@@ -43,6 +43,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String DEFAULT_LIBRARY = "urllib3";
// nose is a python testing framework, we use pytest if USE_NOSE is unset
public static final String USE_NOSE = "useNose";
public static final String RECURSION_LIMIT = "recursionLimit";
protected String packageName = "openapi_client";
protected String packageVersion = "1.0.0";
@@ -184,6 +185,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework").
defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(RECURSION_LIMIT, "Set the recursion limit. If not set, use the system default value."));
supportedLibraries.put("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)");
@@ -253,6 +255,15 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
setUseNose((String) additionalProperties.get(USE_NOSE));
}
// check to see if setRecursionLimit is set and whether it's an integer
if (additionalProperties.containsKey(RECURSION_LIMIT)) {
try {
Integer.parseInt((String)additionalProperties.get(RECURSION_LIMIT));
} catch(NumberFormatException | NullPointerException e) {
throw new IllegalArgumentException("recursionLimit must be an integer, e.g. 2000.");
}
}
String readmePath = "README.md";
String readmeTemplate = "README.mustache";
if (generateSourceCodeOnly) {

View File

@@ -83,7 +83,9 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
GlobalFeature.XMLStructureDefinitions,
GlobalFeature.Callbacks,
GlobalFeature.LinkObjects,
GlobalFeature.ParameterStyling
GlobalFeature.ParameterStyling,
GlobalFeature.ParameterizedServer,
GlobalFeature.MultiServer
)
.includeSchemaSupportFeatures(
SchemaSupportFeature.Polymorphism

View File

@@ -40,10 +40,10 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URL;
import java.util.*;
import java.util.regex.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -260,10 +260,10 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
if (StringUtils.isEmpty(System.getenv("RUST_POST_PROCESS_FILE"))) {
LOGGER.info("Environment variable RUST_POST_PROCESS_FILE not defined. rustfmt will be used" +
" by default. To choose a different tool, try" +
" 'export RUST_POST_PROCESS_FILE=\"/usr/local/bin/rustfmt\"' (Linux/Mac)");
" by default. To choose a different tool, try" +
" 'export RUST_POST_PROCESS_FILE=\"/usr/local/bin/rustfmt\"' (Linux/Mac)");
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` " +
" (--enable-post-process-file for CLI).");
" (--enable-post-process-file for CLI).");
}
if (!Boolean.TRUE.equals(ModelUtils.isGenerateAliasAsModel())) {
@@ -311,7 +311,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
}
/**
* Configures a friendly name for the generator. This will be used by the generator
* Configures a friendly name for the generator. This will be used by the generator
* to select the library with the -g flag.
*
* @return the friendly name for the generator
@@ -329,7 +329,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
*/
@Override
public String getHelp() {
return "Generates a Rust client/server library (beta) using the swagger-codegen project.";
return "Generates a Rust client/server library (beta) using the openapi-generator project.";
}
@Override
@@ -557,14 +557,14 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
private boolean isMimetypeXml(String mimetype) {
return mimetype.toLowerCase(Locale.ROOT).startsWith(xmlMimeType) ||
mimetype.toLowerCase(Locale.ROOT).startsWith(problemXmlMimeType) ||
mimetype.toLowerCase(Locale.ROOT).startsWith(textXmlMimeType);
mimetype.toLowerCase(Locale.ROOT).startsWith(problemXmlMimeType) ||
mimetype.toLowerCase(Locale.ROOT).startsWith(textXmlMimeType);
}
private boolean isMimetypeJson(String mimetype) {
return mimetype.toLowerCase(Locale.ROOT).startsWith(jsonMimeType) ||
mimetype.toLowerCase(Locale.ROOT).startsWith(mergePatchJsonMimeType) ||
mimetype.toLowerCase(Locale.ROOT).startsWith(problemJsonMimeType);
mimetype.toLowerCase(Locale.ROOT).startsWith(mergePatchJsonMimeType) ||
mimetype.toLowerCase(Locale.ROOT).startsWith(problemJsonMimeType);
}
private boolean isMimetypeWwwFormUrlEncoded(String mimetype) {
@@ -592,11 +592,11 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
*/
boolean isMimetypePlain(String mimetype) {
boolean result = !(isMimetypeUnknown(mimetype) ||
isMimetypeXml(mimetype) ||
isMimetypeJson(mimetype) ||
isMimetypeWwwFormUrlEncoded(mimetype) ||
isMimetypeMultipartFormData(mimetype) ||
isMimetypeMultipartRelated(mimetype));
isMimetypeXml(mimetype) ||
isMimetypeJson(mimetype) ||
isMimetypeWwwFormUrlEncoded(mimetype) ||
isMimetypeMultipartFormData(mimetype) ||
isMimetypeMultipartRelated(mimetype));
return result;
}
@@ -635,9 +635,9 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// The callback API is logically distinct from the main API, so
// it uses a separate path set map.
if (op.isCallbackRequest) {
pathSetMap = this.callbacksPathSetMap;
pathSetMap = this.callbacksPathSetMap;
} else {
pathSetMap = this.pathSetMap;
pathSetMap = this.pathSetMap;
}
while (pathSetMap.containsKey(pathId)) {
@@ -735,7 +735,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
op.vendorExtensions.put("x-operation-id", underscoredOperationId);
op.vendorExtensions.put("x-uppercase-operation-id", underscoredOperationId.toUpperCase(Locale.ROOT));
String vendorExtensionPath = op.path.replace("{", ":").replace("}", "");
op.vendorExtensions.put("x-path",vendorExtensionPath);
op.vendorExtensions.put("x-path", vendorExtensionPath);
op.vendorExtensions.put("x-path-id", pathId);
op.vendorExtensions.put("x-has-path-params", hasPathParams);
op.vendorExtensions.put("x-path-format-string", formatPath);
@@ -744,8 +744,8 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
op.vendorExtensions.put("x-http-method", vendorExtensionHttpMethod);
if (!op.vendorExtensions.containsKey("x-must-use-response")) {
// If there's more than one response, than by default the user must explicitly handle them
op.vendorExtensions.put("x-must-use-response", op.responses.size() > 1);
// If there's more than one response, than by default the user must explicitly handle them
op.vendorExtensions.put("x-must-use-response", op.responses.size() > 1);
}
for (CodegenParameter param : op.allParams) {
@@ -1300,23 +1300,23 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// If we have callbacks, add the callbacks module, otherwise remove it
boolean hasCallbacks = haveCallbacks(bundle);
bundle.put("hasCallbacks", hasCallbacks);
SupportingFile[] callbackFiles = new SupportingFile[] {
new SupportingFile("client-callbacks.mustache", "src/client", "callbacks.rs"),
new SupportingFile("server-callbacks.mustache", "src/server", "callbacks.rs"),
new SupportingFile("example-client-server.mustache", "examples/client", "server.rs")
SupportingFile[] callbackFiles = new SupportingFile[]{
new SupportingFile("client-callbacks.mustache", "src/client", "callbacks.rs"),
new SupportingFile("server-callbacks.mustache", "src/server", "callbacks.rs"),
new SupportingFile("example-client-server.mustache", "examples/client", "server.rs")
};
for (SupportingFile callbackFile : callbackFiles) {
if (hasCallbacks) {
supportingFiles.add(callbackFile);
} else {
supportingFiles.remove(callbackFile);
}
if (hasCallbacks) {
supportingFiles.add(callbackFile);
} else {
supportingFiles.remove(callbackFile);
}
}
if (hasCallbacks) {
Map<String, Object> callbackData = new HashMap();
addPathSetMapToBundle(callbacksPathSetMap, callbackData);
bundle.put("callbacks", callbackData);
Map<String, Object> callbackData = new HashMap();
addPathSetMapToBundle(callbacksPathSetMap, callbackData);
bundle.put("callbacks", callbackData);
}
return super.postProcessSupportingFileData(bundle);
@@ -1326,7 +1326,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
* Add a built path set map to the provided bundle
*
* @param pathSetMap A previously built path set map
* @param bundle Bundle for the supporting files to add the data to.
* @param bundle Bundle for the supporting files to add the data to.
*/
private static void addPathSetMapToBundle(Map<String, Map<String, String>> pathSetMap, Map<String, Object> bundle) {
// We previously built a mapping from path to path ID and regular
@@ -1544,9 +1544,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// the user than the alternative.
LOGGER.warn("Ignoring additionalProperties (see https://github.com/OpenAPITools/openapi-generator/issues/318) alongside defined properties");
cm.dataType = null;
}
else
{
} else {
cm.dataType = "std::collections::HashMap<String, " + cm.additionalPropertiesType + ">";
}
} else if (cm.dataType != null) {
@@ -1635,7 +1633,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// only process files with .rs extension
if ("rs".equals(FilenameUtils.getExtension(file.toString()))) {
try {
Process p = Runtime.getRuntime().exec(new String[] {commandPrefix, file.toString()});
Process p = Runtime.getRuntime().exec(new String[]{commandPrefix, file.toString()});
int exitValue = p.waitFor();
if (exitValue != 0) {
LOGGER.error("Error running the command ({} {}). Exit code: {}", commandPrefix, file.toString(), exitValue);

View File

@@ -16,6 +16,8 @@
package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.servers.Server;
@@ -269,25 +271,23 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
return baseObjs;
}
private static Set<String> primitiveParamTypes = new HashSet<String>() {{
addAll(Arrays.asList(
"Int",
"Long",
"Float",
"Double",
"Boolean",
"String"
));
}};
private static final Set<String> primitiveParamTypes = ImmutableSet.of(
"Int",
"Long",
"Float",
"Double",
"Boolean",
"String"
);
private static Map<String, String> pathTypeToMatcher = new HashMap<String, String>() {{
put("Int", "IntNumber");
put("Long", "LongNumber");
put("Float", "FloatNumber");
put("Double", "DoubleNumber");
put("Boolean", "Boolean");
put("String", "Segment");
}};
private static final Map<String, String> pathTypeToMatcher = ImmutableMap.<String,String>builder()
.put("Int", "IntNumber")
.put("Long", "LongNumber")
.put("Float", "FloatNumber")
.put("Double", "DoubleNumber")
.put("Boolean", "Boolean")
.put("String", "Segment")
.build();
protected static void addPathMatcher(CodegenOperation codegenOperation) {
LinkedList<String> allPaths = new LinkedList<>(Arrays.asList(codegenOperation.path.split("/")));

View File

@@ -172,18 +172,20 @@ public class ModelUtils {
childrenMap = tmpChildrenMap;
List<String> unusedSchemas = new ArrayList<String>();
Map<String, Schema> schemas = getSchemas(openAPI);
unusedSchemas.addAll(schemas.keySet());
if (openAPI != null) {
Map<String, Schema> schemas = getSchemas(openAPI);
unusedSchemas.addAll(schemas.keySet());
visitOpenAPI(openAPI, (s, t) -> {
if (s.get$ref() != null) {
String ref = getSimpleRef(s.get$ref());
unusedSchemas.remove(ref);
if (childrenMap.containsKey(ref)) {
unusedSchemas.removeAll(childrenMap.get(ref));
visitOpenAPI(openAPI, (s, t) -> {
if (s.get$ref() != null) {
String ref = getSimpleRef(s.get$ref());
unusedSchemas.remove(ref);
if (childrenMap.containsKey(ref)) {
unusedSchemas.removeAll(childrenMap.get(ref));
}
}
}
});
});
}
return unusedSchemas;
}

View File

@@ -13,6 +13,7 @@ apiClient_t *apiClient_create() {
apiClient->sslConfig = NULL;
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->response_code = 0;
{{#hasAuthMethods}}
{{#authMethods}}
@@ -58,6 +59,7 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->response_code = 0;
{{#hasAuthMethods}}
{{#authMethods}}
@@ -91,6 +93,7 @@ void apiClient_free(apiClient_t *apiClient) {
if(apiClient->basePath) {
free(apiClient->basePath);
}
apiClient->data_callback_func = NULL;
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
@@ -558,6 +561,10 @@ size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
apiClient->dataReceived = (char *)realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
memcpy(apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
apiClient->dataReceivedLen += size_this_time;
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
if (apiClient->data_callback_func) {
apiClient->data_callback_func(&apiClient->dataReceived, &apiClient->dataReceivedLen);
}
return size_this_time;
}

View File

@@ -23,6 +23,7 @@ typedef struct apiClient_t {
sslConfig_t *sslConfig;
void *dataReceived;
long dataReceivedLen;
void (*data_callback_func)(void **, long *);
long response_code;
{{#hasAuthMethods}}
{{#authMethods}}

View File

@@ -183,3 +183,18 @@ char* findStrInStrList(list_t *strList, const char *str)
return NULL;
}
void clear_and_free_string_list(list_t *list)
{
if (!list) {
return;
}
listEntry_t *listEntry = NULL;
list_ForEach(listEntry, list) {
char *list_item = listEntry->data;
free(list_item);
list_item = NULL;
}
list_free(list);
}

View File

@@ -38,4 +38,5 @@ void listEntry_printAsInt(listEntry_t* listEntry, void *additionalData);
void listEntry_free(listEntry_t *listEntry, void *additionalData);
char* findStrInStrList(list_t* strList, const char* str);
void clear_and_free_string_list(list_t * list);
#endif // INCLUDE_LIST_H

View File

@@ -183,7 +183,7 @@ public class OAS {
@TestVisible
protected virtual Object toReturnValue(String body, Type returnType, String contentType) {
if (contentType == 'application/json') {
if (contentType.contains('application/json')) {
Object o = returnType.newInstance();
if (o instanceof MappedProperties) {
Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings();

View File

@@ -92,11 +92,13 @@ namespace {{packageName}}.Client
/// <value>The servers</value>
private IList<IReadOnlyDictionary<string, object>> _servers;
{{/servers.0}}
{{#hasHttpSignatureMethods}}
/// <summary>
/// HTTPSigning configuration
/// </summary>
private HTTPSigningConfiguration _HTTPSigningConfiguration = null;
{{/hasHttpSignatureMethods}}
#endregion Private Members
#region Constructors
@@ -467,6 +469,7 @@ namespace {{packageName}}.Client
return url;
}
{{/servers.0}}
{{#hasHttpSignatureMethods}}
/// <summary>
/// Gets and Sets the HTTPSigningConfiuration
@@ -476,6 +479,7 @@ namespace {{packageName}}.Client
get { return _HTTPSigningConfiguration; }
set { _HTTPSigningConfiguration = value; }
}
{{/hasHttpSignatureMethods}}
#endregion Properties
@@ -553,9 +557,11 @@ namespace {{packageName}}.Client
Username = second.Username ?? first.Username,
Password = second.Password ?? first.Password,
AccessToken = second.AccessToken ?? first.AccessToken,
{{#hasHttpSignatureMethods}}
HTTPSigningConfiguration = second.HTTPSigningConfiguration ?? first.HTTPSigningConfiguration,
{{/hasHttpSignatureMethods}}
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
HTTPSigningConfiguration = second.HTTPSigningConfiguration ?? first.HTTPSigningConfiguration
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat
};
return config;
}

View File

@@ -96,10 +96,12 @@ namespace {{packageName}}.Client
/// </summary>
/// <value>X509 Certificate collection.</value>
X509CertificateCollection ClientCertificates { get; }
{{#hasHttpSignatureMethods}}
/// <summary>
/// Gets the HTTPSigning configuration
/// </summary>
HTTPSigningConfiguration HTTPSigningConfiguration { get; }
{{/hasHttpSignatureMethods}}
}
}

View File

@@ -107,12 +107,6 @@ class {{classname}} {
{{/complexType}}
{{/isDate}}
{{/isDateTime}}
{{#required}}
{{^isNullable}}
if ({{name}} == null)
throw ArgumentError("$json has no {{name}} field which is required for {{classname}}");
{{/isNullable}}
{{/required}}
{{/vars}}
}

View File

@@ -1,36 +0,0 @@
class {{classname}} {
/// Can be {{#oneOf}}[{{{.}}}], {{/oneOf}}
dynamic _instance;
// default constructor
{{classname}}();
set instance(dynamic instance) {
if (!(instance == null{{#oneOf}} || instance is {{{.}}}{{/oneOf}}))
throw ArgumentError("${instance.runtimeType} is not a valid type for {{classname}}");
_instance = instance;
}
dynamic get instance => _instance;
@override
String toString() {
return _instance.toString();
}
{{classname}}.fromJson(Map<String, dynamic> json) {
if (json == null) return;
// TODO primitives, lists, maps
{{#oneOf}}
try {
_instance = {{{.}}}.fromJson(json);
} on ArgumentError {
}
{{/oneOf}}
}
Map<String, dynamic> toJson() {
// TODO primitives, lists, maps
return _instance.toJson();
}
}

View File

@@ -2,18 +2,11 @@ part of {{pubName}}.api;
{{#models}}
{{#model}}
{{#oneOf}}
{{#-first}}
{{>class_oneof}}
{{/-first}}
{{/oneOf}}
{{^oneOf}}
{{#isEnum}}
{{>enum}}
{{/isEnum}}
{{^isEnum}}
{{>class}}
{{/isEnum}}
{{/oneOf}}
{{/model}}
{{/models}}

View File

@@ -39,7 +39,7 @@ func main() {
configuration := {{goImportAlias}}.NewConfiguration()
api_client := {{goImportAlias}}.NewAPIClient(configuration)
resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(), {{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{{vendorExtensions.x-export-param-name}}}({{{paramName}}}){{/optionalParams}}.Execute()
resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(){{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `{{classname}}.{{operationId}}``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)

View File

@@ -103,29 +103,34 @@
});
function findNode(id, currentNode) {
return (Object.keys(currentNode)[0] === id) ? currentNode : findNodeInChildren(id, currentNode);
}
var currentChild,
result;
function findNodeInChildren(id, currentNode) {
for (let prop in currentNode) {
if (currentNode.hasOwnProperty(prop)) {
let currentChild = currentNode[prop];
if (id === prop) {
return currentChild;
} else {
// Search in the current child
if (typeof (currentChild) === 'object') {
let result = findNode(id, currentChild);
if (result !== false) {
return result;
if ( Object.keys(currentNode)[0] == id) {
return currentNode;
} else {
// Use a for loop instead of forEach to avoid nested functions
// Otherwise "return" will not work properly
for(var propt in currentNode){
if (currentNode.hasOwnProperty(propt)) {
currentChild = currentNode[propt]
if (id == propt) {
return currentChild;
} else {
// Search in the current child
if (typeof(currentChild) === 'object') {
result = findNode(id, currentChild);
if (result != false) {
return result;
}
}
}
}
}
// The node has not been found and we have no more options
return false;
}
return false;
}
</script>
<style type="text/css">
{{>fonts}}
@@ -447,7 +452,7 @@
var schemaWrapper = {{{jsonSchema}}};
var schema = findNode('schema',schemaWrapper).schema;
if (!schema) {
schema = schemaWrapper.schema;
schema = schemaWrapper.schema;
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);

View File

@@ -4,9 +4,10 @@
<script>
$(document).ready(function() {
var schemaWrapper = {{{jsonSchema}}};
var schema = findNode('schema', schemaWrapper).schema;
var schema = findNode('schema',schemaWrapper).schema;
if (!schema) {
schema = schemaWrapper.schema;
schema = schemaWrapper.schema;
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);

View File

@@ -27,9 +27,19 @@
if(discriminatedClassName == nil ){
return [super initWithDictionary:dict error:err];
}
Class class = NSClassFromString([@"{{classPrefix}}" stringByAppendingString:discriminatedClassName]);
if(!class) {
class = NSClassFromString([@"{{classPrefix}}" stringByAppendingString:[discriminatedClassName capitalizedString]]);
Class class = nil;
{{#discriminator.mappedModels}}
if ([discriminatedClassName isEqualToString:@"{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"]) {
class = NSClassFromString(@"{{modelName}}");
}
else
{{/discriminator.mappedModels}}
{
class = NSClassFromString([@"{{classPrefix}}" stringByAppendingString:discriminatedClassName]);
if(!class) {
class = NSClassFromString([@"{{classPrefix}}" stringByAppendingString:[discriminatedClassName capitalizedString]]);
}
}
if([self class ] == class) {
return [super initWithDictionary:dict error:err];

View File

@@ -34,7 +34,7 @@ class ApiException extends Exception
/**
* The HTTP body of the server response either as Json or string.
*
* @var mixed
* @var \stdClass|string|null
*/
protected $responseBody;
@@ -48,17 +48,17 @@ class ApiException extends Exception
/**
* The deserialized response object
*
* @var $responseObject;
* @var \stdClass|string|null
*/
protected $responseObject;
/**
* Constructor
*
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
*/
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
{
@@ -80,7 +80,7 @@ class ApiException extends Exception
/**
* Gets the HTTP body of the server response either as Json or string
*
* @return mixed HTTP body of the server response either as \stdClass or string
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
{

View File

@@ -29,6 +29,9 @@ namespace {{invokerPackage}};
*/
class Configuration
{
/**
* @var Configuration
*/
private static $defaultConfiguration;
/**
@@ -128,7 +131,7 @@ class Configuration
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return string API key or token
* @return null|string API key or token
*/
public function getApiKey($apiKeyIdentifier)
{
@@ -154,7 +157,7 @@ class Configuration
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return string
* @return null|string
*/
public function getApiKeyPrefix($apiKeyIdentifier)
{
@@ -400,7 +403,7 @@ class Configuration
*
* @param string $apiKeyIdentifier name of apikey
*
* @return string API key with the prefix
* @return null|string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
{
@@ -423,7 +426,7 @@ class Configuration
/**
* Returns an array of host settings
*
* @return an array of host settings
* @return array an array of host settings
*/
public function getHostSettings()
{
@@ -461,9 +464,9 @@ class Configuration
/**
* Returns URL based on the index and variables
*
* @param index array index of the host settings
* @param variables hash of variable and the corresponding value (optional)
* @return URL based on host settings
* @param int $index index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public function getHostFromSettings($index, $variables = null)
{

View File

@@ -66,7 +66,7 @@ class HeaderSelector
*
* @param string[] $accept Array of header
*
* @return string Accept (e.g. application/json)
* @return null|string Accept (e.g. application/json)
*/
private function selectAcceptHeader($accept)
{

View File

@@ -51,20 +51,26 @@ class ObjectSerializer
* @param string $type the OpenAPIToolsType of the data
* @param string $format the format of the OpenAPITools type of the data
*
* @return string|object serialized form of $data
* @return scalar|object|array|null serialized form of $data
*/
public static function sanitizeForSerialization($data, $type = null, $format = null)
{
if (is_scalar($data) || null === $data) {
return $data;
} elseif ($data instanceof \DateTime) {
}
if ($data instanceof \DateTime) {
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
} elseif (is_array($data)) {
}
if (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
}
return $data;
} elseif (is_object($data)) {
}
if (is_object($data)) {
$values = [];
if ($data instanceof ModelInterface) {
$formats = $data::openAPIFormats();
@@ -250,7 +256,9 @@ class ObjectSerializer
{
if (null === $data) {
return null;
} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
}
if (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
if (!is_array($data)) {
@@ -263,7 +271,9 @@ class ObjectSerializer
$values[] = self::deserialize($value, $subClass, null);
}
return $values;
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
}
if (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
$data = is_string($data) ? json_decode($data) : $data;
settype($data, 'array');
$inner = substr($class, 4, -1);
@@ -276,10 +286,14 @@ class ObjectSerializer
}
}
return $deserialized;
} elseif ($class === 'object') {
}
if ($class === 'object') {
settype($data, 'array');
return $data;
} elseif ($class === '\DateTime') {
}
if ($class === '\DateTime') {
// Some API's return an invalid, empty string as a
// date-time property. DateTime::__construct() will return
// the current time for empty input which is probably not
@@ -291,10 +305,14 @@ class ObjectSerializer
} else {
return null;
}
} elseif (in_array($class, [{{&primitives}}], true)) {
}
if (in_array($class, [{{&primitives}}], true)) {
settype($data, $class);
return $data;
} elseif ($class === '\SplFileObject') {
}
if ($class === '\SplFileObject') {
/** @var \Psr\Http\Message\StreamInterface $data */
// determine file name

View File

@@ -80,17 +80,17 @@ use {{invokerPackage}}\ObjectSerializer;
/**
* Set the host index
*
* @param int Host index (required)
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($host_index)
public function setHostIndex($hostIndex)
{
$this->hostIndex = $host_index;
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return Host index
* @return int Host index
*/
public function getHostIndex()
{

View File

@@ -16,7 +16,7 @@
* Please update the test case below to test the endpoint.
*/
namespace {{invokerPackage}};
namespace {{invokerPackage}}\Test\Api;
use \{{invokerPackage}}\Configuration;
use \{{invokerPackage}}\ApiException;
@@ -71,6 +71,8 @@ use PHPUnit\Framework\TestCase;
*/
public function test{{vendorExtensions.x-test-operation-id}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{/operation}}
}

View File

@@ -36,6 +36,6 @@
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }
},
"autoload-dev": {
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" }
"psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" }
}
}

View File

@@ -38,6 +38,11 @@ use \{{invokerPackage}}\ObjectSerializer;
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
{{^isEnum}}
* @implements \ArrayAccess<TKey, TValue>
* @template TKey int|null
* @template TValue mixed|null
{{/isEnum}}
*/
{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}}
{{/model}}{{/models}}

View File

@@ -1,6 +1,6 @@
class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess{{/parentSchema}}
{
const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
/**
* The original name of the model.
@@ -23,6 +23,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{#hasMore}},
@@ -161,7 +163,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
{{/parentSchema}}
{{#vars}}
$this->container['{{name}}'] = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}};
$this->container['{{name}}'] = $data['{{name}}'] ?? {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}};
{{/vars}}
{{#discriminator}}
@@ -278,7 +280,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
*
* @param {{dataType}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}}
*
* @return $this
* @return self
*/
public function {{setter}}(${{name}})
{
@@ -362,18 +364,18 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
*
* @param integer $offset Offset
*
* @return mixed
* @return mixed|null
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
return isset($this->container[$offset]) ?? null;
}
/**
* Sets value based on offset.
*
* @param integer $offset Offset
* @param mixed $value Value to be set
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/

View File

@@ -19,7 +19,7 @@
* Please update the test case below to test the model.
*/
namespace {{invokerPackage}};
namespace {{invokerPackage}}\Test\Model;
use PHPUnit\Framework\TestCase;
@@ -68,6 +68,8 @@ class {{classname}}Test extends TestCase
*/
public function test{{classname}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{#vars}}
@@ -76,6 +78,8 @@ class {{classname}}Test extends TestCase
*/
public function testProperty{{nameInCamelCase}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{/vars}}
}

View File

@@ -54,7 +54,7 @@ To install and run `Pester`, please execute the following commands in the termin
```powershell
Install-module -name Pester -force
Invoker-Pester
Invoke-Pester
```
For troubleshooting, please run `$DebugPreference = 'Continue'` to turn on debugging and disable it with `$DebugPreference = 'SilentlyContinue'` when done with the troubleshooting.

View File

@@ -43,6 +43,18 @@ $Configuration["ApiKey"]["{{{keyParamName}}}"] = "YOUR_API_KEY"
# Configure OAuth2 access token for authorization: {{{name}}}
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";
{{/isOAuth}}
{{#isHttpSignature}}
# Configure HttpSignature for authorization :{{name}}
$httpSigningParams = @{
KeyId = "xxxxxx1776876789ac747/xxxxxxx564612d31a62c01/xxxxxxxa1d7564612d31a66ee8"
KeyFilePath = "C:\SecretKey.txt"
HttpSigningHeader = @("(request-target)","Host","Date","Digest")
HashAlgorithm = "sha256"
}
Set-{{{packageName}}}ConfigurationHttpSigning @httpSigningParams
{{/isHttpSignature}}
{{/authMethods}}
{{/hasAuthMethods}}
@@ -54,7 +66,7 @@ ${{paramName}} = {{{vendorExtensions.x-powershell-example}}} # {{{dataType}}} |
# {{{.}}}
{{/summary}}
try {
{{#returnType}}{{returnType}} $Result = {{/returnType}}{{{vendorExtensions.x-powershell-method-name}}}{{#allParams}} -{{paramName}} ${{paramName}}{{/allParams}}
$Result = {{{vendorExtensions.x-powershell-method-name}}}{{#allParams}} -{{paramName}} ${{paramName}}{{/allParams}}
} catch {
Write-Host ("Exception occured when calling {{{vendorExtensions.x-powershell-method-name}}}: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
@@ -69,7 +81,7 @@ Name | Type | Description | Notes
{{/allParams}}
### Return type
# cmdlet returns PSCustomObject, the return object contains the properties of below type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
### Authorization

View File

@@ -12,7 +12,7 @@ Name | Type | Description | Notes
- Prepare the resource
```powershell
Initialize-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#hasMore}} `
${{{classname}}} = Initialize-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#hasMore}} `
{{/hasMore}}
{{/vars}}
@@ -20,7 +20,7 @@ Initialize-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#ha
- Convert the resource to JSON
```powershell
${{className}} | Convert-ToJSON
${{{classname}}} | ConvertTo-JSON
```
[[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

@@ -93,13 +93,13 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
{{/minLength}}
{{#maximum}}
if ({{^required}}!${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMaximum}}-ge{{/exclusiveMaximum}}{{^exclusiveMaximum}}-gt{{/exclusiveMaximum}} {{{maximum}}}) {
if ({{^required}}${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMaximum}}-ge{{/exclusiveMaximum}}{{^exclusiveMaximum}}-gt{{/exclusiveMaximum}} {{{maximum}}}) {
throw "invalid value for '{{{name}}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}."
}
{{/maximum}}
{{#minimum}}
if ({{^required}}!${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMinimum}}-le{{/exclusiveMinimum}}{{^exclusiveMinimum}}-lt{{/exclusiveMinimum}} {{{minimum}}}) {
if ({{^required}}${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMinimum}}-le{{/exclusiveMinimum}}{{^exclusiveMinimum}}-lt{{/exclusiveMinimum}} {{{minimum}}}) {
throw "invalid value for '{{{name}}}', must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}."
}
@@ -153,13 +153,13 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
{{/minLength}}
{{#maximum}}
if ({{^required}}!${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMaximum}}-ge{{/exclusiveMaximum}}{{^exclusiveMaximum}}-gt{{/exclusiveMaximum}} {{{maximum}}}) {
if ({{^required}}${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMaximum}}-ge{{/exclusiveMaximum}}{{^exclusiveMaximum}}-gt{{/exclusiveMaximum}} {{{maximum}}}) {
throw "invalid value for '{{{name}}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}."
}
{{/maximum}}
{{#minimum}}
if ({{^required}}!${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMinimum}}-le{{/exclusiveMinimum}}{{^exclusiveMinimum}}-lt{{/exclusiveMinimum}} {{{minimum}}}) {
if ({{^required}}${{{name}}} -and {{/required}}${{{name}}} {{#exclusiveMinimum}}-le{{/exclusiveMinimum}}{{^exclusiveMinimum}}-lt{{/exclusiveMinimum}} {{{minimum}}}) {
throw "invalid value for '{{{name}}}', must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}."
}

View File

@@ -23,3 +23,7 @@ from {{packageName}}.exceptions import ApiException
# import models into sdk package
{{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}
{{/model}}{{/models}}
{{#recursionLimit}}
__import__('sys').setrecursionlimit({{{.}}})
{{/recursionLimit}}

View File

@@ -1,3 +1,9 @@
{{#apiInfo}}
{{#apis}}
{{#-first}}
# do not import all apis into this module because that uses a lot of memory and stack frames
# if you need the ability to import all apis from one package, import them with
# from {{packageName}.apis import DefaultApi, PetApi
# from {{packageName}}.apis import {{classname}}
{{/-first}}
{{/apis}}
{{/apiInfo}}

View File

@@ -1,3 +1,6 @@
{{#apiInfo}}
{{#apis}}
{{#-first}}
# coding: utf-8
# flake8: noqa
@@ -7,7 +10,7 @@
# raise a `RecursionError`.
# In order to avoid this, import only the API that you directly need like:
#
# from {{packagename}}.api.pet_api import PetApi
# from {{packagename}}.api.{{classVarName}} import {{classname}}
#
# or import this package, but before doing it, use:
#
@@ -15,8 +18,7 @@
# sys.setrecursionlimit(n)
# Import APIs into API package:
{{#apiInfo}}
{{#apis}}
{{/-first}}
from {{apiPackage}}.{{classVarName}} import {{classname}}
{{/apis}}
{{/apiInfo}}

View File

@@ -21,4 +21,8 @@ from {{packageName}}.exceptions import ApiAttributeError
from {{packageName}}.exceptions import ApiTypeError
from {{packageName}}.exceptions import ApiValueError
from {{packageName}}.exceptions import ApiKeyError
from {{packageName}}.exceptions import ApiException
from {{packageName}}.exceptions import ApiException
{{#recursionLimit}}
__import__('sys').setrecursionlimit({{{.}}})
{{/recursionLimit}}

View File

@@ -750,11 +750,13 @@ class Endpoint(object):
def __call__(self, *args, **kwargs):
""" This method is invoked when endpoints are called
Example:
pet_api = PetApi()
pet_api.add_pet # this is an instance of the class Endpoint
pet_api.add_pet() # this invokes pet_api.add_pet.__call__()
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
api_instance = {{classname}}()
api_instance.{{operationId}} # this is an instance of the class Endpoint
api_instance.{{operationId}}() # this invokes api_instance.{{operationId}}.__call__()
which then invokes the callable functions stored in that endpoint at
pet_api.add_pet.callable or self.callable in this class
api_instance.{{operationId}}.callable or self.callable in this class
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
"""
return self.callable(self, *args, **kwargs)

View File

@@ -182,6 +182,7 @@ module {{moduleName}}
auth_names = opts[:debug_auth_names] || [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
new_options = opts.merge(
:operation => :"{{classname}}.{{operationId}}",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,

View File

@@ -177,10 +177,10 @@ module {{moduleName}}
filename.gsub(/.*[\/\\]/, '')
end
def build_request_url(path)
def build_request_url(path, opts = {})
# Add leading and trailing slashes to path
path = "/#{path}".gsub(/\/+/, '/')
@config.base_url + path
@config.base_url(opts[:operation]) + path
end
# Update hearder and query params based on authentication settings.

View File

@@ -63,7 +63,7 @@
# @option opts [Object] :body HTTP body (JSON/XML)
# @return [Typhoeus::Request] A Typhoeus Request
def build_request(http_method, path, request, opts = {})
url = build_request_url(path)
url = build_request_url(path, opts)
http_method = http_method.to_sym.downcase
header_params = @default_headers.merge(opts[:header_params] || {})

View File

@@ -43,7 +43,7 @@
# @option opts [Object] :body HTTP body (JSON/XML)
# @return [Typhoeus::Request] A Typhoeus Request
def build_request(http_method, path, opts = {})
url = build_request_url(path)
url = build_request_url(path, opts)
http_method = http_method.to_sym.downcase
header_params = @default_headers.merge(opts[:header_params] || {})

View File

@@ -13,6 +13,18 @@ module {{moduleName}}
# Defines url base path
attr_accessor :base_path
# Define server configuration index
attr_accessor :server_index
# Define server operation configuration index
attr_accessor :server_operation_index
# Default server variables
attr_accessor :server_variables
# Default server operation variables
attr_accessor :server_operation_variables
# Defines API keys used with API Key authentications.
#
# @return [Hash] key: parameter name, value: parameter value (API key)
@@ -92,6 +104,10 @@ module {{moduleName}}
@scheme = '{{scheme}}'
@host = '{{host}}{{#port}}:{{{.}}}{{/port}}'
@base_path = '{{contextPath}}'
@server_index = 0
@server_operation_index = {}
@server_variables = {}
@server_operation_variables = {}
@api_key = {}
@api_key_prefix = {}
@timeout = 0
@@ -143,8 +159,12 @@ module {{moduleName}}
@base_path = '' if @base_path == '/'
end
def base_url
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
# Returns base URL for specified operation based on server settings
def base_url(operation = nil)
index = server_operation_index.fetch(operation, server_index)
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
end
# Gets API key (with prefix if set).
@@ -244,12 +264,58 @@ module {{moduleName}}
]
end
def operation_server_settings
{
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#servers}}
{{#-first}}
"{{{classname}}}.{{{nickname}}}": [
{{/-first}}
{
url: "{{{url}}}",
description: "{{{description}}}{{^description}}No description provided{{/description}}",
{{#variables}}
{{#-first}}
variables: {
{{/-first}}
{{{name}}}: {
description: "{{{description}}}{{^description}}No description provided{{/description}}",
default_value: "{{{defaultValue}}}",
{{#enumValues}}
{{#-first}}
enum_values: [
{{/-first}}
"{{{.}}}"{{^-last}},{{/-last}}
{{#-last}}
]
{{/-last}}
{{/enumValues}}
}{{^-last}},{{/-last}}
{{#-last}}
}
{{/-last}}
{{/variables}}
}{{^-last}},{{/-last}}
{{#-last}}
],
{{/-last}}
{{/servers}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
}
end
# Returns URL based on server settings
#
# @param index array index of the server settings
# @param variables hash of variable and the corresponding value
def server_url(index, variables = {})
servers = server_settings
def server_url(index, variables = {}, servers = nil)
servers = server_settings if servers == nil
# check array index out of bound
if (index < 0 || index >= servers.size)
@@ -259,10 +325,12 @@ module {{moduleName}}
server = servers[index]
url = server[:url]
return url unless server.key? :variables
# go through variable and assign a value
server[:variables].each do |name, variable|
if variables.key?(name)
if (server[:variables][name][:enum_values].include? variables[name])
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
url.gsub! "{" + name.to_s + "}", variables[name]
else
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."

View File

@@ -146,19 +146,19 @@ extension {{projectName}}API {
{{/isDeprecated}}
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> {
return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promisse in
return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promise in
{{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in
switch result {
{{#returnType}}
case let .success(response):
promisse(.success(response.body!))
promise(.success(response.body!))
{{/returnType}}
{{^returnType}}
case .success:
promisse(.success(()))
promise(.success(()))
{{/returnType}}
case let .failure(error):
promisse(.failure(error))
promise(.failure(error))
}
}
}.eraseToAnyPublisher()

View File

@@ -56,7 +56,7 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}(configuration?.formDataCtor || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
{{#authMethods}}
// authentication {{name}} required
@@ -189,14 +189,14 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{/consumes.0}}
{{/bodyParam}}
const query = new URLSearchParams(localVarUrlObj.search);
const queryParameters = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
queryParameters.set(key, localVarQueryParameter[key]);
}
for (const key in options.query) {
query.set(key, options.query[key]);
queryParameters.set(key, options.query[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
{{#hasFormParams}}

View File

@@ -6,6 +6,11 @@
export enum {{classname}} {
{{#allowableValues}}
{{#enumVars}}
{{#enumDescription}}
/**
* {{enumDescription}}
*/
{{/enumDescription}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}

View File

@@ -30,6 +30,11 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
export enum {{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{#enumDescription}}
/**
* {{enumDescription}}
*/
{{/enumDescription}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}

View File

@@ -42,27 +42,27 @@ public class AbstractJavaCodegenTest {
@Test
public void toEnumVarNameShouldNotShortenUnderScore() throws Exception {
Assert.assertEquals("UNDERSCORE", fakeJavaCodegen.toEnumVarName("_", "String"));
Assert.assertEquals("__", fakeJavaCodegen.toEnumVarName("__", "String"));
Assert.assertEquals("__", fakeJavaCodegen.toEnumVarName("_,.", "String"));
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("_", "String"), "UNDERSCORE");
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("__", "String"), "__");
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("_,.", "String"), "__");
}
@Test
public void toVarNameShouldAvoidOverloadingGetClassMethod() throws Exception {
Assert.assertEquals("propertyClass", fakeJavaCodegen.toVarName("class"));
Assert.assertEquals("propertyClass", fakeJavaCodegen.toVarName("_class"));
Assert.assertEquals("propertyClass", fakeJavaCodegen.toVarName("__class"));
Assert.assertEquals(fakeJavaCodegen.toVarName("class"), "propertyClass");
Assert.assertEquals(fakeJavaCodegen.toVarName("_class"), "propertyClass");
Assert.assertEquals(fakeJavaCodegen.toVarName("__class"), "propertyClass");
}
@Test
public void toModelNameShouldUseProvidedMapping() throws Exception {
fakeJavaCodegen.importMapping().put("json_myclass", "com.test.MyClass");
Assert.assertEquals("com.test.MyClass", fakeJavaCodegen.toModelName("json_myclass"));
Assert.assertEquals(fakeJavaCodegen.toModelName("json_myclass"), "com.test.MyClass");
}
@Test
public void toModelNameUsesPascalCase() throws Exception {
Assert.assertEquals("JsonAnotherclass", fakeJavaCodegen.toModelName("json_anotherclass"));
Assert.assertEquals(fakeJavaCodegen.toModelName("json_anotherclass"), "JsonAnotherclass");
}
@Test
@@ -602,6 +602,20 @@ public class AbstractJavaCodegenTest {
Assert.assertEquals(defaultValue, "new HashMap<String, ComplexModel>()", "Expected string-ref map aliased model to default to new HashMap<String, ComplexModel>()");
}
@Test
public void srcMainFolderShouldNotBeOperatingSystemSpecificPaths() {
// it's not responsibility of the generator to fix OS-specific paths. This is left to template manager.
// This path must be non-OS-specific for expectations in source outputs (e.g. gradle build files)
Assert.assertEquals(fakeJavaCodegen.getSourceFolder(), "src/main/java");
}
@Test
public void srcTestFolderShouldNotBeOperatingSystemSpecificPaths() {
// it's not responsibility of the generator to fix OS-specific paths. This is left to template manager.
// This path must be non-OS-specific for expectations in source outputs (e.g. gradle build files)
Assert.assertEquals(fakeJavaCodegen.getTestFolder(), "src/test/java");
}
private static Schema<?> createObjectSchemaWithMinItems() {
return new ObjectSchema()
.addProperties("id", new IntegerSchema().format("int32"))

View File

@@ -29,6 +29,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
public static final String PACKAGE_URL_VALUE = "";
public static final String USE_NOSE_VALUE = "false";
public static final String RECURSION_LIMIT = "1200";
@Override
public String getLanguage() {
@@ -47,6 +48,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
.put(CodegenConstants.LIBRARY, "urllib3")
.put(PythonClientCodegen.USE_NOSE, USE_NOSE_VALUE)
.put(PythonClientCodegen.RECURSION_LIMIT, RECURSION_LIMIT)
.build();
}

View File

@@ -1,740 +0,0 @@
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v2'
info:
description: >-
This is a sample server Petstore server. For this sample, you can use the api key
`special-key` to test the authorization filters.
version: 1.0.0
title: OpenAPI Petstore
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: pet
description: Everything about your Pets
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
$ref: '#/components/requestBodies/Pet'
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
$ref: '#/components/requestBodies/Pet'
/pet/findByStatus:
get:
tags:
- pet
summary: Finds Pets by status
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
style: form
explode: false
schema:
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
responses:
'200':
description: successful operation
content:
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid status value
security:
- petstore_auth:
- 'read:pets'
/pet/findByTags:
get:
tags:
- pet
summary: Finds Pets by tags
description: >-
Multiple tags can be provided with comma separated strings. Use tag1,
tag2, tag3 for testing.
operationId: findPetsByTags
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
style: form
explode: false
schema:
type: array
items:
type: string
responses:
'200':
description: successful operation
content:
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid tag value
security:
- petstore_auth:
- 'read:pets'
deprecated: true
'/pet/{petId}':
get:
tags:
- pet
summary: Find pet by ID
description: Returns a single pet
operationId: getPetById
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
security:
- api_key: []
post:
tags:
- pet
summary: Updates a pet in the store with form data
description: ''
operationId: updatePetWithForm
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
schema:
type: integer
format: int64
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
delete:
tags:
- pet
summary: Deletes a pet
description: ''
operationId: deletePet
parameters:
- name: api_key
in: header
required: false
schema:
type: string
- name: petId
in: path
description: Pet id to delete
required: true
schema:
type: integer
format: int64
responses:
'400':
description: Invalid pet value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
'/pet/{petId}/uploadImage':
post:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFile
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
type: string
format: binary
/store/inventory:
get:
tags:
- store
summary: Returns pet inventories by status
description: Returns a map of status codes to quantities
operationId: getInventory
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
additionalProperties:
type: integer
format: int32
security:
- api_key: []
/store/order:
post:
tags:
- store
summary: Place an order for a pet
description: ''
operationId: placeOrder
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid Order
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
description: order placed for purchasing the pet
required: true
'/store/order/{orderId}':
get:
tags:
- store
summary: Find purchase order by ID
description: >-
For valid response try integer IDs with value <= 5 or > 10. Other values
will generated exceptions
operationId: getOrderById
parameters:
- name: orderId
in: path
description: ID of pet that needs to be fetched
required: true
schema:
type: integer
format: int64
minimum: 1
maximum: 5
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid ID supplied
'404':
description: Order not found
delete:
tags:
- store
summary: Delete purchase order by ID
description: >-
For valid response try integer IDs with value < 1000. Anything above
1000 or nonintegers will generate API errors
operationId: deleteOrder
parameters:
- name: orderId
in: path
description: ID of the order that needs to be deleted
required: true
schema:
type: string
responses:
'400':
description: Invalid ID supplied
'404':
description: Order not found
/user:
post:
tags:
- user
summary: Create user
description: This can only be done by the logged in user.
operationId: createUser
responses:
default:
description: successful operation
security:
- api_key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Created user object
required: true
/user/createWithArray:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithArrayInput
responses:
default:
description: successful operation
security:
- api_key: []
requestBody:
$ref: '#/components/requestBodies/UserArray'
/user/createWithList:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithListInput
responses:
default:
description: successful operation
security:
- api_key: []
requestBody:
$ref: '#/components/requestBodies/UserArray'
/user/login:
get:
tags:
- user
summary: Logs user into the system
description: ''
operationId: loginUser
parameters:
- name: username
in: query
description: The user name for login
required: true
schema:
type: string
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
- name: password
in: query
description: The password for login in clear text
required: true
schema:
type: string
responses:
'200':
description: successful operation
headers:
Set-Cookie:
description: >-
Cookie authentication key for use with the `api_key`
apiKey authentication.
schema:
type: string
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
X-Rate-Limit:
description: calls per hour allowed by the user
schema:
type: integer
format: int32
X-Expires-After:
description: date in UTC when toekn expires
schema:
type: string
format: date-time
content:
application/xml:
schema:
type: string
application/json:
schema:
type: string
'400':
description: Invalid username/password supplied
/user/logout:
get:
tags:
- user
summary: Logs out current logged in user session
description: ''
operationId: logoutUser
responses:
default:
description: successful operation
security:
- api_key: []
'/user/{username}':
get:
tags:
- user
summary: Get user by user name
description: ''
operationId: getUserByName
parameters:
- name: username
in: path
description: The name that needs to be fetched. Use user1 for testing.
required: true
schema:
type: string
responses:
'200':
description: successful operation
content:
application/xml:
schema:
$ref: '#/components/schemas/User'
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Invalid username supplied
'404':
description: User not found
put:
tags:
- user
summary: Updated user
description: This can only be done by the logged in user.
operationId: updateUser
parameters:
- name: username
in: path
description: name that need to be deleted
required: true
schema:
type: string
responses:
'400':
description: Invalid user supplied
'404':
description: User not found
security:
- api_key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Updated user object
required: true
delete:
tags:
- user
summary: Delete user
description: This can only be done by the logged in user.
operationId: deleteUser
parameters:
- name: username
in: path
description: The name that needs to be deleted
required: true
schema:
type: string
responses:
'400':
description: Invalid username supplied
'404':
description: User not found
security:
- api_key: []
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
requestBodies:
UserArray:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
description: List of user object
required: true
Pet:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
securitySchemes:
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
scopes:
'write:pets': modify pets in your account
'read:pets': read your pets
api_key:
type: apiKey
name: api_key
in: header
schemas:
Order:
title: Pet Order
description: An order for a pets from the pet store
type: object
properties:
id:
type: integer
format: int64
petId:
type: integer
format: int64
quantity:
type: integer
format: int32
shipDate:
type: string
format: date-time
status:
type: string
description: Order Status
enum:
- placed
- approved
- delivered
complete:
type: boolean
default: false
xml:
name: Order
Category:
title: Pet category
description: A category for a pet
type: object
properties:
id:
type: integer
format: int64
name:
type: string
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
xml:
name: Category
User:
title: a User
description: A User who is purchasing from the pet store
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
type: integer
format: int32
description: User Status
xml:
name: User
Tag:
title: Pet Tag
description: A tag for a pet
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Tag
Pet:
title: a Pet
description: A pet for sale in the pet store
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
category:
$ref: '#/components/schemas/Category'
name:
type: string
example: doggie
photoUrls:
type: array
xml:
name: photoUrl
wrapped: true
items:
type: string
tags:
type: array
xml:
name: tag
wrapped: true
items:
$ref: '#/components/schemas/Tag'
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
xml:
name: Pet
ApiResponse:
title: An uploaded response
description: Describes the result of uploading an image resource
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
OneOfTest:
oneOf:
- $ref: '#/components/schemas/Pet'
- $ref: '#/components/schemas/User'

View File

@@ -0,0 +1,65 @@
openapi: 3.0.0
info:
description: This specification shows how to generate aliases to maps and arrays as models.
version: 1.0.0
title: OpenAPI Extension generating aliases to maps and arrays as models
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: usage
description: Show usage of x-generate-alias-as-model extension
servers:
- url: 'http://petstore.swagger.io/v2'
description: petstore server
paths:
/map:
get:
tags:
- usage
summary: Use alias to map
description: Use alias to map
operationId: map
requestBody:
content:
"application/json":
schema:
$ref: "#/components/schemas/MapAlias"
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
/array:
get:
tags:
- usage
summary: Use alias to array
description: Use alias to array
operationId: array
requestBody:
content:
"application/json":
schema:
$ref: "#/components/schemas/ArrayAlias"
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
components:
schemas:
ArrayAlias:
type: array
items:
type: integer
MapAlias:
type: object
additionalProperties:
type: string

View File

@@ -183,7 +183,7 @@ public class OAS {
@TestVisible
protected virtual Object toReturnValue(String body, Type returnType, String contentType) {
if (contentType == 'application/json') {
if (contentType.contains('application/json')) {
Object o = returnType.newInstance();
if (o instanceof MappedProperties) {
Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings();

View File

@@ -23,6 +23,7 @@ typedef struct apiClient_t {
sslConfig_t *sslConfig;
void *dataReceived;
long dataReceivedLen;
void (*data_callback_func)(void **, long *);
long response_code;
list_t *apiKeys_api_key;
char *accessToken;

View File

@@ -38,4 +38,5 @@ void listEntry_printAsInt(listEntry_t* listEntry, void *additionalData);
void listEntry_free(listEntry_t *listEntry, void *additionalData);
char* findStrInStrList(list_t* strList, const char* str);
void clear_and_free_string_list(list_t * list);
#endif // INCLUDE_LIST_H

View File

@@ -13,6 +13,7 @@ apiClient_t *apiClient_create() {
apiClient->sslConfig = NULL;
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->response_code = 0;
apiClient->apiKeys_api_key = NULL;
apiClient->accessToken = NULL;
@@ -40,6 +41,7 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->response_code = 0;
if(apiKeys_api_key!= NULL) {
apiClient->apiKeys_api_key = list_create();
@@ -61,6 +63,7 @@ void apiClient_free(apiClient_t *apiClient) {
if(apiClient->basePath) {
free(apiClient->basePath);
}
apiClient->data_callback_func = NULL;
if(apiClient->apiKeys_api_key) {
listEntry_t *listEntry = NULL;
list_ForEach(listEntry, apiClient->apiKeys_api_key) {
@@ -464,6 +467,10 @@ size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
apiClient->dataReceived = (char *)realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
memcpy(apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
apiClient->dataReceivedLen += size_this_time;
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
if (apiClient->data_callback_func) {
apiClient->data_callback_func(&apiClient->dataReceived, &apiClient->dataReceivedLen);
}
return size_this_time;
}

View File

@@ -183,3 +183,18 @@ char* findStrInStrList(list_t *strList, const char *str)
return NULL;
}
void clear_and_free_string_list(list_t *list)
{
if (!list) {
return;
}
listEntry_t *listEntry = NULL;
list_ForEach(listEntry, list) {
char *list_item = listEntry->data;
free(list_item);
list_item = NULL;
}
list_free(list);
}

View File

@@ -6,26 +6,41 @@ docs/AdditionalPropertiesClass.md
docs/Animal.md
docs/AnotherFakeApi.md
docs/ApiResponse.md
docs/Apple.md
docs/AppleReq.md
docs/ArrayOfArrayOfNumberOnly.md
docs/ArrayOfNumberOnly.md
docs/ArrayTest.md
docs/Banana.md
docs/BananaReq.md
docs/BasquePig.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ChildCat.md
docs/ChildCatAllOf.md
docs/ClassModel.md
docs/ComplexQuadrilateral.md
docs/DanishPig.md
docs/DefaultApi.md
docs/Dog.md
docs/DogAllOf.md
docs/Drawing.md
docs/EnumArrays.md
docs/EnumClass.md
docs/EnumTest.md
docs/EquilateralTriangle.md
docs/FakeApi.md
docs/FakeClassnameTags123Api.md
docs/File.md
docs/FileSchemaTestClass.md
docs/Foo.md
docs/FormatTest.md
docs/Fruit.md
docs/FruitReq.md
docs/GmFruit.md
docs/GrandparentAnimal.md
docs/HasOnlyReadOnly.md
docs/HealthCheckResult.md
docs/InlineObject.md
@@ -35,13 +50,16 @@ docs/InlineObject3.md
docs/InlineObject4.md
docs/InlineObject5.md
docs/InlineResponseDefault.md
docs/IsoscelesTriangle.md
docs/List.md
docs/Mammal.md
docs/MapTest.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
docs/Model200Response.md
docs/ModelClient.md
docs/Name.md
docs/NullableClass.md
docs/NullableShape.md
docs/NumberOnly.md
docs/Order.md
docs/OuterComposite.md
@@ -49,15 +67,28 @@ docs/OuterEnum.md
docs/OuterEnumDefaultValue.md
docs/OuterEnumInteger.md
docs/OuterEnumIntegerDefaultValue.md
docs/ParentPet.md
docs/Pet.md
docs/PetApi.md
docs/Pig.md
docs/Quadrilateral.md
docs/QuadrilateralInterface.md
docs/ReadOnlyFirst.md
docs/Return.md
docs/ScaleneTriangle.md
docs/Shape.md
docs/ShapeInterface.md
docs/ShapeOrNull.md
docs/SimpleQuadrilateral.md
docs/SpecialModelName.md
docs/StoreApi.md
docs/Tag.md
docs/Triangle.md
docs/TriangleInterface.md
docs/User.md
docs/UserApi.md
docs/Whale.md
docs/Zebra.md
git_push.sh
src/Org.OpenAPITools/Api/AnotherFakeApi.cs
src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -86,23 +117,38 @@ src/Org.OpenAPITools/Client/RetryConfiguration.cs
src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/Animal.cs
src/Org.OpenAPITools/Model/ApiResponse.cs
src/Org.OpenAPITools/Model/Apple.cs
src/Org.OpenAPITools/Model/AppleReq.cs
src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs
src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs
src/Org.OpenAPITools/Model/ArrayTest.cs
src/Org.OpenAPITools/Model/Banana.cs
src/Org.OpenAPITools/Model/BananaReq.cs
src/Org.OpenAPITools/Model/BasquePig.cs
src/Org.OpenAPITools/Model/Capitalization.cs
src/Org.OpenAPITools/Model/Cat.cs
src/Org.OpenAPITools/Model/CatAllOf.cs
src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOf.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/DogAllOf.cs
src/Org.OpenAPITools/Model/Drawing.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
src/Org.OpenAPITools/Model/EquilateralTriangle.cs
src/Org.OpenAPITools/Model/File.cs
src/Org.OpenAPITools/Model/FileSchemaTestClass.cs
src/Org.OpenAPITools/Model/Foo.cs
src/Org.OpenAPITools/Model/FormatTest.cs
src/Org.OpenAPITools/Model/Fruit.cs
src/Org.OpenAPITools/Model/FruitReq.cs
src/Org.OpenAPITools/Model/GmFruit.cs
src/Org.OpenAPITools/Model/GrandparentAnimal.cs
src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs
src/Org.OpenAPITools/Model/HealthCheckResult.cs
src/Org.OpenAPITools/Model/InlineObject.cs
@@ -112,13 +158,16 @@ src/Org.OpenAPITools/Model/InlineObject3.cs
src/Org.OpenAPITools/Model/InlineObject4.cs
src/Org.OpenAPITools/Model/InlineObject5.cs
src/Org.OpenAPITools/Model/InlineResponseDefault.cs
src/Org.OpenAPITools/Model/IsoscelesTriangle.cs
src/Org.OpenAPITools/Model/List.cs
src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/Model200Response.cs
src/Org.OpenAPITools/Model/ModelClient.cs
src/Org.OpenAPITools/Model/Name.cs
src/Org.OpenAPITools/Model/NullableClass.cs
src/Org.OpenAPITools/Model/NullableShape.cs
src/Org.OpenAPITools/Model/NumberOnly.cs
src/Org.OpenAPITools/Model/Order.cs
src/Org.OpenAPITools/Model/OuterComposite.cs
@@ -126,10 +175,23 @@ src/Org.OpenAPITools/Model/OuterEnum.cs
src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs
src/Org.OpenAPITools/Model/OuterEnumInteger.cs
src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
src/Org.OpenAPITools/Model/ParentPet.cs
src/Org.OpenAPITools/Model/Pet.cs
src/Org.OpenAPITools/Model/Pig.cs
src/Org.OpenAPITools/Model/Quadrilateral.cs
src/Org.OpenAPITools/Model/QuadrilateralInterface.cs
src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
src/Org.OpenAPITools/Model/Return.cs
src/Org.OpenAPITools/Model/ScaleneTriangle.cs
src/Org.OpenAPITools/Model/Shape.cs
src/Org.OpenAPITools/Model/ShapeInterface.cs
src/Org.OpenAPITools/Model/ShapeOrNull.cs
src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs
src/Org.OpenAPITools/Model/SpecialModelName.cs
src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/Triangle.cs
src/Org.OpenAPITools/Model/TriangleInterface.cs
src/Org.OpenAPITools/Model/User.cs
src/Org.OpenAPITools/Model/Whale.cs
src/Org.OpenAPITools/Model/Zebra.cs
src/Org.OpenAPITools/Org.OpenAPITools.csproj

View File

@@ -94,11 +94,11 @@ Class | Method | HTTP request | Description
*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**FakeHttpSignatureTest**](docs/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@@ -138,23 +138,38 @@ Class | Method | HTTP request | Description
- [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Model.Animal](docs/Animal.md)
- [Model.ApiResponse](docs/ApiResponse.md)
- [Model.Apple](docs/Apple.md)
- [Model.AppleReq](docs/AppleReq.md)
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
- [Model.Banana](docs/Banana.md)
- [Model.BananaReq](docs/BananaReq.md)
- [Model.BasquePig](docs/BasquePig.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Cat](docs/Cat.md)
- [Model.CatAllOf](docs/CatAllOf.md)
- [Model.Category](docs/Category.md)
- [Model.ChildCat](docs/ChildCat.md)
- [Model.ChildCatAllOf](docs/ChildCatAllOf.md)
- [Model.ClassModel](docs/ClassModel.md)
- [Model.ComplexQuadrilateral](docs/ComplexQuadrilateral.md)
- [Model.DanishPig](docs/DanishPig.md)
- [Model.Dog](docs/Dog.md)
- [Model.DogAllOf](docs/DogAllOf.md)
- [Model.Drawing](docs/Drawing.md)
- [Model.EnumArrays](docs/EnumArrays.md)
- [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md)
- [Model.EquilateralTriangle](docs/EquilateralTriangle.md)
- [Model.File](docs/File.md)
- [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Model.Foo](docs/Foo.md)
- [Model.FormatTest](docs/FormatTest.md)
- [Model.Fruit](docs/Fruit.md)
- [Model.FruitReq](docs/FruitReq.md)
- [Model.GmFruit](docs/GmFruit.md)
- [Model.GrandparentAnimal](docs/GrandparentAnimal.md)
- [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Model.HealthCheckResult](docs/HealthCheckResult.md)
- [Model.InlineObject](docs/InlineObject.md)
@@ -164,13 +179,16 @@ Class | Method | HTTP request | Description
- [Model.InlineObject4](docs/InlineObject4.md)
- [Model.InlineObject5](docs/InlineObject5.md)
- [Model.InlineResponseDefault](docs/InlineResponseDefault.md)
- [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md)
- [Model.List](docs/List.md)
- [Model.Mammal](docs/Mammal.md)
- [Model.MapTest](docs/MapTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelClient](docs/ModelClient.md)
- [Model.Name](docs/Name.md)
- [Model.NullableClass](docs/NullableClass.md)
- [Model.NullableShape](docs/NullableShape.md)
- [Model.NumberOnly](docs/NumberOnly.md)
- [Model.Order](docs/Order.md)
- [Model.OuterComposite](docs/OuterComposite.md)
@@ -178,12 +196,25 @@ Class | Method | HTTP request | Description
- [Model.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
- [Model.OuterEnumInteger](docs/OuterEnumInteger.md)
- [Model.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
- [Model.ParentPet](docs/ParentPet.md)
- [Model.Pet](docs/Pet.md)
- [Model.Pig](docs/Pig.md)
- [Model.Quadrilateral](docs/Quadrilateral.md)
- [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md)
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.Return](docs/Return.md)
- [Model.ScaleneTriangle](docs/ScaleneTriangle.md)
- [Model.Shape](docs/Shape.md)
- [Model.ShapeInterface](docs/ShapeInterface.md)
- [Model.ShapeOrNull](docs/ShapeOrNull.md)
- [Model.SimpleQuadrilateral](docs/SimpleQuadrilateral.md)
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.Tag](docs/Tag.md)
- [Model.Triangle](docs/Triangle.md)
- [Model.TriangleInterface](docs/TriangleInterface.md)
- [Model.User](docs/User.md)
- [Model.Whale](docs/Whale.md)
- [Model.Zebra](docs/Zebra.md)
<a name="documentation-for-authorization"></a>

View File

@@ -5,6 +5,12 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapProperty** | **Dictionary&lt;string, string&gt;** | | [optional]
**MapOfMapProperty** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
**Anytype1** | **Object** | | [optional]
**MapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional]
**MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional]
**MapWithUndeclaredPropertiesAnytype3** | **Dictionary&lt;string, Object&gt;** | | [optional]
**EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it&#39;s an empty map. | [optional]
**MapWithUndeclaredPropertiesString** | **Dictionary&lt;string, string&gt;** | | [optional]
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.Apple
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.AppleReq
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | |
**Mealy** | **bool** | | [optional]
[[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

@@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.Banana
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**LengthCm** | **decimal** | | [optional]
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.BananaReq
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**LengthCm** | **decimal** | |
**Sweet** | **bool** | | [optional]
[[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

@@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.BasquePig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ChildCat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**PetType** | **string** | | [default to PetTypeEnum.ChildCat]
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ChildCatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**PetType** | **string** | | [optional] [default to PetTypeEnum.ChildCat]
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.ComplexQuadrilateral
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**QuadrilateralType** | **string** | |
[[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

@@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.DanishPig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
[[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

@@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Drawing
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MainShape** | [**Shape**](Shape.md) | | [optional]
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional]
**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional]
**Shapes** | [**List&lt;Shape&gt;**](Shape.md) | | [optional]
[[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

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.EquilateralTriangle
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ShapeType** | **string** | |
**TriangleType** | **string** | |
[[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

@@ -5,11 +5,11 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**FakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
[**FakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
[**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
[**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums
[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -85,78 +85,6 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="fakehttpsignaturetest"></a>
# **FakeHttpSignatureTest**
> void FakeHttpSignatureTest (Pet pet, string query1 = null, string header1 = null)
test http signature authentication
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class FakeHttpSignatureTestExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new FakeApi(config);
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
var query1 = query1_example; // string | query parameter (optional)
var header1 = header1_example; // string | header parameter (optional)
try
{
// test http signature authentication
apiInstance.FakeHttpSignatureTest(pet, query1, header1);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.FakeHttpSignatureTest: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**query1** | **string**| query parameter | [optional]
**header1** | **string**| header parameter | [optional]
### Return type
void (empty response body)
### Authorization
[http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | The instance started successfully | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="fakeouterbooleanserialize"></a>
# **FakeOuterBooleanSerialize**
> bool FakeOuterBooleanSerialize (bool? body = null)
@@ -433,6 +361,70 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getarrayofenums"></a>
# **GetArrayOfEnums**
> List&lt;OuterEnum&gt; GetArrayOfEnums ()
Array of Enums
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetArrayOfEnumsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new FakeApi(config);
try
{
// Array of Enums
List<OuterEnum> result = apiInstance.GetArrayOfEnums();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.GetArrayOfEnums: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**List&lt;OuterEnum&gt;**](OuterEnum.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Got named array of enums | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="testbodywithfileschema"></a>
# **TestBodyWithFileSchema**
> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass)
@@ -679,7 +671,7 @@ namespace Example
var _string = _string_example; // string | None (optional)
var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional)
var date = 2013-10-20; // DateTime? | None (optional)
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional)
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) (default to "2010-02-01T10:20:10.111110+01:00")
var password = password_example; // string | None (optional)
var callback = callback_example; // string | None (optional)
@@ -714,7 +706,7 @@ Name | Type | Description | Notes
**_string** | **string**| None | [optional]
**binary** | **System.IO.Stream****System.IO.Stream**| None | [optional]
**date** | **DateTime?**| None | [optional]
**dateTime** | **DateTime?**| None | [optional]
**dateTime** | **DateTime?**| None | [optional] [default to &quot;2010-02-01T10:20:10.111110+01:00&quot;]
**password** | **string**| None | [optional]
**callback** | **string**| None | [optional]

View File

@@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.Fruit
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**LengthCm** | **decimal** | | [optional]
[[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

@@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.FruitReq
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | |
**Mealy** | **bool** | | [optional]
**LengthCm** | **decimal** | |
**Sweet** | **bool** | | [optional]
[[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

@@ -0,0 +1,12 @@
# Org.OpenAPITools.Model.GmFruit
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**LengthCm** | **decimal** | | [optional]
[[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

@@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.GrandparentAnimal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**PetType** | **string** | |
[[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

@@ -14,7 +14,7 @@ Name | Type | Description | Notes
**Byte** | **byte[]** | None |
**Binary** | **System.IO.Stream** | None | [optional]
**Date** | **DateTime** | None | [optional]
**DateTime** | **DateTime** | None | [optional]
**DateTime** | **DateTime** | None | [optional] [default to "2010-02-01T10:20:10.111110+01:00"]
**Password** | **string** | None | [optional]
**Callback** | **string** | None | [optional]

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