forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 5.2.x
This commit is contained in:
commit
16b141e402
@ -81,8 +81,6 @@ else
|
||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||
go version
|
||||
|
||||
installDart
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
fi
|
||||
|
@ -120,8 +120,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Nov/Dec 2021 | Minor release with breaking changes (no fallback) |
|
||||
| 5.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.0-SNAPSHOT/) | May/Jun 2021 | Minor release with breaking changes (with fallback) |
|
||||
| 5.1.0 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.1-SNAPSHOT/) | Apr/May 2021 | Patch release (enhancements, bug fixes, etc) |
|
||||
| 5.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.0-SNAPSHOT/) | May/Jun 2021 | Minor release with breaking changes (with fallback) |
|
||||
| 5.1.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.1-SNAPSHOT/) | Apr/May 2021 | Patch release (enhancements, bug fixes, etc) |
|
||||
| [5.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.1.0) (latest stable release) | 20.03.2021 | Minor release with breaking changes (with fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
|
||||
|
@ -32,7 +32,7 @@ install:
|
||||
- git clone https://github.com/wing328/swagger-samples
|
||||
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
|
||||
- ps: $PSVersionTable.PSVersion
|
||||
- ps: Install-Module Pester -Force -Scope CurrentUser
|
||||
- ps: Install-Module -Name Pester -Force -Scope CurrentUser
|
||||
build_script:
|
||||
- dotnet --info
|
||||
# build C# aspnetcore 5.0 server
|
||||
|
@ -9,4 +9,4 @@ additionalProperties:
|
||||
useCompareNetObjects: true
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
useOneOfDiscriminatorLookup: true
|
||||
targetFramework: netstandard2.1
|
||||
targetFramework: netstandard2.0
|
||||
|
@ -1,7 +0,0 @@
|
||||
generatorName: dart-jaguar
|
||||
outputDir: samples/client/petstore/dart-jaguar/flutter_petstore/openapi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
||||
additionalProperties:
|
||||
pubName: openapi
|
||||
hideGenerationTimestamp: "true"
|
@ -1,8 +0,0 @@
|
||||
generatorName: dart-jaguar
|
||||
outputDir: samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
||||
additionalProperties:
|
||||
serialization: proto
|
||||
pubName: openapi
|
||||
hideGenerationTimestamp: "true"
|
@ -1,7 +0,0 @@
|
||||
generatorName: dart-jaguar
|
||||
outputDir: samples/client/petstore/dart-jaguar/openapi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
pubName: openapi
|
@ -1,8 +0,0 @@
|
||||
generatorName: dart-jaguar
|
||||
outputDir: samples/client/petstore/dart-jaguar/openapi_proto
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
||||
additionalProperties:
|
||||
serialization: proto
|
||||
pubName: openapi
|
||||
hideGenerationTimestamp: "true"
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
# csharp-netcore test files and image for upload
|
||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
|
||||
sha256: ec34838fbbb1abb9f762949d510503b6237b607400a85c848c234c39d013a776
|
||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
|
||||
sha256: dae985015ba461297927d544a78267f2def35e07c3f14ca66468fd61e1fd1c26
|
||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"
|
||||
|
@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|artifactId|artifactId| |openapi-scala-akka-http-server|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|asManagedSources|Resulting files cab be used as managed resources. No build files or default controllers will be generated| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|
@ -28,7 +28,6 @@ import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
|
@ -16,9 +16,6 @@
|
||||
|
||||
package org.openapitools.codegen.meta;
|
||||
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package org.openapitools.codegen.plugin;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.openapitools.codegen.plugin.stubs.StubUtility;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -31,8 +31,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@ package org.openapitools.codegen.online.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.swagger.parser.OpenAPIParser;
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import java.util.TreeSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
@ -20,7 +20,6 @@ package org.openapitools.codegen;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -2615,35 +2615,47 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){
|
||||
if (schema.equals(new Schema())) {
|
||||
// if we are trying to set additionalProperties on an empty schema stop recursing
|
||||
return;
|
||||
}
|
||||
boolean additionalPropertiesIsAnyType = false;
|
||||
CodegenModel m = null;
|
||||
if (property instanceof CodegenModel) {
|
||||
m = (CodegenModel) property;
|
||||
}
|
||||
CodegenProperty addPropProp = null;
|
||||
boolean isAdditionalPropertiesTrue = false;
|
||||
if (schema.getAdditionalProperties() == null) {
|
||||
if (!disallowAdditionalPropertiesIfNotPresent) {
|
||||
isAdditionalPropertiesTrue = true;
|
||||
CodegenProperty cp = fromProperty("", new Schema());
|
||||
property.setAdditionalProperties(cp);
|
||||
property.setAdditionalPropertiesIsAnyType(true);
|
||||
addPropProp = fromProperty("", new Schema());
|
||||
additionalPropertiesIsAnyType = true;
|
||||
}
|
||||
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
||||
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
||||
isAdditionalPropertiesTrue = true;
|
||||
CodegenProperty cp = fromProperty("", new Schema());
|
||||
property.setAdditionalProperties(cp);
|
||||
property.setAdditionalPropertiesIsAnyType(true);
|
||||
addPropProp = fromProperty("", new Schema());
|
||||
additionalPropertiesIsAnyType = true;
|
||||
}
|
||||
} else {
|
||||
CodegenProperty cp = fromProperty("", (Schema) schema.getAdditionalProperties());
|
||||
property.setAdditionalProperties(cp);
|
||||
addPropProp = fromProperty("", (Schema) schema.getAdditionalProperties());
|
||||
if (isAnyTypeSchema((Schema) schema.getAdditionalProperties())) {
|
||||
property.setAdditionalPropertiesIsAnyType(true);
|
||||
additionalPropertiesIsAnyType = true;
|
||||
}
|
||||
}
|
||||
if (additionalPropertiesIsAnyType) {
|
||||
property.setAdditionalPropertiesIsAnyType(true);
|
||||
}
|
||||
if (m != null && isAdditionalPropertiesTrue) {
|
||||
m.isAdditionalPropertiesTrue = true;
|
||||
}
|
||||
if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) {
|
||||
return;
|
||||
}
|
||||
if (addPropProp != null) {
|
||||
property.setAdditionalProperties(addPropProp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6157,6 +6169,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){
|
||||
setAddProps(schema, property);
|
||||
if (!"object".equals(schema.getType())) {
|
||||
return;
|
||||
}
|
||||
@ -6178,7 +6191,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.setHasRequired(true);
|
||||
}
|
||||
}
|
||||
setAddProps(schema, property);
|
||||
}
|
||||
|
||||
private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) {
|
||||
|
@ -29,7 +29,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
@ -32,9 +32,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@ -399,7 +399,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
// check to see if model name is same as the property name
|
||||
// which will result in compilation error
|
||||
// if found, prepend with _ to workaround the limitation
|
||||
if (var.name.equalsIgnoreCase(cm.name)) {
|
||||
if (var.name.equalsIgnoreCase(cm.classname)) {
|
||||
var.name = "_" + var.name;
|
||||
}
|
||||
}
|
||||
@ -500,6 +500,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
|
||||
/* Comment out the following as model.dataType is always the model name, eg. OuterIntegerEnum,
|
||||
* and this will fix the integer enum via #9035.
|
||||
* Only x-enum-byte is used in the template but it won't work due to the bug mentioned above.
|
||||
* A better solution is to introduce isLong, isInteger, etc in the DefaultCodegen
|
||||
* so that there is no need for each generator to post-process model enums.
|
||||
*
|
||||
// We're looping all models here.
|
||||
if (model.isEnum) {
|
||||
// We now need to make allowableValues.enumVars look like the context of CodegenProperty
|
||||
@ -543,7 +549,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
if (!newEnumVars.isEmpty()) {
|
||||
model.allowableValues.put("enumVars", newEnumVars);
|
||||
}
|
||||
}
|
||||
} */
|
||||
} else {
|
||||
LOGGER.warn("Expected to retrieve model %s by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
|
||||
}
|
||||
@ -1263,8 +1269,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -330,8 +331,10 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
@ -709,8 +710,10 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
|
@ -30,9 +30,8 @@ import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.Exception;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -1124,8 +1123,10 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -830,8 +831,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
@ -941,6 +942,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return super.toDefaultValue(schema);
|
||||
}
|
||||
return null;
|
||||
} else if (ModelUtils.isComposedSchema(schema)) {
|
||||
if (schema.getDefault() != null) {
|
||||
return super.toDefaultValue(schema);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return super.toDefaultValue(schema);
|
||||
@ -1430,6 +1436,27 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessParameter(CodegenParameter p) {
|
||||
// we use a custom version of this function to remove the l, d, and f suffixes from Long/Double/Float
|
||||
// defaultValues
|
||||
// remove the l because our users will use Long.parseLong(String defaultValue)
|
||||
// remove the d because our users will use Double.parseDouble(String defaultValue)
|
||||
// remove the f because our users will use Float.parseFloat(String defaultValue)
|
||||
// NOTE: for CodegenParameters we DO need these suffixes because those defaultValues are used as java value
|
||||
// literals assigned to Long/Double/Float
|
||||
if (p.defaultValue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Boolean fixLong = (p.isLong && "l".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||
Boolean fixDouble = (p.isDouble && "d".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||
Boolean fixFloat = (p.isFloat && "f".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||
if (fixLong || fixDouble || fixFloat) {
|
||||
p.defaultValue = p.defaultValue.substring(0, p.defaultValue.length()-1);
|
||||
}
|
||||
}
|
||||
|
||||
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||
// This generator uses inline classes to define enums, which breaks when
|
||||
// dealing with models that have subTypes. To clean this up, we will analyze
|
||||
@ -1813,8 +1840,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -891,8 +892,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,11 +27,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
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;
|
||||
|
||||
@ -751,8 +749,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,8 @@ import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -281,8 +277,10 @@ abstract public class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
|
@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
@ -250,8 +251,10 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: `{}`", command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
|
||||
@ -532,8 +533,10 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
@ -35,9 +34,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -857,8 +856,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,8 +24,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
|
||||
public class Apache2ConfigCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String USER_INFO_PATH = "userInfoPath";
|
||||
|
@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@ -402,6 +403,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("Authentication" + File.separator + "ApiAuthentication.mustache", packageFolder + File.separator + "Authentication", "ApiAuthentication.cs"));
|
||||
supportingFiles.add(new SupportingFile("Formatters" + File.separator + "InputFormatterStream.mustache", packageFolder + File.separator + "Formatters", "InputFormatterStream.cs"));
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
@ -441,6 +443,68 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
operation.httpMethod = "Http" + operation.httpMethod.substring(0, 1) + operation.httpMethod.substring(1).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
super.postProcessOperationsWithModels(objs, allModels);
|
||||
// We need to postprocess the operations to add proper consumes tags and fix form file handling
|
||||
if (objs != null) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
if (operations != null) {
|
||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation operation : ops) {
|
||||
if (operation.consumes == null) {
|
||||
continue;
|
||||
}
|
||||
if (operation.consumes.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Build a consumes string for the operation we cannot iterate in the template as we need a ','
|
||||
// after each entry but the last
|
||||
|
||||
StringBuilder consumesString = new StringBuilder();
|
||||
for (Map<String, String> consume : operation.consumes) {
|
||||
if (!consume.containsKey("mediaType")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(consumesString.toString().equals("")) {
|
||||
consumesString = new StringBuilder("\"" + consume.get("mediaType") + "\"");
|
||||
}
|
||||
else {
|
||||
consumesString.append(", \"").append(consume.get("mediaType")).append("\"");
|
||||
}
|
||||
|
||||
// In a multipart/form-data consuming context binary data is best handled by an IFormFile
|
||||
if (!consume.get("mediaType").equals("multipart/form-data")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Change dataType of binary parameters to IFormFile for formParams in multipart/form-data
|
||||
for (CodegenParameter param : operation.formParams) {
|
||||
if (param.isBinary) {
|
||||
param.dataType = "IFormFile";
|
||||
param.baseType = "IFormFile";
|
||||
}
|
||||
}
|
||||
|
||||
for (CodegenParameter param : operation.allParams) {
|
||||
if (param.isBinary && param.isFormParam) {
|
||||
param.dataType = "IFormFile";
|
||||
param.baseType = "IFormFile";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!consumesString.toString().equals("")) {
|
||||
operation.vendorExtensions.put("x-aspnetcore-consumes", consumesString.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mustache.Compiler processCompiler(Mustache.Compiler compiler) {
|
||||
// To avoid unexpected behaviors when options are passed programmatically such as { "useCollection": "" }
|
||||
|
@ -21,9 +21,6 @@ import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
|
@ -28,6 +28,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -890,8 +891,10 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
|
@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
|
@ -13,8 +13,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
public class CppQt5AbstractCodegen extends AbstractCppCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(CppQt5AbstractCodegen.class);
|
||||
protected final String PREFIX = "OAI";
|
||||
|
@ -29,7 +29,6 @@ import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
|
@ -25,13 +25,13 @@ import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.templating.mustache.PrefixWithHashLambda;
|
||||
import org.openapitools.codegen.templating.mustache.TrimWhitespaceLambda;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
@ -883,8 +883,10 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
|
@ -19,16 +19,9 @@ package org.openapitools.codegen.languages;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.parameters.Parameter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -33,6 +33,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -1456,8 +1457,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class HaskellServantCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@ -694,8 +694,10 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.CXFServerFeatures;
|
||||
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
||||
@ -27,8 +26,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, UseGenericResponseFeatures {
|
||||
|
@ -17,13 +17,11 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -31,7 +31,6 @@ import java.util.Map;
|
||||
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;
|
||||
|
||||
public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
|
||||
|
@ -17,9 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||
@ -27,7 +25,6 @@ import org.openapitools.codegen.languages.features.SwaggerFeatures;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -17,15 +17,12 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -32,9 +32,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class JavascriptApolloClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@ -1135,8 +1135,10 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
}
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class JavascriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@ -1220,8 +1220,10 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
}
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
||||
|
@ -31,8 +31,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
final Logger LOGGER = LoggerFactory.getLogger(NimClientCodegen.class);
|
||||
|
||||
|
@ -36,6 +36,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
@ -445,8 +446,10 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
}
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,12 +31,11 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.escape;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@ -817,8 +816,10 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
@ -28,6 +28,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.regex.Matcher;
|
||||
@ -621,8 +622,10 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements CodegenConfig {
|
||||
|
@ -31,6 +31,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.UUID.randomUUID;
|
||||
@ -1311,8 +1312,10 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,25 +17,14 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.github.curiousoddman.rgxgen.RgxGen;
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class PythonLegacyClientCodegen extends AbstractPythonCodegen implements CodegenConfig {
|
||||
|
@ -27,9 +27,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
@ -39,6 +39,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
@ -1670,8 +1671,10 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {} {}", commandPrefix, file.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({} ()). Exception: {}", commandPrefix, file.toString(), e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,11 +40,16 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
||||
protected String invokerPackage;
|
||||
|
||||
protected String akkaHttpVersion;
|
||||
protected boolean generateAsManagedSources;
|
||||
|
||||
public static final String AKKA_HTTP_VERSION = "akkaHttpVersion";
|
||||
public static final String AKKA_HTTP_VERSION_DESC = "The version of akka-http";
|
||||
public static final String DEFAULT_AKKA_HTTP_VERSION = "10.1.10";
|
||||
|
||||
public static final String GENERATE_AS_MANAGED_SOURCES = "asManagedSources";
|
||||
public static final String GENERATE_AS_MANAGED_SOURCES_DESC = "Resulting files cab be used as managed resources. No build files or default controllers will be generated";
|
||||
public static final boolean DEFAULT_GENERATE_AS_MANAGED_SOURCES = false;
|
||||
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(ScalaAkkaHttpServerCodegen.class);
|
||||
|
||||
public CodegenType getTag() {
|
||||
@ -99,6 +104,7 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
||||
modelPackage = "org.openapitools.server.model";
|
||||
invokerPackage = "org.openapitools.server";
|
||||
akkaHttpVersion = DEFAULT_AKKA_HTTP_VERSION;
|
||||
generateAsManagedSources = DEFAULT_GENERATE_AS_MANAGED_SOURCES;
|
||||
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
@ -114,6 +120,7 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
||||
cliOptions.add(CliOption.newString(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID).defaultValue(artifactId));
|
||||
cliOptions.add(CliOption.newString(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC).defaultValue(artifactVersion));
|
||||
cliOptions.add(CliOption.newString(AKKA_HTTP_VERSION, AKKA_HTTP_VERSION_DESC).defaultValue(akkaHttpVersion));
|
||||
cliOptions.add(CliOption.newBoolean(GENERATE_AS_MANAGED_SOURCES, GENERATE_AS_MANAGED_SOURCES_DESC).defaultValue(Boolean.valueOf(DEFAULT_GENERATE_AS_MANAGED_SOURCES).toString()));
|
||||
|
||||
importMapping.remove("Seq");
|
||||
importMapping.remove("List");
|
||||
@ -141,8 +148,6 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
||||
|
||||
instantiationTypes.put("array", "ListBuffer");
|
||||
instantiationTypes.put("map", "Map");
|
||||
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -181,9 +186,19 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
||||
|
||||
parseAkkaHttpVersion();
|
||||
|
||||
|
||||
if (additionalProperties.containsKey(GENERATE_AS_MANAGED_SOURCES)) {
|
||||
generateAsManagedSources = Boolean.parseBoolean(additionalProperties.get(GENERATE_AS_MANAGED_SOURCES).toString());
|
||||
} else {
|
||||
additionalProperties.put(GENERATE_AS_MANAGED_SOURCES, Boolean.valueOf(generateAsManagedSources).toString());
|
||||
}
|
||||
|
||||
if (!generateAsManagedSources) {
|
||||
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
|
||||
supportingFiles.add(new SupportingFile("controller.mustache",
|
||||
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "Controller.scala"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("helper.mustache",
|
||||
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "AkkaHttpHelper.scala"));
|
||||
supportingFiles.add(new SupportingFile("stringDirectives.mustache",
|
||||
|
@ -28,8 +28,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
public class ScalaFinchServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(ScalaFinchServerCodegen.class);
|
||||
protected String invokerPackage = "org.openapitools.client";
|
||||
|
@ -31,7 +31,6 @@ import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
/*
|
||||
* This generator has been deprecated. Please use scala-akka instead.
|
||||
|
@ -26,7 +26,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(ScalaLagomServerCodegen.class);
|
||||
|
@ -36,7 +36,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.rightPad;
|
||||
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
||||
|
@ -874,25 +874,4 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
public void setUseOptional(boolean useOptional) {
|
||||
this.useOptional = useOptional;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessParameter(CodegenParameter p) {
|
||||
// we use a custom version of this function to remove the l, d, and f suffixes from Long/Double/Float
|
||||
// defaultValues
|
||||
// remove the l because our users will use Long.parseLong(String defaultValue)
|
||||
// remove the d because our users will use Double.parseDouble(String defaultValue)
|
||||
// remove the f because our users will use Float.parseFloat(String defaultValue)
|
||||
// NOTE: for CodegenParameters we DO need these suffixes because those defaultValues are used as java value
|
||||
// literals assigned to Long/Double/Float
|
||||
if (p.defaultValue == null) {
|
||||
return;
|
||||
}
|
||||
Boolean fixLong = (p.isLong && "l".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||
Boolean fixDouble = (p.isDouble && "d".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||
Boolean fixFloat = (p.isFloat && "f".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||
if (fixLong || fixDouble || fixFloat) {
|
||||
p.defaultValue = p.defaultValue.substring(0, p.defaultValue.length()-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfig {
|
||||
|
@ -32,6 +32,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -974,8 +975,10 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -41,7 +42,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
||||
public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(Swift5ClientCodegen.class);
|
||||
|
||||
@ -979,8 +979,10 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,6 @@ import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||
|
@ -19,11 +19,8 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.NumberSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
@ -35,7 +32,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
|
@ -19,7 +19,6 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -23,8 +23,6 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -20,7 +20,6 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.SemVer;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -17,12 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.FeatureSet;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -31,8 +28,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
public class TypeScriptRxjsClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractTypeScriptClientCodegen.class);
|
||||
|
||||
|
@ -11,8 +11,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
/**
|
||||
* This class holds data to add to `oneOf` members. Let's consider this example:
|
||||
*
|
||||
|
@ -3,7 +3,6 @@ package org.openapitools.codegen.utils;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenSecurity;
|
||||
|
||||
|
@ -11,7 +11,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -9,7 +9,6 @@ import org.openapitools.codegen.validation.GenericValidator;
|
||||
import org.openapitools.codegen.validation.ValidationRule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.openapitools.codegen.validations.oas;
|
||||
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.validation.GenericValidator;
|
||||
import org.openapitools.codegen.validation.ValidationRule;
|
||||
|
@ -124,14 +124,14 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.2"
|
||||
spring_web_version = "5.2.13.RELEASE"
|
||||
spring_web_version = "2.4.3"
|
||||
jackson_version = "2.11.3"
|
||||
jackson_databind_version = "2.11.3"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
{{/openApiNullable}}
|
||||
javax_annotation_version = "1.3.2"
|
||||
reactor_version = "3.3.10.RELEASE"
|
||||
reactor_version = "3.4.3"
|
||||
reactor_netty_version = "0.7.15.RELEASE"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "4.13.1"
|
||||
@ -141,7 +141,7 @@ dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "io.projectreactor:reactor-core:$reactor_version"
|
||||
implementation "org.springframework:spring-webflux:$spring_web_version"
|
||||
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_web_version"
|
||||
implementation "io.projectreactor.ipc:reactor-netty:$reactor_netty_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
|
@ -85,10 +85,10 @@
|
||||
<version>${reactor-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Spring WebFlux -->
|
||||
<!-- HTTP client: Springboot starter WebFlux -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webflux</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
<version>${spring-web-version}</version>
|
||||
</dependency>
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.6.2</swagger-annotations-version>
|
||||
<spring-web-version>5.2.13.RELEASE</spring-web-version>
|
||||
<spring-web-version>2.4.3</spring-web-version>
|
||||
<jackson-version>2.11.3</jackson-version>
|
||||
<jackson-databind-version>2.11.3</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
@ -157,7 +157,7 @@
|
||||
{{/openApiNullable}}
|
||||
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<reactor-version>3.3.10.RELEASE</reactor-version>
|
||||
<reactor-version>3.4.3</reactor-version>
|
||||
<reactor-netty-version>0.7.15.RELEASE</reactor-netty-version>
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
|
||||
namespace {{packageName}}.Formatters
|
||||
{
|
||||
// Input Type Formatter to allow model binding to Streams
|
||||
public class InputFormatterStream : InputFormatter
|
||||
{
|
||||
public InputFormatterStream()
|
||||
{
|
||||
SupportedMediaTypes.Add("application/octet-stream");
|
||||
SupportedMediaTypes.Add("image/jpeg");
|
||||
}
|
||||
|
||||
protected override bool CanReadType(Type type)
|
||||
{
|
||||
if (type == typeof(Stream))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
|
||||
{
|
||||
return InputFormatterResult.SuccessAsync(context.HttpContext.Request.Body);
|
||||
}
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ using Newtonsoft.Json.Serialization;{{#useSwashbuckle}}
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using {{packageName}}.Filters;{{/useSwashbuckle}}
|
||||
using {{packageName}}.Formatters;
|
||||
|
||||
namespace {{packageName}}
|
||||
{
|
||||
@ -40,7 +41,9 @@ namespace {{packageName}}
|
||||
{
|
||||
// Add framework services.
|
||||
services
|
||||
.AddMvc()
|
||||
.AddMvc(options => {
|
||||
options.InputFormatters.Insert(0, new InputFormatterStream());
|
||||
})
|
||||
.AddJsonOptions(opts =>
|
||||
{
|
||||
opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||
|
@ -1 +1 @@
|
||||
{{#isBodyParam}}[FromBody]{{&dataType}} {{paramName}}{{/isBodyParam}}
|
||||
{{#isBodyParam}}{{^isBinary}}[FromBody]{{/isBinary}}{{&dataType}} {{paramName}}{{/isBodyParam}}
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
{{#useSwashbuckle}}
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
{{/useSwashbuckle}}
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@ -26,6 +27,9 @@ namespace {{packageName}}.Controllers
|
||||
/// <response code="{{code}}">{{message}}</response>{{/responses}}
|
||||
[{{httpMethod}}]
|
||||
[Route("{{{basePathWithoutHost}}}{{{path}}}")]
|
||||
{{#vendorExtensions.x-aspnetcore-consumes}}
|
||||
[Consumes({{&vendorExtensions.x-aspnetcore-consumes}})]
|
||||
{{/vendorExtensions.x-aspnetcore-consumes}}
|
||||
[ValidateModelState]{{#useSwashbuckle}}
|
||||
[SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}}
|
||||
[SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}{{/useSwashbuckle}}
|
||||
|
@ -1 +1 @@
|
||||
{{#isFormParam}}[FromForm (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}}
|
||||
{{#isFormParam}}{{^isBinary}}[FromForm (Name = "{{baseName}}")]{{/isBinary}}{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}}
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
|
||||
namespace {{packageName}}.Formatters
|
||||
{
|
||||
// Input Type Formatter to allow model binding to Streams
|
||||
public class InputFormatterStream : InputFormatter
|
||||
{
|
||||
public InputFormatterStream()
|
||||
{
|
||||
SupportedMediaTypes.Add("application/octet-stream");
|
||||
SupportedMediaTypes.Add("image/jpeg");
|
||||
}
|
||||
|
||||
protected override bool CanReadType(Type type)
|
||||
{
|
||||
if (type == typeof(Stream))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
|
||||
{
|
||||
return InputFormatterResult.SuccessAsync(context.HttpContext.Request.Body);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ using Swashbuckle.AspNetCore.Swagger;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using {{packageName}}.Filters;{{/useSwashbuckle}}
|
||||
using {{packageName}}.Authentication;
|
||||
using {{packageName}}.Formatters;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace {{packageName}}
|
||||
@ -56,7 +57,10 @@ namespace {{packageName}}
|
||||
|
||||
// Add framework services.
|
||||
services
|
||||
.AddMvc({{^useDefaultRouting}}opts => opts.EnableEndpointRouting = false{{/useDefaultRouting}})
|
||||
.AddMvc(opts => {
|
||||
{{^useDefaultRouting}}opts.EnableEndpointRouting = false;{{/useDefaultRouting}}
|
||||
opts.InputFormatters.Insert(0, new InputFormatterStream());
|
||||
})
|
||||
{{#compatibilityVersion}}
|
||||
.SetCompatibilityVersion(CompatibilityVersion.{{compatibilityVersion}})
|
||||
{{/compatibilityVersion}}
|
||||
|
@ -1 +1 @@
|
||||
{{#isBodyParam}}[FromBody]{{&dataType}} {{paramName}}{{/isBodyParam}}
|
||||
{{#isBodyParam}}{{^isBinary}}[FromBody]{{/isBinary}}{{&dataType}} {{paramName}}{{/isBodyParam}}
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
{{/operationResultTask}}
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
{{#useSwashbuckle}}
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
@ -42,6 +43,9 @@ namespace {{apiPackage}}
|
||||
[Authorize{{#scopes}}{{#-first}}(Roles = "{{/-first}}{{scope}}{{^-last}},{{/-last}}{{#-last}}"){{/-last}}{{/scopes}}]
|
||||
{{/isBasicBearer}}
|
||||
{{/authMethods}}
|
||||
{{#vendorExtensions.x-aspnetcore-consumes}}
|
||||
[Consumes({{&vendorExtensions.x-aspnetcore-consumes}})]
|
||||
{{/vendorExtensions.x-aspnetcore-consumes}}
|
||||
[ValidateModelState]{{#useSwashbuckle}}
|
||||
[SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}}
|
||||
[SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}{{/useSwashbuckle}}{{^useSwashbuckle}}{{#responses}}{{#dataType}}
|
||||
|
@ -1 +1 @@
|
||||
{{#isFormParam}}[FromForm (Name = "{{baseName}}")]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}}
|
||||
{{#isFormParam}}{{^isBinary}}[FromForm (Name = "{{baseName}}")]{{/isBinary}}{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}}
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
|
||||
namespace {{packageName}}.Formatters
|
||||
{
|
||||
// Input Type Formatter to allow model binding to Streams
|
||||
public class InputFormatterStream : InputFormatter
|
||||
{
|
||||
public InputFormatterStream()
|
||||
{
|
||||
SupportedMediaTypes.Add("application/octet-stream");
|
||||
SupportedMediaTypes.Add("image/jpeg");
|
||||
}
|
||||
|
||||
protected override bool CanReadType(Type type)
|
||||
{
|
||||
if (type == typeof(Stream))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
|
||||
{
|
||||
return InputFormatterResult.SuccessAsync(context.HttpContext.Request.Body);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user