Compare commits

...

29 Commits

Author SHA1 Message Date
William Cheng
e26400a300 Merge branch 'kotlin_kotlinxserialization_polymorphism' of https://github.com/Nuglif/openapi-generator into Nuglif-kotlin_kotlinxserialization_polymorphism 2023-08-30 20:24:55 +08:00
William Cheng
bceae5695e Fix model name being a type in TS abstract codegen (#16392)
* fix model name being a type in ts abstract codegen

* add a test

* better code format
2023-08-30 13:24:54 +02:00
Jim Simon
9cc5513a1c Fix Issue 16385 (#16387) 2023-08-30 14:23:53 +08:00
martin-mfg
20692aa891 Properly handle mappings and import mappings after processOpts (#16216)
* make Java imports overridable

* fix for other dateLibraries

* complete core fix

* adapt test - step 1/2

* add unit test

* adapt test - step 2/2

* remove accidentally added file

* final small clean-up
2023-08-30 13:48:51 +08:00
EdithBirrer1
35f5852cc0 Fix null request body issue (#16376)
* suggestion how to fix #9217

* removed check for versions V2/v3

* removed useless import
2023-08-30 13:40:35 +08:00
William Caine
134dc98a71 fix: Using Map.Entry to avoid "reference to Entry is ambiguous" (#16445)
* fix: Using Map.Entry to avoid "reference to Entry is ambiguous"

when spec defines a model Entry it conflicts.  Also rest of mustache
uses  Map.Entry to matching it

* fix: Map.Entry - update samples
2023-08-30 12:57:53 +08:00
William Cheng
8386a6eaaf [java] improve petstore tests with openapi v3 spec (#16447)
* regenerate tests in jersey2-java8 client

* update samples

* fix java google api client tests

* update java resteasy to use v3 spec for tests

* update java vertx to test with v3 spec

* update java resttemplate to test with v3 spec

* add new files

* regenerate jersey1 tests
2023-08-30 12:33:01 +08:00
William Cheng
611a60411b fix cast exception in uuid default value (julia) (#16438) 2023-08-29 20:42:49 +08:00
William Cheng
b1564d8002 Fix UUID default value cast exception (swift5) (#16436) 2023-08-29 12:32:01 +01:00
ChengDaqi2023
b14f99df92 update golang.org/x/net v0.2.0 to 0.7.0 (#16148) 2023-08-29 18:51:32 +08:00
William Cheng
5ab1badbef fix cast exception in default value of uuid (objc) (#16437) 2023-08-29 18:43:53 +08:00
William Cheng
9b6e6b3e49 Fix cast exception in uuid default value (haskell-http-client) (#16439)
* fix cast exception in uuid default value (haskell-http-client)

* better code format
2023-08-29 18:42:27 +08:00
William Cheng
b5867ebf2b fix cast exception in array default value (java gen) (#16434) 2023-08-29 14:31:24 +08:00
martin-mfg
020415facc add test to invoke each generator and catch simple crashes (#16425)
* add test

* remove unused imports

* remove SmartBear copyright line

* use 3.0 input
2023-08-29 13:35:45 +08:00
William Cheng
b457c3de70 fix uuid example cast exception in python generators (#16432) 2023-08-29 13:34:54 +08:00
William Cheng
1a654eba5c better handling of null pointer in CodegenSecurity (#16433) 2023-08-29 13:33:35 +08:00
Yohei Kitamura
56105fbbe6 [ruby] Not symbolize header param keys to allow the usage of underscore ("_") character (#16396)
* [ruby] Not symbolize header param keys to allow the usage of underscore ("_") character

* use lambda to convert header key to a string if underscore is included
2023-08-29 10:42:53 +08:00
William Cheng
55252f4b25 update ruby samples 2023-08-28 15:17:05 +08:00
jumpei.yokota
21cbd1ab71 [Ruby] align indentation (#16423) 2023-08-28 15:08:50 +08:00
Wojciech Trocki
6310ecdb0f issue15126: restore default support for golang generator (#15127) 2023-08-28 11:38:09 +08:00
Stephane Carrez
0dcd8b42b0 Fix 16417: [Ada] Server generation fails for some response types (#16421)
* Fix and improvement of Ada server code generator

- add support for EWS (Embedded Web Server)
- fix GNAT project to avoid depending on util_http but instead use util_aws or util_curl
- update server skeleton generation to handle more data types for the response
- add more explanation on the generated server README

* Rebuild the Ada client GNAT project
2023-08-28 10:18:50 +08:00
Robert Oschwald
ec835fbd94 Update kotlin-client okHttp3 api.mustache fixes 16410 (#16411)
- populate body into the ServerException message
2023-08-25 19:06:43 +01:00
Yoonho Go
0f8f18e727 Update api.service.mustache (#16406)
Fix miscast types. At compile time, it says it can't find toISOString because the parameter is of type string, because modifies the whole thing.
2023-08-25 10:41:22 +02:00
William Cheng
80121aa88f Prepare v7.0.1 (#16409)
* prepare 7.0.1 in master

* update doc
2023-08-25 16:11:29 +08:00
y-tomida
c7100b9e61 wrap operand listOf (#16408) 2023-08-25 08:37:48 +01:00
Loïc Siret
47b38469a3 Merge branch 'OpenAPITools:master' into kotlin_kotlinxserialization_polymorphism 2023-01-20 14:11:43 -05:00
lsiret
82367bbeec Update the sample to reflect changes 2022-12-20 15:04:49 -05:00
lsiret
7decab556b Create a custom Serializer
The Serializer check the mapping value in the discriminator field
of the json we received to find the children Serializer
2022-12-20 14:09:30 -05:00
lsiret
755eb43a49 Convert interface to a sealed class 2022-12-20 14:06:22 -05:00
2233 changed files with 26109 additions and 12089 deletions

View File

@@ -21,5 +21,5 @@
./bin/utils/ensure-up-to-date
```
Commit all changed files.
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (6.3.0) (minor release - breaking changes with fallbacks), `7.0.x` (breaking changes without fallbacks)
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (7.0.1 - patch release), `7.1.x` (minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
- [ ] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.

View File

@@ -15,7 +15,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.0.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.0.1`):
[![Build Status](https://api.travis-ci.com/OpenAPITools/openapi-generator.svg?branch=master&status=passed)](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)

View File

@@ -6,3 +6,8 @@ templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: echo-api-native
hideGenerationTimestamp: "true"
typeMappings:
OffsetDateTime: "Instant"
importMappings:
OffsetDateTime: "java.time.Instant"

View File

@@ -1,6 +1,6 @@
generatorName: java
outputDir: samples/client/petstore/java/resteasy
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.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/Java
additionalProperties:
artifactId: petstore-resteasy

View File

@@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/resttemplate-withXml
library: resttemplate
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.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/Java
additionalProperties:
java8: true

View File

@@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/resttemplate
library: resttemplate
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.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/Java
additionalProperties:
artifactId: petstore-resttemplate

View File

@@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/vertx
library: vertx
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.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/Java
additionalProperties:
artifactId: petstore-vertx

View File

@@ -85,6 +85,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
|useBeanValidation|Use BeanValidation API annotations| |false|
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|useGzipFeature|Send gzip-encoded requests| |false|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.0.0
openApiGeneratorVersion=7.0.1-SNAPSHOT
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.0.0
openApiGeneratorVersion=7.0.1-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -22,11 +22,13 @@ import io.swagger.v3.parser.core.models.AuthorizationValue;
import org.openapitools.codegen.api.TemplateDefinition;
import org.openapitools.codegen.auth.AuthParser;
import org.openapitools.codegen.config.GeneratorSettings;
import java.util.List;
public class ClientOptInput {
private CodegenConfig config;
private GeneratorSettings generatorSettings;
private OpenAPI openAPI;
private List<AuthorizationValue> auths;
private List<TemplateDefinition> userDefinedTemplates;
@@ -36,6 +38,11 @@ public class ClientOptInput {
return this;
}
public ClientOptInput generatorSettings(GeneratorSettings generatorSettings) {
this.setGeneratorSettings(generatorSettings);
return this;
}
public ClientOptInput config(CodegenConfig codegenConfig) {
this.setConfig(codegenConfig);
return this;
@@ -92,6 +99,20 @@ public class ClientOptInput {
}
}
@Deprecated
public GeneratorSettings getGeneratorSettings() {
return generatorSettings;
}
@Deprecated
private void setGeneratorSettings(GeneratorSettings generatorSettings) {
this.generatorSettings = generatorSettings;
// TODO: ClientOptInputs needs to be retired
if (this.openAPI != null) {
this.config.setOpenAPI(this.openAPI);
}
}
@Deprecated
public OpenAPI getOpenAPI() {
return openAPI;

View File

@@ -89,6 +89,10 @@ public class CodegenSecurity {
public CodegenSecurity filterByScopeNames(List<String> filterScopes) {
CodegenSecurity filteredSecurity = new CodegenSecurity(this);
if (scopes == null) {
return filteredSecurity;
}
List<Map<String, Object>> returnedScopes = new ArrayList<Map<String, Object>>();
Map<String, Object> lastScope = null;
for (String filterScopeName : filterScopes) {

View File

@@ -7496,9 +7496,6 @@ public class DefaultCodegen implements CodegenConfig {
String name = null;
LOGGER.debug("Request body = {}", body);
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
if (schema == null) {
throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body);
}
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
if (StringUtils.isNotBlank(schema.get$ref())) {
@@ -7563,7 +7560,6 @@ public class DefaultCodegen implements CodegenConfig {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
}
addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body);
// set the parameter's example value

View File

@@ -36,6 +36,7 @@ import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.api.TemplateDefinition;
import org.openapitools.codegen.api.TemplatePathLocator;
import org.openapitools.codegen.api.TemplateProcessor;
import org.openapitools.codegen.config.GeneratorSettings;
import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.api.TemplatingEngineAdapter;
import org.openapitools.codegen.api.TemplateFileType;
@@ -253,6 +254,10 @@ public class DefaultGenerator implements Generator {
}
config.processOpts();
if (opts != null && opts.getGeneratorSettings() != null) {
config.typeMapping().putAll(opts.getGeneratorSettings().getTypeMappings());
config.importMapping().putAll(opts.getGeneratorSettings().getImportMappings());
}
// normalize the spec
try {

View File

@@ -753,6 +753,7 @@ public class CodegenConfigurator {
ClientOptInput input = new ClientOptInput()
.config(config)
.generatorSettings(generatorSettings)
.userDefinedTemplates(userDefinedTemplates);
return input.openAPI((OpenAPI)context.getSpecDocument());

View File

@@ -759,8 +759,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
}
CodegenProperty returnProperty = op.returnProperty;
CodegenProperty returnType = null;
if (returnProperty != null) {
CodegenProperty itemType = returnProperty.getItems();
returnType = itemType;
if (itemType != null) {
String dataType;
if (itemType.vendorExtensions.containsKey(X_ADA_VECTOR_TYPE_NAME)) {
@@ -778,6 +780,73 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
}
}
for (CodegenResponse rsp : op.responses) {
if (rsp.dataType != null) {
String dataType = rsp.dataType;
if (returnType != null) {
if (returnType.vendorExtensions.containsKey(X_ADA_VECTOR_TYPE_NAME)) {
dataType = (String) returnType.vendorExtensions.get(X_ADA_VECTOR_TYPE_NAME);
rsp.vendorExtensions.put(X_ADA_TYPE_NAME, dataType);
}
rsp.vendorExtensions.put("x-is-model-type", isModelType(returnType));
rsp.vendorExtensions.put("x-is-stream-type", isStreamType(returnType));
rsp.vendorExtensions.put("x-is-nullable", returnType.isNull);
// Convert optional members to use the Nullable_<T> type.
Boolean required = returnType.getHasRequired();
if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(dataType)) {
rsp.dataType = nullableTypeMapping.get(dataType);
rsp.vendorExtensions.put("x-is-required", false);
} else {
rsp.vendorExtensions.put("x-is-required", true);
}
if (!rsp.vendorExtensions.containsKey(X_ADA_SERIALIZE_OP)) {
if (returnType.isLong && !required) {
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
} else if (rsp.isLong && "int64".equals(returnType.dataFormat)) {
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Long_Entity");
} else {
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
}
}
rsp.vendorExtensions.put("x-scz-return", true);
} else {
rsp.vendorExtensions.put("x-scz-no-return", true);
if (returnProperty != null) {
if (!rsp.vendorExtensions.containsKey(X_ADA_TYPE_NAME)) {
rsp.vendorExtensions.put(X_ADA_TYPE_NAME, returnProperty.dataType);
}
rsp.vendorExtensions.put("x-is-model-type", isModelType(returnProperty));
rsp.vendorExtensions.put("x-is-stream-type", isStreamType(returnProperty));
rsp.vendorExtensions.put("x-is-nullable", returnProperty.isNull);
// Convert optional members to use the Nullable_<T> type.
Boolean required = returnProperty.getHasRequired();
if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(dataType)) {
rsp.dataType = nullableTypeMapping.get(dataType);
rsp.vendorExtensions.put("x-is-required", false);
} else {
rsp.vendorExtensions.put("x-is-required", true);
}
if (!rsp.vendorExtensions.containsKey(X_ADA_SERIALIZE_OP)) {
if (returnProperty.isLong && !required) {
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
} else if (rsp.isLong && "int64".equals(returnProperty.dataFormat)) {
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Long_Entity");
} else {
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
}
}
}
}
}
for (CodegenProperty header : rsp.headers) {
header.nameInCamelCase = toModelName(header.baseName);
header.nameInLowerCase = header.baseName.toLowerCase(Locale.ROOT);
}
}
/*
* Scan the path parameter to construct a x-path-index that tells the index of
* the path parameter.

View File

@@ -986,10 +986,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
final_values.add(element.asText());
});
} else if (schema.getDefault() instanceof Collection) {
var _default = (Collection<String>) schema.getDefault();
var _default = (Collection<Object>) schema.getDefault();
List<String> final_values = _values;
_default.forEach((element) -> {
final_values.add(element);
final_values.add(String.valueOf(element));
});
} else { // single value
_values = java.util.Collections.singletonList(String.valueOf(schema.getDefault()));

View File

@@ -422,7 +422,7 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
} else if (ModelUtils.isIntegerSchema(schema) || ModelUtils.isLongSchema(schema) || ModelUtils.isNumberSchema(schema)) {
return schema.getDefault().toString();
} else if (ModelUtils.isStringSchema(schema)) {
String _default = (String) schema.getDefault();
String _default = String.valueOf(schema.getDefault());
return "\"" + _default + "\"";
}
}

View File

@@ -182,14 +182,16 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
return p.getDefault().toString();
}
} else if (ModelUtils.isStringSchema(p)) {
String defaultValue = (String)p.getDefault();
if (defaultValue != null) {
defaultValue = defaultValue.replace("\\", "\\\\")
.replace("'", "\'");
if (Pattern.compile("\r\n|\r|\n").matcher(defaultValue).find()) {
return "'''" + defaultValue + "'''";
} else {
return "'" + defaultValue + "'";
if (p.getDefault() != null) {
String defaultValue = String.valueOf(p.getDefault());
if (defaultValue != null) {
defaultValue = defaultValue.replace("\\", "\\\\")
.replace("'", "\'");
if (Pattern.compile("\r\n|\r|\n").matcher(defaultValue).find()) {
return "'''" + defaultValue + "'''";
} else {
return "'" + defaultValue + "'";
}
}
}
} else if (ModelUtils.isArraySchema(p)) {

View File

@@ -512,9 +512,9 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
@Override
public String toParamName(String name) {
// obtain the name from nameMapping directly if provided
if (nameMapping.containsKey(name)) {
return nameMapping.get(name);
// obtain the name from parameterNameMapping directly if provided
if (parameterNameMapping.containsKey(name)) {
return parameterNameMapping.get(name);
}
name = sanitizeName(name, "[^\\w$]");
@@ -557,6 +557,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
@Override
public String toModelName(final String name) {
// obtain the name from modelNameMapping directly if provided
if (modelNameMapping.containsKey(name)) {
return modelNameMapping.get(name);
}
String fullModelName = name;
fullModelName = addPrefix(fullModelName, modelNamePrefix);
fullModelName = addSuffix(fullModelName, modelNameSuffix);
@@ -630,6 +635,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
} else if (ModelUtils.isBinarySchema(p)) {
return "ArrayBuffer";
}
return super.getTypeDeclaration(p);
}
@@ -754,6 +760,17 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
@Override
public String getSchemaType(Schema p) {
// check if $ref is a model and modelNameMapping is used
if (StringUtils.isNotBlank(p.get$ref())) {
Schema unaliasSchema = unaliasSchema(p);
Schema actualSchema = ModelUtils.getReferencedSchema(openAPI, unaliasSchema);
String modelName = ModelUtils.getSimpleRef(unaliasSchema.get$ref());
if (ModelUtils.isModel(actualSchema) && modelNameMapping.containsKey(modelName)) {
return toModelName(modelNameMapping.get(modelName));
}
}
String openAPIType = super.getSchemaType(p);
String type = null;
if (ModelUtils.isComposedSchema(p)) {

View File

@@ -89,13 +89,14 @@ public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig {
if (StringUtils.isEmpty(packageName)) {
packageName = modelPackage;
}
String srcPrefix = "src" + File.separator;
String modelPrefix = srcPrefix + "model" + File.separator + toFilename(modelPackage);
String clientPrefix = srcPrefix + "client" + File.separator + toFilename(modelPackage);
supportingFiles.add(new SupportingFile("model-spec.mustache", "", modelPrefix + "-models.ads"));
supportingFiles.add(new SupportingFile("model-body.mustache", "", modelPrefix + "-models.adb"));
supportingFiles.add(new SupportingFile("client-spec.mustache", "", clientPrefix + "-clients.ads"));
supportingFiles.add(new SupportingFile("client-body.mustache", "", clientPrefix + "-clients.adb"));
String srcDir = "src" + File.separator;
String clientDir = srcDir + "client";
String modelDir = srcDir + "model";
String modelPrefix = toFilename(modelPackage);
supportingFiles.add(new SupportingFile("model-spec.mustache", modelDir, modelPrefix + "-models.ads"));
supportingFiles.add(new SupportingFile("model-body.mustache", modelDir, modelPrefix + "-models.adb"));
supportingFiles.add(new SupportingFile("client-spec.mustache", clientDir, modelPrefix + "-clients.ads"));
supportingFiles.add(new SupportingFile("client-body.mustache", clientDir, modelPrefix + "-clients.adb"));
if (additionalProperties.containsKey(CodegenConstants.PROJECT_NAME)) {
projectName = (String) additionalProperties.get(CodegenConstants.PROJECT_NAME);
@@ -121,23 +122,23 @@ public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig {
additionalProperties.put("httpClientPackageName", httpClientPackageName);
additionalProperties.put("openApiPackageName", openApiPackageName);
additionalProperties.put("openApiGprName", openApiPackageName.toLowerCase(Locale.ROOT));
additionalProperties.put("httpClientGprName", httpClientPackageName.toLowerCase(Locale.ROOT));
additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName);
String[] names = this.modelPackage.split("\\.");
String pkgName = names[0];
additionalProperties.put("packageLevel1", pkgName);
supportingFiles.add(new SupportingFile("package-spec-level1.mustache", "",
"src" + File.separator + toFilename(names[0]) + ".ads"));
supportingFiles.add(new SupportingFile("package-spec-level1.mustache", "src",
toFilename(names[0]) + ".ads"));
if (names.length > 1) {
String fileName = toFilename(names[0]) + "-" + toFilename(names[1]) + ".ads";
pkgName = names[0] + "." + names[1];
additionalProperties.put("packageLevel2", pkgName);
supportingFiles.add(new SupportingFile("package-spec-level2.mustache", "",
"src" + File.separator + fileName));
supportingFiles.add(new SupportingFile("package-spec-level2.mustache", "src", fileName));
}
pkgName = this.modelPackage;
supportingFiles.add(new SupportingFile("client.mustache", "",
"src" + File.separator + toFilename(pkgName) + "-client.adb"));
supportingFiles.add(new SupportingFile("client.mustache", "src",
toFilename(pkgName) + "-client.adb"));
additionalProperties.put("packageName", toFilename(pkgName));
// add lambda for mustache templates

View File

@@ -86,16 +86,20 @@ public class AdaServerCodegen extends AbstractAdaCodegen implements CodegenConfi
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
packageName = (String) additionalProperties.get(CodegenConstants.PACKAGE_NAME);
}
String srcPrefix = "src" + File.separator;
String serverPrefix = srcPrefix + "server" + File.separator + toFilename(modelPackage);
String modelPrefix = srcPrefix + "model" + File.separator + toFilename(modelPackage);
String implPrefix = srcPrefix + toFilename(modelPackage);
supportingFiles.add(new SupportingFile("model-spec.mustache", "", modelPrefix + "-models.ads"));
supportingFiles.add(new SupportingFile("model-body.mustache", "", modelPrefix + "-models.adb"));
supportingFiles.add(new SupportingFile("server-skeleton-spec.mustache", "", serverPrefix + "-skeletons.ads"));
supportingFiles.add(new SupportingFile("server-skeleton-body.mustache", "", serverPrefix + "-skeletons.adb"));
supportingFiles.add(new SupportingFile("server-spec.mustache", "", implPrefix + "-servers.ads"));
supportingFiles.add(new SupportingFile("server-body.mustache", "", implPrefix + "-servers.adb"));
String srcDir = "src" + File.separator;
String awsDir = srcDir + "aws";
String ewsDir = srcDir + "ews";
String serverDir = srcDir + "server";
String modelDir = srcDir + "model";
String modelPrefix = toFilename(modelPackage);
supportingFiles.add(new SupportingFile("model-spec.mustache", modelDir, modelPrefix + "-models.ads"));
supportingFiles.add(new SupportingFile("model-body.mustache", modelDir, modelPrefix + "-models.adb"));
supportingFiles.add(new SupportingFile("server-skeleton-spec.mustache", serverDir, modelPrefix + "-skeletons.ads"));
supportingFiles.add(new SupportingFile("server-skeleton-body.mustache", serverDir, modelPrefix + "-skeletons.adb"));
supportingFiles.add(new SupportingFile("server-spec.mustache", srcDir, modelPrefix + "-servers.ads"));
supportingFiles.add(new SupportingFile("server-body.mustache", srcDir, modelPrefix + "-servers.adb"));
supportingFiles.add(new SupportingFile("server-aws.mustache", awsDir, modelPrefix + "_aws.adb"));
supportingFiles.add(new SupportingFile("server-ews.mustache", ewsDir, modelPrefix + "_ews.adb"));
supportingFiles.add(new SupportingFile("openapi.mustache", "web" + File.separator + "swagger", "openapi.json"));
@@ -124,23 +128,23 @@ public class AdaServerCodegen extends AbstractAdaCodegen implements CodegenConfi
additionalProperties.put("httpClientPackageName", httpClientPackageName);
additionalProperties.put("openApiPackageName", openApiPackageName);
additionalProperties.put("openApiGprName", openApiPackageName.toLowerCase(Locale.ROOT));
additionalProperties.put("httpClientGprName", httpClientPackageName.toLowerCase(Locale.ROOT));
additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName);
String names[] = this.modelPackage.split("\\.");
String pkgName = names[0];
additionalProperties.put("packageLevel1", pkgName);
supportingFiles.add(new SupportingFile("package-spec-level1.mustache", "",
"src" + File.separator + toFilename(names[0]) + ".ads"));
supportingFiles.add(new SupportingFile("package-spec-level1.mustache", "src",
toFilename(names[0]) + ".ads"));
if (names.length > 1) {
String fileName = toFilename(names[0]) + "-" + toFilename(names[1]) + ".ads";
pkgName = names[0] + "." + names[1];
additionalProperties.put("packageLevel2", pkgName);
supportingFiles.add(new SupportingFile("package-spec-level2.mustache", "",
"src" + File.separator + fileName));
supportingFiles.add(new SupportingFile("package-spec-level2.mustache", "src", fileName));
}
pkgName = this.modelPackage;
supportingFiles.add(new SupportingFile("server.mustache", "",
"src" + File.separator + toFilename(pkgName) + "-server.adb"));
supportingFiles.add(new SupportingFile("server.mustache", "src",
toFilename(pkgName) + "-server.adb"));
additionalProperties.put("packageName", toFilename(pkgName));
// add lambda for mustache templates

View File

@@ -367,11 +367,17 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
}
}
public void setDateTimeFormat(String value) { setStringProp(PROP_DATETIME_FORMAT, value); }
public void setDateTimeFormat(String value) {
setStringProp(PROP_DATETIME_FORMAT, value);
}
public void setDateTimeParseFormat(String value) { setStringProp(PROP_DATETIME_PARSE_FORMAT, value); }
public void setDateTimeParseFormat(String value) {
setStringProp(PROP_DATETIME_PARSE_FORMAT, value);
}
public void setDateFormat(String value) { setStringProp(PROP_DATE_FORMAT, value); }
public void setDateFormat(String value) {
setStringProp(PROP_DATE_FORMAT, value);
}
public void setCabalPackage(String value) {
setStringProp(PROP_CABAL_PACKAGE, value);
@@ -406,7 +412,9 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
this.useKatip = value;
}
public void setCustomTestInstanceModule(String value) { setStringProp(PROP_CUSTOM_TEST_INSTANCE_MODULE, value); }
public void setCustomTestInstanceModule(String value) {
setStringProp(PROP_CUSTOM_TEST_INSTANCE_MODULE, value);
}
private void setStringProp(String key, String value) {
if (StringUtils.isBlank(value)) {
@@ -1260,7 +1268,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
public String toDefaultValue(Schema p) {
if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) {
return "\"" + escapeText((String) p.getDefault()) + "\"";
return "\"" + escapeText((String.valueOf(p.getDefault()))) + "\"";
}
} else if (ModelUtils.isBooleanSchema(p)) {
if (p.getDefault() != null) {
@@ -1436,8 +1444,8 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
// finally escalate characters avoiding code injection
return escapeUnsafeCharacters(
StringEscapeUtils.unescapeJava(
StringEscapeUtils.escapeJava(input)
.replace("\\/", "/"))
StringEscapeUtils.escapeJava(input)
.replace("\\/", "/"))
.replaceAll("[\\t\\n\\r]", " ")
.replace("\\", "\\\\")
.replace("\"", "\\\""));
@@ -1471,10 +1479,13 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
}
}
}
static boolean ContainsJsonMimeType(String mime) {
return mime != null && CONTAINS_JSON_MIME_PATTERN.matcher(mime).matches();
return mime != null && CONTAINS_JSON_MIME_PATTERN.matcher(mime).matches();
}
@Override
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.HASKELL; }
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.HASKELL;
}
}

View File

@@ -96,6 +96,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String MICROPROFILE_DEFAULT = "default";
public static final String MICROPROFILE_KUMULUZEE = "kumuluzee";
public static final String WEBCLIENT_BLOCKING_OPERATIONS = "webclientBlockingOperations";
public static final String USE_ENUM_CASE_INSENSITIVE = "useEnumCaseInsensitive";
public static final String SERIALIZATION_LIBRARY_GSON = "gson";
public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson";
@@ -137,6 +138,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean useSingleRequestParameter = false;
protected boolean webclientBlockingOperations = false;
protected boolean generateClientAsBean = false;
protected boolean useEnumCaseInsensitive = false;
private static class MpRestClientVersion {
public final String rootPackage;
@@ -225,6 +227,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(WEBCLIENT_BLOCKING_OPERATIONS, "Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync", this.webclientBlockingOperations));
cliOptions.add(CliOption.newBoolean(GENERATE_CLIENT_AS_BEAN, "For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).", this.generateClientAsBean));
cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries."));
cliOptions.add(CliOption.newBoolean(USE_ENUM_CASE_INSENSITIVE, "Use `equalsIgnoreCase` when String for enum comparison", useEnumCaseInsensitive));
supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.");
supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x");
@@ -461,6 +464,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.setGenerateClientAsBean(convertPropertyToBooleanAndWriteBack(GENERATE_CLIENT_AS_BEAN));
}
if (additionalProperties.containsKey(USE_ENUM_CASE_INSENSITIVE)) {
this.setUseEnumCaseInsensitive(Boolean.parseBoolean(additionalProperties.get(USE_ENUM_CASE_INSENSITIVE).toString()));
}
writePropertyBack(USE_ENUM_CASE_INSENSITIVE, useEnumCaseInsensitive);
final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/");
final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/");
final String modelsFolder = (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar);
@@ -1232,6 +1240,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.generateClientAsBean = generateClientAsBean;
}
public void setUseEnumCaseInsensitive(boolean useEnumCaseInsensitive) {
this.useEnumCaseInsensitive = useEnumCaseInsensitive;
}
/**
* Serialization library.
*

View File

@@ -699,7 +699,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
}
} else if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) {
return "@\"" + (String) p.getDefault() + "\"";
return "@\"" + String.valueOf(p.getDefault()) + "\"";
}
} else if (ModelUtils.isBooleanSchema(p)) {
if (p.getDefault() != null) {

View File

@@ -17,6 +17,8 @@
package org.openapitools.codegen.languages;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
@@ -30,6 +32,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
@@ -286,6 +290,18 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
.doNotOverwrite());
supportingFiles.add(new SupportingFile("api_client_spec.mustache", specFolder, "api_client_spec.rb")
.doNotOverwrite());
// add lambda to convert a symbol to a string if an underscore is included (e.g. :'user_uuid' => 'user_uuid')
additionalProperties.put("lambdaFixHeaderKey", new Mustache.Lambda() {
@Override
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
String content = fragment.execute();
if (content.contains("_")) {
content = content.substring(1);
}
writer.write(content);
}
});
}
@Override

View File

@@ -770,9 +770,9 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
if (p.getEnum() != null && !p.getEnum().isEmpty()) {
if (p.getDefault() != null) {
if (ModelUtils.isStringSchema(p)) {
return "." + toEnumVarName(escapeText((String) p.getDefault()), p.getType());
return "." + toEnumVarName(escapeText(String.valueOf(p.getDefault())), p.getType());
} else {
return "." + toEnumVarName(escapeText(p.getDefault().toString()), p.getType());
return "." + toEnumVarName(escapeText(String.valueOf(p.getDefault())), p.getType());
}
}
}
@@ -786,7 +786,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
long epochMicro = TimeUnit.SECONDS.toMicros(instant.getEpochSecond()) + (instant.get(ChronoField.MICRO_OF_SECOND));
return "Date(timeIntervalSince1970: " + epochMicro + ".0 / 1_000_000)";
} else if (ModelUtils.isStringSchema(p)) {
return "\"" + escapeText((String) p.getDefault()) + "\"";
return "\"" + escapeText(String.valueOf(p.getDefault())) + "\"";
}
// TODO: Handle more cases from `ModelUtils`, such as Date
}

View File

@@ -6,23 +6,39 @@ This Ada server was generated by the [OpenAPI Generator](https://openapi-generat
By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server,
you can easily generate a server stub.
## Building
## Alire setup
To build the server you will need the GNAT Ada compiler as well as
the [OpenAPI Ada library](https://github.com/stcarrez/swagger-ada).
When the GNAT Ada compiler and OpenAPI Ada libraries are installed,
run the following command:
Use [Alire](https://github.com/alire-project/alire) to setup and build the project.
First, import the [OpenAPI Ada](https://gitlab.com/stcarrez/openapi-ada) server library with:
```shell
gprbuild -p -P{{projectName}}
alr with openapi_server
```
Then choose a servlet web container that will handle the requests.
Two web server implementations are provided:
* [AWS](https://github.com/AdaCore/aws)
* [EWS](https://github.com/simonjwright/ews)
and you should run one of the following `alr` command depending on your choice:
```
alr with servletada_aws
alr with servletada_ews
```
Once these steps are made, build the project with
```
alr build
```
After the build is successful, you will get the server binary
in bin/{{packageName}}-server and you can start it as follows:
in `bin/{{packageName}}_aws` or `bin/{{packageName}}_ews` and you can start it as follows:
```shell
./bin/{{packageName}}-server
./bin/{{packageName}}_aws
```
## Structure of the server
@@ -40,6 +56,8 @@ src/server/{{packageName}}-skeletons.adb|{{package}}.Skeletons|The server skelet
src/server/{{packageName}}-models.ads|{{package}}.Skeletons|The server model types declaration
src/server/{{packageName}}-models.adb|{{package}}.Skeletons|The server model types implementation
src/{{packageName}}-server.adb|{{package}}.Server|The server main procedure
src/aws/{{packageName}}_aws.adb||The Ada Web Server server main procedure
src/ews/{{packageName}}_ews.adb||The Embedded Web Server server main procedure
Files generated in **src/server** should not be modified. The server implementation
files (**src/{{packageName}}-server.ads** and **src/{{packageName}}-server.adb**) should

View File

@@ -8,21 +8,48 @@
with "config";
with "utilada_sys";
with "utilada_xml";
with "utilada_http";
with "utilada_{{httpClientGprName}}";
with "security";
with "{{openApiGprName}}";{{#isServer}}
with "servletada";
with "servletada_aws";
-- with "servletada_ews";
with "{{openApiGprName}}_server";{{/isServer}}
project {{{projectName}}} is
Mains := ("{{{packageName}}}-{{{mainName}}}.adb");
for Main use Mains;
for Source_Dirs use ("src", "src/model", "src/{{{packageDir}}}");
for Object_Dir use "./" & Config'Exec_Dir & "/bin";
for Object_Dir use "obj/";
for Source_Dirs use ("src", "src/model", "src/{{{packageDir}}}");
{{^isServer}}
Mains := ("{{{packageName}}}-{{{mainName}}}.adb");
{{/isServer}}
{{#isServer}}
for Main use ();
package Binder renames Config.Binder;
package Builder renames Config.Builder;
package Compiler renames Config.Compiler;
package Linker renames Config.Linker;
Build_AWS : Config.Yes_No := external ("BUILD_AWS", "yes");
Build_EWS : Config.Yes_No := external ("BUILD_EWS", "no");
case Build_AWS is
when "yes" =>
for Main use Project'Main & ("{{{packageName}}}_aws.adb");
for Source_Dirs use Project'Source_Dirs & ("src/aws");
when others =>
null;
end case;
case Build_EWS is
when "yes" =>
for Main use Project'Main & ("{{{packageName}}}_ews.adb");
for Source_Dirs use Project'Source_Dirs & ("src/ews");
when others =>
null;
end case;
{{/isServer}}
package Binder renames Config.Binder;
package Builder renames Config.Builder;
package Compiler renames Config.Compiler;
package Linker renames Config.Linker;
end {{{projectName}}};

View File

@@ -0,0 +1,7 @@
with Servlet.Server.Web;
with {{{projectName}}}.Server;
procedure {{{projectName}}}_AWS is
Container : Servlet.Server.Web.AWS_Container;
begin
{{{projectName}}}.Server (Container);
end {{{projectName}}}_AWS;

View File

@@ -0,0 +1,7 @@
with Servlet.Server.EWS;
with {{{projectName}}}.Server;
procedure {{{projectName}}}_EWS is
Container : Servlet.Server.EWS.EWS_Container;
begin
{{{projectName}}}.Server (Container);
end {{{projectName}}}_EWS;

View File

@@ -107,10 +107,7 @@ package body {{package}}.Skeletons is
{{#returnType}}
{{#responses}}
if Context.Get_Status = {{code}} then{{#message}}
Context.Set_Description ("{{message}}");{{/message}}
{{#schema}}
{{#vendorExtensions.x-produces-plain-text}}
{{#isFile}}
Context.Set_Description ("{{message}}");{{/message}}{{#-first}}{{#schema}}{{#vendorExtensions.x-produces-plain-text}}{{#isFile}}
{{openApiPackageName}}.Streams.Write (Stream, Result);
{{/isFile}}{{^isFile}}
Stream.Write ({{openApiPackageName}}.To_String (Result));
@@ -119,15 +116,22 @@ package body {{package}}.Skeletons is
{{#isFile}}
{{openApiPackageName}}.Streams.Write (Stream, Result);
{{/isFile}}{{^isFile}}
Stream.Start_Document;{{#vendorExtensions.x-codegen-response.isString}}
{{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}{{#returnTypeIsPrimitive}}
{{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}
{{package}}.Models.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{/vendorExtensions.x-codegen-response.isString}}
Stream.End_Document;
{{/isFile}}{{/vendorExtensions.x-produces-plain-text}}
{{/schema}}
Stream.Start_Document;{{#vendorExtensions.x-is-stream-type}}{{^isLong}}{{#vendorExtensions.x-is-required}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-required}}{{^vendorExtensions.x-is-required}}{{#vendorExtensions.x-is-nullable}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-nullable}}{{^vendorExtensions.x-is-nullable}}
if not {{#isFreeFormObject}}{{openApiPackageName}}.Is_Null (Result){{/isFreeFormObject}}{{^isFreeFormObject}}Value.{{name}}.Is_Null{{/isFreeFormObject}} then
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);
end if;{{/vendorExtensions.x-is-nullable}}{{/vendorExtensions.x-is-required}}{{/isLong}}{{#isLong}}{{#vendorExtensions.x-is-required}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-required}}{{^vendorExtensions.x-is-required}}{{#vendorExtensions.x-is-nullable}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-nullable}}{{^vendorExtensions.x-is-nullable}}
if not Result.Is_Null then
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);
end if;{{/vendorExtensions.x-is-nullable}}{{/vendorExtensions.x-is-required}}{{/isLong}}{{/vendorExtensions.x-is-stream-type}}{{^vendorExtensions.x-is-stream-type}}
Serialize (Stream, "", Result);{{/vendorExtensions.x-is-stream-type}}
Stream.End_Document;{{/isFile}}{{/vendorExtensions.x-produces-plain-text}}{{/schema}}{{/-first}}
return;
end if;{{/responses}}{{/returnType}}
end if;
{{/responses}}{{/returnType}}
end {{operationId}};
{{/operation}}
{{/operations}}
@@ -224,10 +228,7 @@ package body {{package}}.Skeletons is
{{#returnType}}
{{#responses}}
if Context.Get_Status = {{code}} then{{#message}}
Context.Set_Description ("{{message}}");{{/message}}
{{#schema}}
{{#vendorExtensions.x-produces-plain-text}}
{{#isFile}}
Context.Set_Description ("{{message}}");{{/message}}{{#-first}}{{#schema}}{{#vendorExtensions.x-produces-plain-text}}{{#isFile}}
{{openApiPackageName}}.Streams.Write (Stream, Result);
{{/isFile}}{{^isFile}}
Stream.Write ({{openApiPackageName}}.To_String (Result));
@@ -236,15 +237,22 @@ package body {{package}}.Skeletons is
{{#isFile}}
{{openApiPackageName}}.Streams.Write (Stream, Result);
{{/isFile}}{{^isFile}}
Stream.Start_Document;{{#vendorExtensions.x-codegen-response.isString}}
{{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}{{#returnTypeIsPrimitive}}
{{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}
{{package}}.Models.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{/vendorExtensions.x-codegen-response.isString}}
Stream.End_Document;
{{/isFile}}{{/vendorExtensions.x-produces-plain-text}}
{{/schema}}
Stream.Start_Document;{{#vendorExtensions.x-is-stream-type}}{{^isLong}}{{#vendorExtensions.x-is-required}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-required}}{{^vendorExtensions.x-is-required}}{{#vendorExtensions.x-is-nullable}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-nullable}}{{^vendorExtensions.x-is-nullable}}
if not {{#isFreeFormObject}}{{openApiPackageName}}.Is_Null (Result){{/isFreeFormObject}}{{^isFreeFormObject}}Value.{{name}}.Is_Null{{/isFreeFormObject}} then
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);
end if;{{/vendorExtensions.x-is-nullable}}{{/vendorExtensions.x-is-required}}{{/isLong}}{{#isLong}}{{#vendorExtensions.x-is-required}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-required}}{{^vendorExtensions.x-is-required}}{{#vendorExtensions.x-is-nullable}}
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);{{/vendorExtensions.x-is-nullable}}{{^vendorExtensions.x-is-nullable}}
if not Result.Is_Null then
Stream.{{vendorExtensions.x-ada-serialize-op}} ("", Result);
end if;{{/vendorExtensions.x-is-nullable}}{{/vendorExtensions.x-is-required}}{{/isLong}}{{/vendorExtensions.x-is-stream-type}}{{^vendorExtensions.x-is-stream-type}}
Serialize (Stream, "", Result);{{/vendorExtensions.x-is-stream-type}}
Stream.End_Document;{{/isFile}}{{/vendorExtensions.x-produces-plain-text}}{{/schema}}{{/-first}}
return;
end if;{{/responses}}{{/returnType}}
end if;
{{/responses}}{{/returnType}}
end {{operationId}};
package API_{{operationId}} is

View File

@@ -1,46 +1,37 @@
with Ada.IO_Exceptions;
with AWS.Config.Set;
with {{openApiPackageName}}.Servers.AWS;
with Servlet.Server;
with {{openApiPackageName}}.Servers.Applications;
with Util.Strings;
with Util.Log.Loggers;
with Util.Properties;
with Util.Properties.Basic;
with {{package}}.Servers;
procedure {{package}}.Server is
procedure Configure (Config : in out AWS.Config.Object);
procedure {{package}}.Server (Server : in out Servlet.Server.Container'Class) is
use Util.Properties.Basic;
CONFIG_PATH : constant String := "{{packageConfig}}.properties";
Port : Natural := 8080;
procedure Configure (Config : in out AWS.Config.Object) is
begin
AWS.Config.Set.Server_Port (Config, Port);
AWS.Config.Set.Max_Connection (Config, 8);
AWS.Config.Set.Accept_Queue_Size (Config, 512);
end Configure;
Port : Natural := 8080;
App : aliased {{openApiPackageName}}.Servers.Applications.Application_Type;
WS : {{openApiPackageName}}.Servers.AWS.AWS_Container;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("{{package}}.Server");
Props : Util.Properties.Manager;
Config : Servlet.Server.Configuration;
begin
Props.Load_Properties (CONFIG_PATH);
Util.Log.Loggers.Initialize (Props);
Port := Integer_Property.Get (Props, "swagger.port", Port);
Config.Listening_Port := Port;
App.Configure (Props);
{{package}}.Servers.Server_Impl.Register (App);
WS.Configure (Configure'Access);
WS.Register_Application ("{{basePathWithoutHost}}", App'Unchecked_Access);
Server.Configure (Config);
Server.Register_Application ("{{basePathWithoutHost}}", App'Unchecked_Access);
App.Dump_Routes (Util.Log.INFO_LEVEL);
Log.Info ("Connect your browser to: http://localhost:{0}{{basePathWithoutHost}}/ui/index.html",
Util.Strings.Image (Port));
WS.Start;
Server.Start;
delay 6000.0;

View File

@@ -18,7 +18,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import {{invokerPackage}}.JSON;
@@ -462,9 +461,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^hasChildren}}
{{^isAdditionalPropertiesTrue}}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!{{classname}}.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -216,7 +216,10 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
{{^isCollectionFormatMulti}}
parameterAddToHeaderOrQuery(localVarQueryParams, "{{baseName}}", r.{{paramName}}, "{{collectionFormat}}")
{{/isCollectionFormatMulti}}
}
{{#defaultValue}}} else {
var defaultValue {{{dataType}}} = {{{.}}}
r.{{paramName}} = &defaultValue
{{/defaultValue}}}
{{/required}}
{{/queryParams}}
// to determine the Content-Type header

View File

@@ -36,6 +36,10 @@ import kotlinx.parcelize.Parcelize
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
{{#discriminator}}import kotlinx.serialization.json.JsonContentPolymorphicSerializer
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.jsonObject
{{/discriminator}}
{{/multiplatform}}
{{#serializableModel}}
import java.io.Serializable
@@ -55,18 +59,18 @@ import {{packageName}}.infrastructure.ITransformForStorage
{{#parcelizeModels}}
@Parcelize
{{/parcelizeModels}}
{{#multiplatform}}{{^discriminator}}@Serializable{{/discriminator}}{{/multiplatform}}{{#kotlinx_serialization}}{{#serializableModel}}@KSerializable{{/serializableModel}}{{^serializableModel}}@Serializable{{/serializableModel}}{{/kotlinx_serialization}}{{#moshi}}{{#moshiCodeGen}}@JsonClass(generateAdapter = true){{/moshiCodeGen}}{{/moshi}}{{#jackson}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{/jackson}}
{{#multiplatform}}@Serializable{{#discriminator}}(with = {{classname}}Serializer::class){{/discriminator}}{{/multiplatform}}{{#kotlinx_serialization}}{{#serializableModel}}@KSerializable{{/serializableModel}}{{^serializableModel}}@Serializable{{/serializableModel}}{{/kotlinx_serialization}}{{#moshi}}{{#moshiCodeGen}}@JsonClass(generateAdapter = true){{/moshiCodeGen}}{{/moshi}}{{#jackson}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{/jackson}}
{{#isDeprecated}}
@Deprecated(message = "This schema is deprecated.")
{{/isDeprecated}}
{{>additionalModelTypeAnnotations}}
{{#nonPublicApi}}internal {{/nonPublicApi}}{{#discriminator}}interface{{/discriminator}}{{^discriminator}}data class{{/discriminator}} {{classname}}{{^discriminator}} (
{{#nonPublicApi}}internal {{/nonPublicApi}}{{#discriminator}}sealed class{{/discriminator}}{{^discriminator}}data class{{/discriminator}} {{classname}}{{^discriminator}} (
{{#allVars}}
{{#required}}{{>data_class_req_var}}{{/required}}{{^required}}{{>data_class_opt_var}}{{/required}}{{^-last}},{{/-last}}
{{/allVars}}
){{/discriminator}}{{#parent}}{{^serializableModel}}{{^parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{#serializableModel}}{{^parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}, Serializable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{^serializableModel}}{{#parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{#serializableModel}}{{#parcelizeModels}} : {{{parent}}}{{#isMap}}(){{/isMap}}{{#isArray}}(){{/isArray}}, Serializable, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}{{^parcelizeModels}} : Serializable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}{{#parcelizeModels}} : Serializable, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#generateRoomModels}}{{#parent}}, {{/parent}}{{^discriminator}}{{^parent}}:{{/parent}} ITransformForStorage<{{classname}}RoomModel>{{/discriminator}}{{/generateRoomModels}}{{#vendorExtensions.x-has-data-class-body}} {
){{/discriminator}}{{#parent}}{{^serializableModel}}{{^parcelizeModels}} : {{{parent}}}(){{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{#serializableModel}}{{^parcelizeModels}} : {{{parent}}}(), Serializable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{^serializableModel}}{{#parcelizeModels}} : {{{parent}}}(), Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#parent}}{{#serializableModel}}{{#parcelizeModels}} : {{{parent}}}(), Serializable, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}{{^parcelizeModels}} : Serializable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{^serializableModel}}{{#parcelizeModels}} : Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}{{#parcelizeModels}} : Serializable, Parcelable{{/parcelizeModels}}{{/serializableModel}}{{/parent}}{{#generateRoomModels}}{{#parent}}, {{/parent}}{{^discriminator}}{{^parent}}:{{/parent}} ITransformForStorage<{{classname}}RoomModel>{{/discriminator}}{{/generateRoomModels}}{{#vendorExtensions.x-has-data-class-body}} {
{{/vendorExtensions.x-has-data-class-body}}
{{#generateRoomModels}}
companion object { }
@@ -147,3 +151,13 @@ import {{packageName}}.infrastructure.ITransformForStorage
{{#vendorExtensions.x-has-data-class-body}}
}
{{/vendorExtensions.x-has-data-class-body}}
{{#discriminator}}
internal object {{classname}}Serializer : JsonContentPolymorphicSerializer<{{classname}}>({{classname}}::class) {
override fun selectDeserializer(element: JsonElement) = when {
{{#mappedModels}}
"{{mappingName}}" in element.jsonObject["{{discriminatorName}}"].toString() -> {{modelName}}.serializer()
{{/mappedModels}}
else -> {{classname}}.serializer()
}
}{{/discriminator}}

View File

@@ -15,4 +15,4 @@
{{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}")
{{/kotlinx_serialization}}
{{/multiplatform}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInCamelCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInCamelCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}
{{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{^isInherited}}abstract {{/isInherited}}{{/multiplatform}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInCamelCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInCamelCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}

View File

@@ -147,7 +147,7 @@ import {{packageName}}.infrastructure.toMultiValue
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
}
}
}

View File

@@ -288,14 +288,14 @@ import com.squareup.moshi.adapter
requestConfig.headers["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!
{{/isKeyInHeader}}
{{#isKeyInQuery}}
requestConfig.query["{{keyParamName}}"] = apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!
requestConfig.query["{{keyParamName}}"] = listOf(apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!)
{{/isKeyInQuery}}
} else {
{{#isKeyInHeader}}
requestConfig.headers["{{keyParamName}}"] = apiKey["{{keyParamName}}"]!!
{{/isKeyInHeader}}
{{#isKeyInQuery}}
requestConfig.query["{{keyParamName}}"] = apiKey["{{keyParamName}}"]!!
requestConfig.query["{{keyParamName}}"] = listOf(apiKey["{{keyParamName}}"]!!)
{{/isKeyInQuery}}
}
}

View File

@@ -199,12 +199,12 @@ module {{moduleName}}
{{/hasConsumes}}
{{#headerParams}}
{{#required}}
header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
header_params[{{#lambdaFixHeaderKey}}:'{{{baseName}}}'{{/lambdaFixHeaderKey}}] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
{{/required}}
{{/headerParams}}
{{#headerParams}}
{{^required}}
header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
header_params[{{#lambdaFixHeaderKey}}:'{{{baseName}}}'{{/lambdaFixHeaderKey}}] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
{{/required}}
{{/headerParams}}

View File

@@ -193,8 +193,8 @@ module {{moduleName}}
# Gets access_token using access_token_getter or uses the static access_token
def access_token_with_refresh
return access_token if access_token_getter.nil?
access_token_getter.call
return access_token if access_token_getter.nil?
access_token_getter.call
end
# Gets Basic Auth token string

View File

@@ -93,7 +93,7 @@ export class {{classname}} {
{{^isArray}}
if ({{paramName}} !== undefined && {{paramName}} !== null) {
{{#isDateTime}}
queryParameters.append('{{baseName}}', <any>{{paramName}}.toISOString());
queryParameters.append('{{baseName}}', (<any>{{paramName}}).toISOString());
{{/isDateTime}}
{{^isDateTime}}
queryParameters.append('{{baseName}}', <any>{{paramName}});

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
public class AllGeneratorsTest {
@Test
public void testEachWithPetstore() throws IOException {
for (final CodegenConfig codegenConfig : CodegenConfigLoader.getAll()) {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName(codegenConfig.getName())
.setInputSpec("src/test/resources/3_0/petstore.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
// Main intention of this test is to check that nothing crashes. Besides, we check here that
// at least 1 file is generated, besides the common ".openapi-generator-ignore", "FILES" and "VERSION" files.
Assert.assertTrue(files.size() >= 4);
}
}
}

View File

@@ -83,6 +83,7 @@ import java.util.stream.Collectors;
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.assertFileNotContains;
import static org.openapitools.codegen.TestUtils.validateJavaSourceFiles;
import static org.openapitools.codegen.languages.JavaClientCodegen.USE_ENUM_CASE_INSENSITIVE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
@@ -244,6 +245,26 @@ public class JavaClientCodegenTest {
TestUtils.ensureContainsFile(files, output, "src/main/java/xyz/abcdef/auth/HttpSignatureAuth.java");
}
@Test
public void testImportMappingResult() throws IOException {
File output = Files.createTempDirectory("test").toFile();
final CodegenConfigurator configurator = new CodegenConfigurator()
.addTypeMapping("OffsetDateTime", "Instant")
.addImportMapping("OffsetDateTime", "java.time.Instant")
.setGeneratorName("java")
.setInputSpec("src/test/resources/3_0/echo_api.yaml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();
TestUtils.assertFileContains(Paths.get(output + "/src/main/java/org/openapitools/client/api/QueryApi.java"), "import java.time.Instant;");
}
@Test
public void testSupportedSecuritySchemesJersey() throws Exception {
final JavaClientCodegen codegen = new JavaClientCodegen();
@@ -2311,4 +2332,56 @@ public class JavaClientCodegenTest {
);
}
@Test
public void testEnumCaseInsensitive_issue8084() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/issue8084.yaml");
final JavaClientCodegen codegen = new JavaClientCodegen();
codegen.setOpenAPI(openAPI);
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(USE_ENUM_CASE_INSENSITIVE, "true");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
JavaFileAssert javaFileAssert = JavaFileAssert.assertThat(files.get("EnumTest.java"));
javaFileAssert
.assertMethod("fromValue")
.bodyContainsLines("if (b.value.equalsIgnoreCase(value)) {");
}
@Test
public void testEnumCaseSensitive_issue8084() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/issue8084.yaml");
final JavaClientCodegen codegen = new JavaClientCodegen();
codegen.setOpenAPI(openAPI);
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(USE_ENUM_CASE_INSENSITIVE, "false");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
JavaFileAssert javaFileAssert = JavaFileAssert.assertThat(files.get("EnumTest.java"));
javaFileAssert
.assertMethod("fromValue")
.bodyContainsLines("if (b.value.equals(value)) {");
}
}

View File

@@ -226,10 +226,10 @@ public class TypeScriptAngularClientCodegenTest {
final String modelName = "FooResponse__links";
final Schema schema = new Schema()
.name(modelName)
.description("an inline model with name previously prefixed with underscore")
.addRequiredItem("self")
.addProperty("self", new StringSchema());
.name(modelName)
.description("an inline model with name previously prefixed with underscore")
.addRequiredItem("self")
.addProperty("self", new StringSchema());
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("test", schema);
codegen.setOpenAPI(openAPI);
@@ -313,4 +313,35 @@ public class TypeScriptAngularClientCodegenTest {
"export type Token = ExpressionToken | StringToken"
);
}
@Test
public void testModelNameMappings() throws Exception {
final String specPath = "src/test/resources/2_0/issue_8289.json";
Map<String, Object> properties = new HashMap<>();
properties.put(TypeScriptAngularClientCodegen.TAGGED_UNIONS, "true");
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
Map<String, String> modelNames = new HashMap<>();
modelNames.put("File", "SystemFile");
final CodegenConfigurator configurator = new CodegenConfigurator()
.setModelNameMappings(modelNames)
.setGeneratorName("typescript-angular")
.setInputSpec(specPath)
.setAdditionalProperties(properties)
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
Generator generator = new DefaultGenerator();
generator.opts(clientOptInput).generate();
TestUtils.assertFileContains(
Paths.get(output + "/model/folder.ts"),
"files?: Array<SystemFile>;" // ensure it's an array of SystemFile (not Any)
);
}
}

View File

@@ -0,0 +1,33 @@
{
"swagger": "2.0",
"info": {
"title": "Test swagger",
"version": "0.1.0"
},
"definitions": {
"File": {
"title": "File",
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"Folder": {
"title": "Folder",
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/File"
}
}
}
}
},
"paths": {},
"host": "localhost:3000",
"schemes": ["http"]
}

View File

@@ -1019,6 +1019,13 @@ paths:
required: true
schema:
$ref: '#/definitions/Client'
- in: header
name: uuid_test
description: to test uuid example value
required: true
default: 1111-2222-3333-4444
type: string
format: uuid
responses:
'200':
description: successful operation

View File

@@ -1155,6 +1155,26 @@ paths:
responses:
200:
description: OK
/fake/parameter-array-number:
get:
tags:
- another_fake
summary: parameter array number default value
operationId: getParameterArrayNumber
parameters:
- name: array
in: header
description: array integer
required: true
schema:
type: array
items:
type: integer
default:
- 1
responses:
200:
description: OK
/values:
get:
tags:

View File

@@ -569,6 +569,26 @@ paths:
description: User not found
security:
- api_key: []
/fake/uuid_default_value_test:
get:
tags:
- fake
summary: test uuid default value
description: test uuid default value
operationId: uuid_default_value
parameters:
- name: uuid_parameter
in: header
description: test uuid default value
required: true
schema:
type: string
format: uuid
responses:
'400':
description: Invalid username supplied
'404':
description: User not found
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
@@ -746,3 +766,7 @@ components:
another_property:
type: integer
format: int32
uuid_default_value:
type: string
format: uuid
default: 1111-2222-3333-4444

View File

@@ -1253,6 +1253,24 @@ paths:
responses:
200:
description: OK
/fake/uuid_example:
get:
tags:
- fake
summary: test uuid example
operationId: fakeUuidExample
parameters:
- name: uuid_example
in: query
description: uuid example
required: true
schema:
type: string
format: uuid
example: 84529ad2-2265-4e15-b76b-c17025d848f6
responses:
"200":
description: Get successful
/fake/enum_ref_query_parameter:
get:
tags:

View File

@@ -13,7 +13,7 @@
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<!-- RELEASE_VERSION -->
<version>7.0.0</version>
<version>7.0.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<url>https://github.com/openapitools/openapi-generator</url>
<scm>

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -9,7 +9,7 @@
|------------ | ------------- | ------------- | -------------|
|**suffix** | **String** | test suffix | [optional] |
|**text** | **String** | Some text containing white spaces | [optional] |
|**date** | **OffsetDateTime** | A date | [optional] |
|**date** | **Instant** | A date | [optional] |

View File

@@ -181,7 +181,7 @@ public class Example {
defaultClient.setBasePath("http://localhost:3000");
QueryApi apiInstance = new QueryApi(defaultClient);
OffsetDateTime datetimeQuery = OffsetDateTime.now(); // OffsetDateTime |
Instant datetimeQuery = new Instant(); // Instant |
LocalDate dateQuery = LocalDate.now(); // LocalDate |
String stringQuery = "stringQuery_example"; // String |
try {
@@ -203,7 +203,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **datetimeQuery** | **OffsetDateTime**| | [optional] |
| **datetimeQuery** | **Instant**| | [optional] |
| **dateQuery** | **LocalDate**| | [optional] |
| **stringQuery** | **String**| | [optional] |
@@ -251,7 +251,7 @@ public class Example {
defaultClient.setBasePath("http://localhost:3000");
QueryApi apiInstance = new QueryApi(defaultClient);
OffsetDateTime datetimeQuery = OffsetDateTime.now(); // OffsetDateTime |
Instant datetimeQuery = new Instant(); // Instant |
LocalDate dateQuery = LocalDate.now(); // LocalDate |
String stringQuery = "stringQuery_example"; // String |
try {
@@ -275,7 +275,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **datetimeQuery** | **OffsetDateTime**| | [optional] |
| **datetimeQuery** | **Instant**| | [optional] |
| **dateQuery** | **LocalDate**| | [optional] |
| **stringQuery** | **String**| | [optional] |

View File

@@ -19,7 +19,7 @@ import org.openapitools.client.Pair;
import org.openapitools.client.model.DataQuery;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.Instant;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.StringEnumRef;
import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter;
@@ -192,7 +192,7 @@ public class QueryApi {
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryDatetimeDateString(OffsetDateTime datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
public String testQueryDatetimeDateString(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
ApiResponse<String> localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery);
return localVarResponse.getData();
}
@@ -206,7 +206,7 @@ public class QueryApi {
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryDatetimeDateStringWithHttpInfo(OffsetDateTime datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
public ApiResponse<String> testQueryDatetimeDateStringWithHttpInfo(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryDatetimeDateStringRequestBuilder(datetimeQuery, dateQuery, stringQuery);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
@@ -243,7 +243,7 @@ public class QueryApi {
}
}
private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(OffsetDateTime datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

View File

@@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -49,7 +49,7 @@ public class DataQuery extends Query {
private String text;
public static final String JSON_PROPERTY_DATE = "date";
private OffsetDateTime date;
private Instant date;
public DataQuery() {
}
@@ -104,7 +104,7 @@ public class DataQuery extends Query {
}
public DataQuery date(OffsetDateTime date) {
public DataQuery date(Instant date) {
this.date = date;
return this;
}
@@ -117,14 +117,14 @@ public class DataQuery extends Query {
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OffsetDateTime getDate() {
public Instant getDate() {
return date;
}
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDate(OffsetDateTime date) {
public void setDate(Instant date) {
this.date = date;
}

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -172,9 +171,9 @@ public class Bird {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Bird.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Bird` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -172,9 +171,9 @@ public class Category {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Category.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -46,7 +46,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -208,9 +207,9 @@ public class DataQuery extends Query {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!DataQuery.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DataQuery` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -46,7 +46,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -460,9 +459,9 @@ public class DefaultValue {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!DefaultValue.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DefaultValue` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -43,7 +43,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -203,9 +202,9 @@ public class NumberPropertiesOnly {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!NumberPropertiesOnly.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NumberPropertiesOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -46,7 +46,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -355,9 +354,9 @@ public class Pet {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Pet.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -44,7 +44,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -172,9 +171,9 @@ public class Tag {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Tag.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -228,9 +227,9 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -44,7 +44,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -154,9 +153,9 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -43,7 +43,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -304,9 +303,9 @@ public class SomeObj implements Serializable {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!SomeObj.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SomeObj` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -77,7 +77,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
}
}
}

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1 +1 @@
7.0.0-SNAPSHOT
7.0.1-SNAPSHOT

View File

@@ -1,26 +1,25 @@
-- Swagger Petstore
-- This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special_key` to test the authorization filters.
-- OpenAPI spec version: 1.0.0
-- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
-- The version of the OpenAPI document: 1.0.0
--
-- https://github.com/swagger-api/swagger-codegen.git
-- https://openapi-generator.tech
--
-- NOTE: Auto generated by the swagger code generator program.
-- NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
with "config";
with "utilada_sys";
with "utilada_xml";
with "utilada_http";
with "utilada_curl";
with "security";
with "swagger";
project Petstore is
Mains := ("petstore.adb");
for Main use Mains;
for Source_Dirs use ("src", "src/model", "src/client");
for Object_Dir use "./" & Config'Exec_Dir & "/bin";
for Object_Dir use "obj/";
for Source_Dirs use ("src", "src/model", "src/client");
Mains := ("samples-petstore-client.adb");
package Binder renames Config.Binder;
package Builder renames Config.Builder;
package Compiler renames Config.Compiler;
package Linker renames Config.Linker;
package Binder renames Config.Binder;
package Builder renames Config.Builder;
package Compiler renames Config.Compiler;
package Linker renames Config.Linker;
end Petstore;

View File

@@ -4,7 +4,7 @@
-- The version of the OpenAPI document: 1.0.0
--
--
-- NOTE: This package is auto generated by OpenAPI-Generator 7.0.0-SNAPSHOT.
-- NOTE: This package is auto generated by OpenAPI-Generator 7.0.1-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.

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