Compare commits

..

2 Commits

Author SHA1 Message Date
sbu
526f1b48f8 Dart oneof for models (#7493)
* Type check for setting, some docs, toString and toJson

* Check for required fields in fromJson

* OneOf deserialization

* Individual check for required fields to avoid `if (false)`

* Add nullable check for required fields
2020-10-12 18:18:06 +08:00
William Cheng
eaa01e15f1 dart oneof support: draft 2020-09-22 09:15:20 +08:00
633 changed files with 15590 additions and 49764 deletions

View File

@@ -777,7 +777,6 @@ 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,7 +1,6 @@
# for .net standard
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.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/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart2
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,4 +1,4 @@
generatorName: python-experimental
generatorName: python
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,4 +4,3 @@ 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-experimental
generatorName: python
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

@@ -1,9 +0,0 @@
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

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

View File

@@ -12,7 +12,6 @@ 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,7 +12,6 @@ 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,9 +34,6 @@ sidebar_label: ruby-on-rails
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
|map|Hash|
|set|Set|
## LANGUAGE PRIMITIVES

View File

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

View File

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

View File

@@ -34,7 +34,6 @@ 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;
@@ -47,7 +46,6 @@ 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;
@@ -79,9 +77,6 @@ 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;
@@ -154,10 +149,7 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
ExecutorService executor = Executors.newFixedThreadPool(numThreads);
// Execute each configurator on a separate pooled thread.
configurators.forEach(configurator -> {
GenerationRunner runner = new GenerationRunner(configurator, rootDir, Boolean.TRUE.equals(failFast), Boolean.TRUE.equals(clean));
executor.execute(runner);
});
configurators.forEach(configurator -> executor.execute(new GenerationRunner(configurator, rootDir, Boolean.TRUE.equals(failFast))));
executor.shutdown();
@@ -186,13 +178,11 @@ 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, boolean clean) {
private GenerationRunner(CodegenConfigurator configurator, Path rootDir, boolean failFast) {
this.configurator = configurator;
this.rootDir = rootDir;
this.exitOnError = failFast;
this.clean = clean;
}
/**
@@ -208,7 +198,7 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
*/
@Override
public void run() {
String name = null;
String name = "";
try {
GlobalSettings.reset();
@@ -220,10 +210,6 @@ 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();
@@ -248,28 +234,6 @@ 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,17 +394,19 @@ public class DefaultCodegen implements CodegenConfig {
if (this.useOneOfInterfaces) {
// First, add newly created oneOf interfaces
for (CodegenModel cm : addOneOfInterfaces) {
Map<String, Object> modelValue = new HashMap<>(additionalProperties());
modelValue.put("model", cm);
Map<String, Object> modelValue = new HashMap<String, Object>() {{
putAll(additionalProperties());
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<>();
objsValue.put("models", modelsValue);
objsValue.put("package", modelPackage());
objsValue.put("imports", importsValue);
objsValue.put("classname", cm.classname);
objsValue.putAll(additionalProperties);
Map<String, Object> objsValue = new HashMap<String, Object>() {{
put("models", modelsValue);
put("package", modelPackage());
put("imports", importsValue);
put("classname", cm.classname);
putAll(additionalProperties);
}};
objs.put(cm.name, objsValue);
}
@@ -1576,7 +1578,6 @@ 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");
}
/**
@@ -2703,8 +2704,7 @@ 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 (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
if ((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 (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
if ((hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
disc.setPropertyName(foundDisc.getPropertyName());
disc.setMapping(foundDisc.getMapping());
return disc;
@@ -2860,12 +2860,8 @@ public class DefaultCodegen implements CodegenConfig {
List<MappedModel> descendentSchemas = new ArrayList();
Map<String, Schema> schemas = ModelUtils.getSchemas(openAPI);
String currentSchemaName = thisSchemaName;
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) {
while (true) {
for (String childName : schemas.keySet()) {
if (childName.equals(thisSchemaName)) {
continue;
}
@@ -2883,8 +2879,8 @@ public class DefaultCodegen implements CodegenConfig {
continue;
}
String parentName = ModelUtils.getSimpleRef(ref);
if (parentName != null && parentName.equals(currentSchemaName)) {
if (queue.contains(childName) || descendentSchemas.stream().anyMatch(i -> childName.equals(i.getMappingName()))) {
if (parentName.equals(currentSchemaName)) {
if (queue.contains(childName) || descendentSchemas.contains(childName)) {
throw new RuntimeException("Stack overflow hit when looking for " + thisSchemaName + " an infinite loop starting and ending at " + childName + " was seen");
}
queue.add(childName);
@@ -3604,10 +3600,7 @@ public class DefaultCodegen implements CodegenConfig {
op.hasReference = schemas != null && schemas.containsKey(op.returnBaseType);
// lookup discriminator
Schema schema = null;
if (schemas != null) {
schema = schemas.get(op.returnBaseType);
}
Schema schema = schemas.get(op.returnBaseType);
if (schema != null) {
CodegenModel cmod = fromModel(op.returnBaseType, schema);
op.discriminator = cmod.discriminator;

View File

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

View File

@@ -86,10 +86,6 @@ 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
@@ -122,22 +118,6 @@ 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,6 +176,7 @@ 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));
@@ -190,6 +191,10 @@ 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,8 +60,7 @@ public class GroovyClientCodegen extends AbstractJavaCodegen {
languageSpecificPrimitives.add("File");
languageSpecificPrimitives.add("Map");
// this must not be OS-specific
sourceFolder = projectFolder + "/groovy";
sourceFolder = projectFolder + File.separator +"groovy";
outputFolder = "generated-code/groovy";
modelTemplateFiles.put("model.mustache", ".groovy");
apiTemplateFiles.put("api.mustache", ".groovy");

View File

@@ -1274,11 +1274,9 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
if (dataType == null && cm.isArrayModel) { // isAlias + arrayModelType missing "datatype"
dataType = "[" + cm.arrayModelType + "]";
}
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);
}
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 * 1000L;
private static final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000;
private static final long MIN_DATE;
@@ -551,13 +551,10 @@ 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) {
if (var != null) {
var.addTestData(randomByte);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomByte);
else
buffer.append(String.format(Locale.getDefault(), "(byte)%0#2x", randomByte));
}
}
}
@@ -571,13 +568,10 @@ 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) {
if (var != null) {
var.addTestData(randomChar);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomChar);
else
buffer.append(String.format(Locale.getDefault(), "'%c'", randomChar));
}
}
}
@@ -613,26 +607,24 @@ 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(BigDecimal.valueOf(Math.random()))).longValue();
.subtract(exclusiveMinLong).multiply(new BigDecimal(Math.random()))).longValue();
// If it's just a date without a time, round downwards to the nearest day.
if (var != null && "date".equals(var.dataFormat))
if ("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) {
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;
}
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(')');
@@ -643,20 +635,19 @@ 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 = 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 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 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) {
if (var != null) {
var.addTestData(randomBigDecimal);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomBigDecimal);
else
buffer.append(randomBigDecimal.toString()).append('D');
}
}
}
@@ -713,13 +704,10 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
float randomFloat = (float) (min + exclusiveMin
+ ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomFloat);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomFloat);
else
buffer.append(String.format(Locale.getDefault(), "%g", randomFloat)).append('F');
}
}
}
@@ -732,13 +720,10 @@ 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) {
if (var != null) {
var.addTestData(randomInt);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomInt);
else
buffer.append(randomInt);
}
}
}
@@ -752,16 +737,13 @@ 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(BigDecimal.valueOf(Math.random())))
max.add(inclusiveMax).subtract(min).subtract(exclusiveMin).multiply(new BigDecimal(Math.random())))
.longValue();
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomLong);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomLong);
else
buffer.append(randomLong).append('L');
}
}
}
@@ -775,13 +757,10 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
short randomShort = (short) (min + exclusiveMin
+ ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomShort);
}
} else {
if (loadTestDataFromFile)
var.addTestData(randomShort);
else
buffer.append(String.format(Locale.getDefault(), "(short)%d", randomShort));
}
}
}
@@ -790,9 +769,7 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
String randomString = generateRandomString(var);
if (loadTestDataFromFile) {
if (var != null) {
var.addTestData(randomString);
}
var.addTestData(randomString);
} else {
buffer.append('"').append(randomString).append('"');
}
@@ -1398,15 +1375,13 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
break;
}
}
if (supportingFile != null) {
supportingFiles.remove(supportingFile);
SupportingFile updated = new SupportingFile(
supportingFile.getTemplateFile(),
supportingFile.getFolder(),
"ApplicationContext-" + invokerPackage + ".xml"
);
supportingFiles.add(updated);
}
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<>();
imports2Classnames.put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable");
imports2Classnames.put("NoSuchElementException", "java.util.NoSuchElementException");
imports2Classnames.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore");
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");
}};
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<>();
oneImport.put("import", importMapping.get(i));
Map<String, String> oneImport = new HashMap<String, String>() {{
put("import", importMapping.get(i));
}};
if (!imports.contains(oneImport)) {
imports.add(oneImport);
}

View File

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

View File

@@ -43,7 +43,6 @@ 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";
@@ -185,7 +184,6 @@ 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+)");
@@ -255,15 +253,6 @@ 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,9 +83,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
GlobalFeature.XMLStructureDefinitions,
GlobalFeature.Callbacks,
GlobalFeature.LinkObjects,
GlobalFeature.ParameterStyling,
GlobalFeature.ParameterizedServer,
GlobalFeature.MultiServer
GlobalFeature.ParameterStyling
)
.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 openapi-generator project.";
return "Generates a Rust client/server library (beta) using the swagger-codegen 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,7 +1544,9 @@ 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) {
@@ -1633,7 +1635,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,8 +16,6 @@
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;
@@ -271,23 +269,25 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
return baseObjs;
}
private static final Set<String> primitiveParamTypes = ImmutableSet.of(
"Int",
"Long",
"Float",
"Double",
"Boolean",
"String"
);
private static Set<String> primitiveParamTypes = new HashSet<String>() {{
addAll(Arrays.asList(
"Int",
"Long",
"Float",
"Double",
"Boolean",
"String"
));
}};
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();
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");
}};
protected static void addPathMatcher(CodegenOperation codegenOperation) {
LinkedList<String> allPaths = new LinkedList<>(Arrays.asList(codegenOperation.path.split("/")));

View File

@@ -172,20 +172,18 @@ public class ModelUtils {
childrenMap = tmpChildrenMap;
List<String> unusedSchemas = new ArrayList<String>();
if (openAPI != null) {
Map<String, Schema> schemas = getSchemas(openAPI);
unusedSchemas.addAll(schemas.keySet());
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,7 +13,6 @@ apiClient_t *apiClient_create() {
apiClient->sslConfig = NULL;
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->response_code = 0;
{{#hasAuthMethods}}
{{#authMethods}}
@@ -59,7 +58,6 @@ 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}}
@@ -93,7 +91,6 @@ void apiClient_free(apiClient_t *apiClient) {
if(apiClient->basePath) {
free(apiClient->basePath);
}
apiClient->data_callback_func = NULL;
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
@@ -561,10 +558,6 @@ 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,7 +23,6 @@ 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,18 +183,3 @@ 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,5 +38,4 @@ 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.contains('application/json')) {
if (contentType == 'application/json') {
Object o = returnType.newInstance();
if (o instanceof MappedProperties) {
Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings();

View File

@@ -92,13 +92,11 @@ 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
@@ -469,7 +467,6 @@ namespace {{packageName}}.Client
return url;
}
{{/servers.0}}
{{#hasHttpSignatureMethods}}
/// <summary>
/// Gets and Sets the HTTPSigningConfiuration
@@ -479,7 +476,6 @@ namespace {{packageName}}.Client
get { return _HTTPSigningConfiguration; }
set { _HTTPSigningConfiguration = value; }
}
{{/hasHttpSignatureMethods}}
#endregion Properties
@@ -557,11 +553,9 @@ 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
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
HTTPSigningConfiguration = second.HTTPSigningConfiguration ?? first.HTTPSigningConfiguration
};
return config;
}

View File

@@ -96,12 +96,10 @@ 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,6 +107,12 @@ 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

@@ -0,0 +1,36 @@
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,11 +2,18 @@ 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(){{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute()
resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(), {{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{{vendorExtensions.x-export-param-name}}}({{{paramName}}}){{/optionalParams}}.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,34 +103,29 @@
});
function findNode(id, currentNode) {
var currentChild,
result;
return (Object.keys(currentNode)[0] === id) ? currentNode : findNodeInChildren(id, currentNode);
}
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;
}
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;
}
}
}
}
// The node has not been found and we have no more options
return false;
}
return false;
}
</script>
<style type="text/css">
{{>fonts}}
@@ -452,7 +447,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,10 +4,9 @@
<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,19 +27,9 @@
if(discriminatedClassName == nil ){
return [super initWithDictionary:dict error:err];
}
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]]);
}
Class 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 \stdClass|string|null
* @var mixed
*/
protected $responseBody;
@@ -48,17 +48,17 @@ class ApiException extends Exception
/**
* The deserialized response object
*
* @var \stdClass|string|null
* @var $responseObject;
*/
protected $responseObject;
/**
* Constructor
*
* @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
* @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
*/
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 \stdClass|string|null HTTP body of the server response either as \stdClass or string
* @return mixed HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
{

View File

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

View File

@@ -51,26 +51,20 @@ class ObjectSerializer
* @param string $type the OpenAPIToolsType of the data
* @param string $format the format of the OpenAPITools type of the data
*
* @return scalar|object|array|null serialized form of $data
* @return string|object serialized form of $data
*/
public static function sanitizeForSerialization($data, $type = null, $format = null)
{
if (is_scalar($data) || null === $data) {
return $data;
}
if ($data instanceof \DateTime) {
} elseif ($data instanceof \DateTime) {
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
}
if (is_array($data)) {
} elseif (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
}
return $data;
}
if (is_object($data)) {
} elseif (is_object($data)) {
$values = [];
if ($data instanceof ModelInterface) {
$formats = $data::openAPIFormats();
@@ -256,9 +250,7 @@ class ObjectSerializer
{
if (null === $data) {
return null;
}
if (strcasecmp(substr($class, -2), '[]') === 0) {
} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
if (!is_array($data)) {
@@ -271,9 +263,7 @@ class ObjectSerializer
$values[] = self::deserialize($value, $subClass, null);
}
return $values;
}
if (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
} elseif (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);
@@ -286,14 +276,10 @@ class ObjectSerializer
}
}
return $deserialized;
}
if ($class === 'object') {
} elseif ($class === 'object') {
settype($data, 'array');
return $data;
}
if ($class === '\DateTime') {
} elseif ($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
@@ -305,14 +291,10 @@ class ObjectSerializer
} else {
return null;
}
}
if (in_array($class, [{{&primitives}}], true)) {
} elseif (in_array($class, [{{&primitives}}], true)) {
settype($data, $class);
return $data;
}
if ($class === '\SplFileObject') {
} elseif ($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 $hostIndex Host index (required)
* @param int Host index (required)
*/
public function setHostIndex($hostIndex)
public function setHostIndex($host_index)
{
$this->hostIndex = $hostIndex;
$this->hostIndex = $host_index;
}
/**
* Get the host index
*
* @return int Host index
* @return Host index
*/
public function getHostIndex()
{

View File

@@ -16,7 +16,7 @@
* Please update the test case below to test the endpoint.
*/
namespace {{invokerPackage}}\Test\Api;
namespace {{invokerPackage}};
use \{{invokerPackage}}\Configuration;
use \{{invokerPackage}}\ApiException;
@@ -71,8 +71,6 @@ 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}}\\Test\\" : "{{testBasePath}}/" }
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" }
}
}

View File

@@ -38,11 +38,6 @@ 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}}
{
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
/**
* The original name of the model.
@@ -23,8 +23,6 @@ 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}},
@@ -163,7 +161,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
{{/parentSchema}}
{{#vars}}
$this->container['{{name}}'] = $data['{{name}}'] ?? {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}};
$this->container['{{name}}'] = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}};
{{/vars}}
{{#discriminator}}
@@ -280,7 +278,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
*
* @param {{dataType}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}}
*
* @return self
* @return $this
*/
public function {{setter}}(${{name}})
{
@@ -364,18 +362,18 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
*
* @param integer $offset Offset
*
* @return mixed|null
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ?? null;
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
* @param integer $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}}\Test\Model;
namespace {{invokerPackage}};
use PHPUnit\Framework\TestCase;
@@ -68,8 +68,6 @@ class {{classname}}Test extends TestCase
*/
public function test{{classname}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{#vars}}
@@ -78,8 +76,6 @@ 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
Invoke-Pester
Invoker-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,18 +43,6 @@ $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}}
@@ -66,7 +54,7 @@ ${{paramName}} = {{{vendorExtensions.x-powershell-example}}} # {{{dataType}}} |
# {{{.}}}
{{/summary}}
try {
$Result = {{{vendorExtensions.x-powershell-method-name}}}{{#allParams}} -{{paramName}} ${{paramName}}{{/allParams}}
{{#returnType}}{{returnType}} $Result = {{/returnType}}{{{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))
@@ -81,7 +69,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
${{{classname}}} = Initialize-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#hasMore}} `
Initialize-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#hasMore}} `
{{/hasMore}}
{{/vars}}
@@ -20,7 +20,7 @@ ${{{classname}}} = Initialize-{{{packageName}}}{{{classname}}} {{#vars}} -{{name
- Convert the resource to JSON
```powershell
${{{classname}}} | ConvertTo-JSON
${{className}} | Convert-ToJSON
```
[[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,7 +23,3 @@ 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,9 +1,3 @@
{{#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 {{classname}}
{{/-first}}
{{/apis}}
{{/apiInfo}}
# from {{packageName}.apis import DefaultApi, PetApi

View File

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

View File

@@ -21,8 +21,4 @@ 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
{{#recursionLimit}}
__import__('sys').setrecursionlimit({{{.}}})
{{/recursionLimit}}
from {{packageName}}.exceptions import ApiException

View File

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

View File

@@ -182,7 +182,6 @@ 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, opts = {})
def build_request_url(path)
# Add leading and trailing slashes to path
path = "/#{path}".gsub(/\/+/, '/')
@config.base_url(opts[:operation]) + path
@config.base_url + 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, opts)
url = build_request_url(path)
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, opts)
url = build_request_url(path)
http_method = http_method.to_sym.downcase
header_params = @default_headers.merge(opts[:header_params] || {})

View File

@@ -13,18 +13,6 @@ 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)
@@ -104,10 +92,6 @@ 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
@@ -159,12 +143,8 @@ module {{moduleName}}
@base_path = '' if @base_path == '/'
end
# 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])
def base_url
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
end
# Gets API key (with prefix if set).
@@ -264,58 +244,12 @@ 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 = nil)
servers = server_settings if servers == nil
def server_url(index, variables = {})
servers = server_settings
# check array index out of bound
if (index < 0 || index >= servers.size)
@@ -325,12 +259,10 @@ 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].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
if (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 { promise in
return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promisse in
{{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in
switch result {
{{#returnType}}
case let .success(response):
promise(.success(response.body!))
promisse(.success(response.body!))
{{/returnType}}
{{^returnType}}
case .success:
promise(.success(()))
promisse(.success(()))
{{/returnType}}
case let .failure(error):
promise(.failure(error))
promisse(.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 && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}(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 queryParameters = new URLSearchParams(localVarUrlObj.search);
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
queryParameters.set(key, localVarQueryParameter[key]);
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.query) {
queryParameters.set(key, options.query[key]);
query.set(key, options.query[key]);
}
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
{{#hasFormParams}}

View File

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

View File

@@ -30,11 +30,6 @@ 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(fakeJavaCodegen.toEnumVarName("_", "String"), "UNDERSCORE");
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("__", "String"), "__");
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("_,.", "String"), "__");
Assert.assertEquals("UNDERSCORE", fakeJavaCodegen.toEnumVarName("_", "String"));
Assert.assertEquals("__", fakeJavaCodegen.toEnumVarName("__", "String"));
Assert.assertEquals("__", fakeJavaCodegen.toEnumVarName("_,.", "String"));
}
@Test
public void toVarNameShouldAvoidOverloadingGetClassMethod() throws Exception {
Assert.assertEquals(fakeJavaCodegen.toVarName("class"), "propertyClass");
Assert.assertEquals(fakeJavaCodegen.toVarName("_class"), "propertyClass");
Assert.assertEquals(fakeJavaCodegen.toVarName("__class"), "propertyClass");
Assert.assertEquals("propertyClass", fakeJavaCodegen.toVarName("class"));
Assert.assertEquals("propertyClass", fakeJavaCodegen.toVarName("_class"));
Assert.assertEquals("propertyClass", fakeJavaCodegen.toVarName("__class"));
}
@Test
public void toModelNameShouldUseProvidedMapping() throws Exception {
fakeJavaCodegen.importMapping().put("json_myclass", "com.test.MyClass");
Assert.assertEquals(fakeJavaCodegen.toModelName("json_myclass"), "com.test.MyClass");
Assert.assertEquals("com.test.MyClass", fakeJavaCodegen.toModelName("json_myclass"));
}
@Test
public void toModelNameUsesPascalCase() throws Exception {
Assert.assertEquals(fakeJavaCodegen.toModelName("json_anotherclass"), "JsonAnotherclass");
Assert.assertEquals("JsonAnotherclass", fakeJavaCodegen.toModelName("json_anotherclass"));
}
@Test
@@ -602,20 +602,6 @@ 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,7 +29,6 @@ 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() {
@@ -48,7 +47,6 @@ 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

@@ -0,0 +1,740 @@
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

@@ -1,65 +0,0 @@
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.contains('application/json')) {
if (contentType == 'application/json') {
Object o = returnType.newInstance();
if (o instanceof MappedProperties) {
Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings();

View File

@@ -23,7 +23,6 @@ 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,5 +38,4 @@ 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,7 +13,6 @@ 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;
@@ -41,7 +40,6 @@ 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();
@@ -63,7 +61,6 @@ 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) {
@@ -467,10 +464,6 @@ 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,18 +183,3 @@ 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,41 +6,26 @@ 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
@@ -50,16 +35,13 @@ 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
@@ -67,28 +49,15 @@ 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
@@ -117,38 +86,23 @@ 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
@@ -158,16 +112,13 @@ 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
@@ -175,23 +126,10 @@ 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,38 +138,23 @@ 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)
@@ -179,16 +164,13 @@ 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)
@@ -196,25 +178,12 @@ 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,12 +5,6 @@ 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

@@ -1,10 +0,0 @@
# 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

@@ -1,10 +0,0 @@
# 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

@@ -1,9 +0,0 @@
# 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

@@ -1,10 +0,0 @@
# 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

@@ -1,9 +0,0 @@
# 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

@@ -1,10 +0,0 @@
# 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

@@ -1,10 +0,0 @@
# 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

@@ -1,10 +0,0 @@
# 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

@@ -1,9 +0,0 @@
# 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

@@ -1,12 +0,0 @@
# 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

@@ -1,10 +0,0 @@
# 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,6 +85,78 @@ 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)
@@ -361,70 +433,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="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)
@@ -671,7 +679,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) (default to "2010-02-01T10:20:10.111110+01:00")
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional)
var password = password_example; // string | None (optional)
var callback = callback_example; // string | None (optional)
@@ -706,7 +714,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] [default to &quot;2010-02-01T10:20:10.111110+01:00&quot;]
**dateTime** | **DateTime?**| None | [optional]
**password** | **string**| None | [optional]
**callback** | **string**| None | [optional]

View File

@@ -1,12 +0,0 @@
# 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

@@ -1,12 +0,0 @@
# 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

@@ -1,12 +0,0 @@
# 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

@@ -1,9 +0,0 @@
# 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] [default to "2010-02-01T10:20:10.111110+01:00"]
**DateTime** | **DateTime** | None | [optional]
**Password** | **string** | None | [optional]
**Callback** | **string** | None | [optional]

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