adding Intellij style xml and applied to all java code (#20734)

* added intellij-codestyle.xml and sample of it being applied to some java code-gen classes

* code-format changes ONLY

* few more format changes since last merge with master

* applied code-style to all java one last time
This commit is contained in:
Ron Reynolds 2025-03-03 09:44:48 -08:00 committed by GitHub
parent 3ad5303f99
commit 2cff152e2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
481 changed files with 5502 additions and 5688 deletions

9
intellij-codestyle.xml Normal file
View File

@ -0,0 +1,9 @@
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="DO_NOT_WRAP_AFTER_SINGLE_ANNOTATION" value="true" />
<option name="DO_NOT_WRAP_AFTER_SINGLE_ANNOTATION_IN_PARAMETER" value="true" />
</JavaCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>
</code_scheme>

View File

@ -1,7 +1,8 @@
package org.openapitools.codegen; package org.openapitools.codegen;
public class Constants { public class Constants {
private Constants(){ } private Constants() {
}
public static final String CLI_NAME = "openapi-generator-cli"; public static final String CLI_NAME = "openapi-generator-cli";
public static final String GIT_REPO = "https://github.com/openapitools/openapi-generator"; public static final String GIT_REPO = "https://github.com/openapitools/openapi-generator";

View File

@ -20,11 +20,7 @@ package org.openapitools.codegen.cmd;
import io.airlift.airline.Command; import io.airlift.airline.Command;
import io.airlift.airline.Option; import io.airlift.airline.Option;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption; import org.openapitools.codegen.*;
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenConfigLoader;
import org.openapitools.codegen.GeneratorNotFoundException;
import org.openapitools.codegen.VendorExtension;
import org.openapitools.codegen.meta.FeatureSet; import org.openapitools.codegen.meta.FeatureSet;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -37,8 +33,8 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.apache.commons.text.StringEscapeUtils.escapeHtml4;
import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.text.StringEscapeUtils.escapeHtml4;
@SuppressWarnings({"unused", "java:S106", "java:S1192"}) @SuppressWarnings({"unused", "java:S106", "java:S1192"})
@Command(name = "config-help", description = "Config help for chosen lang") @Command(name = "config-help", description = "Config help for chosen lang")

View File

@ -17,18 +17,10 @@
package org.openapitools.codegen.cmd; package org.openapitools.codegen.cmd;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.*;
import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.spi.FilterAttachable; import ch.qos.logback.core.spi.FilterAttachable;
import io.airlift.airline.Command; import io.airlift.airline.Command;
import io.airlift.airline.Option; import io.airlift.airline.Option;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.config.CodegenConfigurator;
@ -36,6 +28,14 @@ import org.openapitools.codegen.config.MergedSpecBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.*;
@SuppressWarnings({"java:S106"}) @SuppressWarnings({"java:S106"})
@Command(name = "generate", description = "Generate code with the specified generator.") @Command(name = "generate", description = "Generate code with the specified generator.")
public class Generate extends OpenApiGeneratorCommand { public class Generate extends OpenApiGeneratorCommand {

View File

@ -18,7 +18,6 @@ package org.openapitools.codegen.cmd;
import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.LoggerContext;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.*;
@ -26,7 +25,6 @@ import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
import com.fasterxml.jackson.databind.deser.std.DelegatingDeserializer; import com.fasterxml.jackson.databind.deser.std.DelegatingDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.util.TokenBuffer; import com.fasterxml.jackson.databind.util.TokenBuffer;
import io.airlift.airline.Arguments; import io.airlift.airline.Arguments;
import io.airlift.airline.Command; import io.airlift.airline.Command;
import io.airlift.airline.Option; import io.airlift.airline.Option;

View File

@ -1,10 +1,8 @@
package org.openapitools.codegen.cmd; package org.openapitools.codegen.cmd;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import io.airlift.airline.Command; import io.airlift.airline.Command;
import io.airlift.airline.Option; import io.airlift.airline.Option;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenConfigLoader; import org.openapitools.codegen.CodegenConfigLoader;

View File

@ -17,9 +17,7 @@
package org.openapitools.codegen.cmd; package org.openapitools.codegen.cmd;
import static ch.lambdaj.collection.LambdaCollections.with; import ch.lambdaj.function.convert.Converter;
import static com.google.common.base.Joiner.on;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -31,9 +29,9 @@ import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.TemplateManager; import org.openapitools.codegen.TemplateManager;
import org.openapitools.codegen.api.TemplatePathLocator; import org.openapitools.codegen.api.TemplatePathLocator;
import org.openapitools.codegen.templating.CommonTemplateContentLocator;
import org.openapitools.codegen.templating.MustacheEngineAdapter; import org.openapitools.codegen.templating.MustacheEngineAdapter;
import org.openapitools.codegen.templating.TemplateManagerOptions; import org.openapitools.codegen.templating.TemplateManagerOptions;
import org.openapitools.codegen.templating.CommonTemplateContentLocator;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -43,7 +41,8 @@ import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import ch.lambdaj.function.convert.Converter; import static ch.lambdaj.collection.LambdaCollections.with;
import static com.google.common.base.Joiner.on;
/** /**
* User: lanwen Date: 24.03.15 Time: 20:22 * User: lanwen Date: 24.03.15 Time: 20:22

View File

@ -19,7 +19,6 @@ package org.openapitools.codegen.cmd;
import io.airlift.airline.Command; import io.airlift.airline.Command;
import io.airlift.airline.Option; import io.airlift.airline.Option;
import io.swagger.parser.OpenAPIParser; import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.AuthorizationValue; import io.swagger.v3.parser.core.models.AuthorizationValue;

View File

@ -17,8 +17,8 @@
package org.openapitools.codegen.cmd.utils; package org.openapitools.codegen.cmd.utils;
import org.openapitools.codegen.utils.OptionUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.openapitools.codegen.utils.OptionUtils;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Collections; import java.util.Collections;

View File

@ -27,7 +27,6 @@ public abstract class AbstractTemplatingEngineAdapter implements TemplatingEngin
* Gets all possible template paths for a given location. * Gets all possible template paths for a given location.
* *
* @param location The full location of the template. * @param location The full location of the template.
*
* @return A new array of locations, modified according to the extensions or other adapter rules. * @return A new array of locations, modified according to the extensions or other adapter rules.
*/ */
protected String[] getModifiedFileLocation(String location) { protected String[] getModifiedFileLocation(String location) {
@ -44,7 +43,6 @@ public abstract class AbstractTemplatingEngineAdapter implements TemplatingEngin
* Returns the path without an extension for an input location. * Returns the path without an extension for an input location.
* *
* @param location The location of the file, with original file extension intact. * @param location The location of the file, with original file extension intact.
*
* @return The full path, without extension (e.g. /path/to/file.txt => /path/to/file) * @return The full path, without extension (e.g. /path/to/file.txt => /path/to/file)
*/ */
private String getPathWithoutExtension(String location) { private String getPathWithoutExtension(String location) {

View File

@ -94,7 +94,9 @@ public class TemplateDefinition {
this.templateType = templateType; this.templateType = templateType;
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
@ -106,13 +108,17 @@ public class TemplateDefinition {
getTemplateType() == that.getTemplateType(); getTemplateType() == that.getTemplateType();
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(getTemplateFile(), getFolder(), getDestinationFilename(), getTemplateType()); return Objects.hash(getTemplateFile(), getFolder(), getDestinationFilename(), getTemplateType());
} }
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public String toString() { public String toString() {
return new StringJoiner(", ", TemplateDefinition.class.getSimpleName() + "[", "]") return new StringJoiner(", ", TemplateDefinition.class.getSimpleName() + "[", "]")

View File

@ -17,16 +17,22 @@ public enum TemplateFileType {
private final String templateType; private final String templateType;
TemplateFileType(String templateType) { this.templateType = templateType; } TemplateFileType(String templateType) {
this.templateType = templateType;
}
/** /**
* Returns the value for this template file type * Returns the value for this template file type
* *
* @return The template type of this enum. * @return The template type of this enum.
*/ */
public String value() { return this.templateType; } public String value() {
return this.templateType;
}
/** {@inheritDoc} */ /**
* {@inheritDoc}
*/
@Override @Override
public String toString() { public String toString() {
return new StringJoiner(", ", TemplateFileType.class.getSimpleName() + "[", "]") return new StringJoiner(", ", TemplateFileType.class.getSimpleName() + "[", "]")

View File

@ -15,7 +15,6 @@ public interface TemplateProcessor {
* @param data Input data * @param data Input data
* @param template Input template location * @param template Input template location
* @param target The targeted file output location * @param target The targeted file output location
*
* @return The actual file * @return The actual file
* @throws IOException If file cannot be written. * @throws IOException If file cannot be written.
*/ */
@ -53,5 +52,6 @@ public interface TemplateProcessor {
* @param path The path which has caused an error * @param path The path which has caused an error
* @param context The reason for the error * @param context The reason for the error
*/ */
default void error(Path path, String context) { } default void error(Path path, String context) {
}
} }

View File

@ -47,8 +47,8 @@ public interface TemplatingEngineAdapter {
/** /**
* Determine if the adapter handles compilation of the file * Determine if the adapter handles compilation of the file
* @param filename The template filename
* *
* @param filename The template filename
* @return True if the file should be compiled by this adapter, else false. * @return True if the file should be compiled by this adapter, else false.
*/ */
default boolean handlesFile(String filename) { default boolean handlesFile(String filename) {

View File

@ -17,6 +17,7 @@
package org.openapitools.codegen.api; package org.openapitools.codegen.api;
// TODO: 6.0 Remove // TODO: 6.0 Remove
/** /**
* interface to the full template content * interface to the full template content
* implementers might take into account the -t cli option, * implementers might take into account the -t cli option,

View File

@ -383,7 +383,6 @@ public class FeatureSet {
* Includes the defined {@link ClientModificationFeature} to the new/existing set of supported features. * Includes the defined {@link ClientModificationFeature} to the new/existing set of supported features.
* *
* @param clientModificationFeature One or more {@code clientModificationFeature} to ensure are included in the set. * @param clientModificationFeature One or more {@code clientModificationFeature} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeClientModificationFeatures(ClientModificationFeature... clientModificationFeature) { public Builder includeClientModificationFeatures(ClientModificationFeature... clientModificationFeature) {
@ -395,7 +394,6 @@ public class FeatureSet {
* Excludes the defined {@link ClientModificationFeature} from the set of supported features. * Excludes the defined {@link ClientModificationFeature} from the set of supported features.
* *
* @param clientModificationFeature One or more {@code clientModificationFeature} to ensure are excluded from the set. * @param clientModificationFeature One or more {@code clientModificationFeature} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeClientModificationFeatures(ClientModificationFeature... clientModificationFeature) { public Builder excludeClientModificationFeatures(ClientModificationFeature... clientModificationFeature) {
@ -422,7 +420,6 @@ public class FeatureSet {
* Includes the defined {@link DataTypeFeature} to the new/existing set of supported features. * Includes the defined {@link DataTypeFeature} to the new/existing set of supported features.
* *
* @param dataTypeFeature One or more {@code dataTypeFeature} to ensure are included in the set. * @param dataTypeFeature One or more {@code dataTypeFeature} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeDataTypeFeatures(DataTypeFeature... dataTypeFeature) { public Builder includeDataTypeFeatures(DataTypeFeature... dataTypeFeature) {
@ -434,7 +431,6 @@ public class FeatureSet {
* Excludes the defined {@link DataTypeFeature} from the set of supported features. * Excludes the defined {@link DataTypeFeature} from the set of supported features.
* *
* @param dataTypeFeature One or more {@code dataTypeFeature} to ensure are excluded from the set. * @param dataTypeFeature One or more {@code dataTypeFeature} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeDataTypeFeatures(DataTypeFeature... dataTypeFeature) { public Builder excludeDataTypeFeatures(DataTypeFeature... dataTypeFeature) {
@ -461,7 +457,6 @@ public class FeatureSet {
* Includes the defined {@link DocumentationFeature} to the new/existing set of supported features. * Includes the defined {@link DocumentationFeature} to the new/existing set of supported features.
* *
* @param documentationFeature One or more {@code documentationFeature} to ensure are included in the set. * @param documentationFeature One or more {@code documentationFeature} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeDocumentationFeatures(DocumentationFeature... documentationFeature) { public Builder includeDocumentationFeatures(DocumentationFeature... documentationFeature) {
@ -473,7 +468,6 @@ public class FeatureSet {
* Excludes the defined {@link DocumentationFeature} from the set of supported features. * Excludes the defined {@link DocumentationFeature} from the set of supported features.
* *
* @param documentationFeature One or more {@code documentationFeature} to ensure are excluded from the set. * @param documentationFeature One or more {@code documentationFeature} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeDocumentationFeatures(DocumentationFeature... documentationFeature) { public Builder excludeDocumentationFeatures(DocumentationFeature... documentationFeature) {
@ -500,7 +494,6 @@ public class FeatureSet {
* Includes the defined {@link SchemaSupportFeature} to the new/existing set of supported features. * Includes the defined {@link SchemaSupportFeature} to the new/existing set of supported features.
* *
* @param schemaSupportFeature One or more {@code schemaSupportFeature} to ensure are included in the set. * @param schemaSupportFeature One or more {@code schemaSupportFeature} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeSchemaSupportFeatures(SchemaSupportFeature... schemaSupportFeature) { public Builder includeSchemaSupportFeatures(SchemaSupportFeature... schemaSupportFeature) {
@ -512,7 +505,6 @@ public class FeatureSet {
* Excludes the defined {@link SchemaSupportFeature} from the set of supported features. * Excludes the defined {@link SchemaSupportFeature} from the set of supported features.
* *
* @param schemaSupportFeature One or more {@code schemaSupportFeature} to ensure are excluded from the set. * @param schemaSupportFeature One or more {@code schemaSupportFeature} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeSchemaSupportFeatures(SchemaSupportFeature... schemaSupportFeature) { public Builder excludeSchemaSupportFeatures(SchemaSupportFeature... schemaSupportFeature) {
@ -539,7 +531,6 @@ public class FeatureSet {
* Includes the defined {@link ParameterFeature} to the new/existing set of supported features. * Includes the defined {@link ParameterFeature} to the new/existing set of supported features.
* *
* @param parameterFeature One or more {@code parameterFeature} to ensure are included in the set. * @param parameterFeature One or more {@code parameterFeature} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeParameterFeatures(ParameterFeature... parameterFeature) { public Builder includeParameterFeatures(ParameterFeature... parameterFeature) {
@ -551,7 +542,6 @@ public class FeatureSet {
* Excludes the defined {@link ParameterFeature} from the set of supported features. * Excludes the defined {@link ParameterFeature} from the set of supported features.
* *
* @param parameterFeature One or more {@code parameterFeature} to ensure are excluded from the set. * @param parameterFeature One or more {@code parameterFeature} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeParameterFeatures(ParameterFeature... parameterFeature) { public Builder excludeParameterFeatures(ParameterFeature... parameterFeature) {
@ -578,7 +568,6 @@ public class FeatureSet {
* Includes the defined {@link SecurityFeature} to the new/existing set of supported features. * Includes the defined {@link SecurityFeature} to the new/existing set of supported features.
* *
* @param securityFeature One or more {@code securityFeature} to ensure are included in the set. * @param securityFeature One or more {@code securityFeature} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeSecurityFeatures(SecurityFeature... securityFeature) { public Builder includeSecurityFeatures(SecurityFeature... securityFeature) {
@ -590,7 +579,6 @@ public class FeatureSet {
* Excludes the defined {@link SecurityFeature} from the set of supported features. * Excludes the defined {@link SecurityFeature} from the set of supported features.
* *
* @param securityFeature One or more {@code securityFeature} to ensure are excluded from the set. * @param securityFeature One or more {@code securityFeature} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeSecurityFeatures(SecurityFeature... securityFeature) { public Builder excludeSecurityFeatures(SecurityFeature... securityFeature) {
@ -617,7 +605,6 @@ public class FeatureSet {
* Includes the defined {@link GlobalFeature} to the new/existing set of supported features. * Includes the defined {@link GlobalFeature} to the new/existing set of supported features.
* *
* @param globalFeature One or more {@code globalFeatures} to ensure are included in the set. * @param globalFeature One or more {@code globalFeatures} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeGlobalFeatures(GlobalFeature... globalFeature) { public Builder includeGlobalFeatures(GlobalFeature... globalFeature) {
@ -629,7 +616,6 @@ public class FeatureSet {
* Excludes the defined {@link GlobalFeature} from the set of supported features. * Excludes the defined {@link GlobalFeature} from the set of supported features.
* *
* @param globalFeature One or more {@code globalFeatures} to ensure are excluded from the set. * @param globalFeature One or more {@code globalFeatures} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeGlobalFeatures(GlobalFeature... globalFeature) { public Builder excludeGlobalFeatures(GlobalFeature... globalFeature) {
@ -656,7 +642,6 @@ public class FeatureSet {
* Includes the defined {@link WireFormatFeature} to the new/existing set of supported features. * Includes the defined {@link WireFormatFeature} to the new/existing set of supported features.
* *
* @param wireFormatFeature One or more {@code wireFormatFeatures} to ensure are included in the set. * @param wireFormatFeature One or more {@code wireFormatFeatures} to ensure are included in the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder includeWireFormatFeatures(WireFormatFeature... wireFormatFeature) { public Builder includeWireFormatFeatures(WireFormatFeature... wireFormatFeature) {
@ -672,7 +657,6 @@ public class FeatureSet {
* </p> * </p>
* *
* @param wireFormatFeature One or more {@code wireFormatFeatures} to ensure are excluded from the set. * @param wireFormatFeature One or more {@code wireFormatFeatures} to ensure are excluded from the set.
*
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder excludeWireFormatFeatures(WireFormatFeature... wireFormatFeature) { public Builder excludeWireFormatFeatures(WireFormatFeature... wireFormatFeature) {

View File

@ -49,7 +49,9 @@ public enum Stability {
* *
* @return The descriptive value of this enum. * @return The descriptive value of this enum.
*/ */
public String value() { return description; } public String value() {
return description;
}
public static Stability forDescription(String description) { public static Stability forDescription(String description) {
for (Stability value : values()) { for (Stability value : values()) {

View File

@ -23,7 +23,7 @@ import org.openapitools.codegen.meta.features.annotations.ToolingExtension;
/** /**
* Defines common data types supported by a generator. * Defines common data types supported by a generator.
* Some of these features are defined in specs, and some are specific to the tool. * Some of these features are defined in specs, and some are specific to the tool.
* * <p>
* Where data types are listed as tool-specific, this either indicates that the data type is common enough that it is an officially * Where data types are listed as tool-specific, this either indicates that the data type is common enough that it is an officially
* supported custom data type by the toolset (see {@link DataTypeFeature#Decimal}), or that the consideration of a special type isn't * supported custom data type by the toolset (see {@link DataTypeFeature#Decimal}), or that the consideration of a special type isn't
* explicitly mentioned by the specification(s) but differs enough across languages that it warrants a special callout (see {@link DataTypeFeature#ArrayOfModel}). * explicitly mentioned by the specification(s) but differs enough across languages that it warrants a special callout (see {@link DataTypeFeature#ArrayOfModel}).

View File

@ -53,7 +53,7 @@ public enum ParameterFeature {
/** /**
* Supports form encoded parameters. * Supports form encoded parameters.
* * <p>
* OAS 3.x specification supports this structurally via content types rather than as an "in" parameter. * OAS 3.x specification supports this structurally via content types rather than as an "in" parameter.
*/ */
@OAS2 @OAS2

View File

@ -54,11 +54,11 @@ public enum SchemaSupportFeature {
* *
* <p> * <p>
* This means that a single "Type" in generated code may refer to one of any type in a set of 2 or more types. * This means that a single "Type" in generated code may refer to one of any type in a set of 2 or more types.
* * <p>
* This is defined as a union as "OneOf" support is not explicitly limited to physical boundaries in OpenAPI Specification. The * This is defined as a union as "OneOf" support is not explicitly limited to physical boundaries in OpenAPI Specification. The
* implementation of such a type is easily represented dynamically (a JSON object), but requires explicit language support and * implementation of such a type is easily represented dynamically (a JSON object), but requires explicit language support and
* potentially a custom implementation (typed instances). * potentially a custom implementation (typed instances).
* * <p>
* Note that a generator may support "Unions" very loosely by returning an Object/Any/ref/interface{} type, leaving onus * Note that a generator may support "Unions" very loosely by returning an Object/Any/ref/interface{} type, leaving onus
* on type determination to the consumer. This does *NOT* suggest generated code implements a "Union Type". * on type determination to the consumer. This does *NOT* suggest generated code implements a "Union Type".
* </p> * </p>

View File

@ -39,7 +39,6 @@ public class GenericValidator<TInput> implements Validator<TInput> {
* Validates input, resulting in a instance of {@link ValidationResult} which provides details on all validations performed (success, error, warning). * Validates input, resulting in a instance of {@link ValidationResult} which provides details on all validations performed (success, error, warning).
* *
* @param input The object instance to be validated. * @param input The object instance to be validated.
*
* @return A {@link ValidationResult} which details the success, error, and warning validation results. * @return A {@link ValidationResult} which details the success, error, and warning validation results.
*/ */
@Override @Override

View File

@ -48,19 +48,18 @@ public abstract class Validated {
* *
* @param rule The rule which was evaluated. * @param rule The rule which was evaluated.
* @param message The message to display to a user. * @param message The message to display to a user.
*
* @return A {@link Validated} instance representing an invalid state according to the rule. * @return A {@link Validated} instance representing an invalid state according to the rule.
*/ */
public static Validated invalid(ValidationRule rule, String message) { public static Validated invalid(ValidationRule rule, String message) {
return new Invalid(rule, message); return new Invalid(rule, message);
} }
/** /**
* Creates an instance of an {@link Invalid} validation state. * Creates an instance of an {@link Invalid} validation state.
* *
* @param rule The rule which was evaluated. * @param rule The rule which was evaluated.
* @param message The message to display to a user. * @param message The message to display to a user.
* @param details Additional contextual details related to the invalid state. * @param details Additional contextual details related to the invalid state.
*
* @return A {@link Validated} instance representing an invalid state according to the rule. * @return A {@link Validated} instance representing an invalid state according to the rule.
*/ */
public static Validated invalid(ValidationRule rule, String message, String details) { public static Validated invalid(ValidationRule rule, String message, String details) {
@ -71,7 +70,6 @@ public abstract class Validated {
* Creates an instance of an {@link Valid} validation state. * Creates an instance of an {@link Valid} validation state.
* *
* @param rule The rule which was evaluated. * @param rule The rule which was evaluated.
*
* @return A {@link Validated} instance representing a valid state according to the rule. * @return A {@link Validated} instance representing a valid state according to the rule.
*/ */
public static Validated valid(ValidationRule rule) { public static Validated valid(ValidationRule rule) {

View File

@ -57,7 +57,6 @@ public class ValidationRule {
* Evaluate an instance of an object against this rule. * Evaluate an instance of an object against this rule.
* *
* @param input The instance to be evaluated. * @param input The instance to be evaluated.
*
* @return <code>true</code> if the object state is valid according to this rule, otherwise <code>false</code>. * @return <code>true</code> if the object state is valid according to this rule, otherwise <code>false</code>.
*/ */
public Result evaluate(Object input) { public Result evaluate(Object input) {
@ -102,7 +101,6 @@ public class ValidationRule {
* @param fn The test condition to be applied as a part of this rule, when this function returns <code>true</code>, * @param fn The test condition to be applied as a part of this rule, when this function returns <code>true</code>,
* the evaluated instance will be considered "valid" according to this rule. * the evaluated instance will be considered "valid" according to this rule.
* @param <T> The type of the object being evaluated. * @param <T> The type of the object being evaluated.
*
* @return A new instance of a {@link ValidationRule} * @return A new instance of a {@link ValidationRule}
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -117,7 +115,6 @@ public class ValidationRule {
* @param fn The test condition to be applied as a part of this rule, when this function returns <code>true</code>, * @param fn The test condition to be applied as a part of this rule, when this function returns <code>true</code>,
* the evaluated instance will be considered "valid" according to this rule. * the evaluated instance will be considered "valid" according to this rule.
* @param <T> The type of the object being evaluated. * @param <T> The type of the object being evaluated.
*
* @return A new instance of a {@link ValidationRule} * @return A new instance of a {@link ValidationRule}
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -133,7 +130,6 @@ public class ValidationRule {
* @param fn The test condition to be applied as a part of this rule, when this function returns <code>true</code>, * @param fn The test condition to be applied as a part of this rule, when this function returns <code>true</code>,
* the evaluated instance will be considered "valid" according to this rule. * the evaluated instance will be considered "valid" according to this rule.
* @param <T> The type of the object being evaluated. * @param <T> The type of the object being evaluated.
*
* @return A new instance of a {@link ValidationRule} * @return A new instance of a {@link ValidationRule}
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -164,17 +160,24 @@ public class ValidationRule {
} }
public abstract boolean passed(); public abstract boolean passed();
public final boolean failed() { return !passed(); }
public final boolean failed() {
return !passed();
}
public Throwable getThrowable() { public Throwable getThrowable() {
return throwable; return throwable;
} }
public boolean thrown() { return this.throwable == null; } public boolean thrown() {
return this.throwable == null;
}
} }
public static final class Pass extends Result { public static final class Pass extends Result {
public static Result empty() { return new Pass(); } public static Result empty() {
return new Pass();
}
public Pass() { public Pass() {
super(); super();
@ -192,7 +195,9 @@ public class ValidationRule {
} }
public static final class Fail extends Result { public static final class Fail extends Result {
public static Result empty() { return new Fail(); } public static Result empty() {
return new Fail();
}
public Fail() { public Fail() {
super(); super();

View File

@ -27,7 +27,6 @@ public interface Validator<TInput> {
* Validates input, resulting in a instance of {@link ValidationResult} which provides details on all validations performed (success, error, warning). * Validates input, resulting in a instance of {@link ValidationResult} which provides details on all validations performed (success, error, warning).
* *
* @param input The object instance to be validated. * @param input The object instance to be validated.
*
* @return A {@link ValidationResult} which details the success, error, and warning validation results. * @return A {@link ValidationResult} which details the success, error, and warning validation results.
*/ */
ValidationResult validate(TInput input); ValidationResult validate(TInput input);

View File

@ -120,6 +120,7 @@ public class WorkflowSettingsTest {
WorkflowSettings defaults = WorkflowSettings.newBuilder().build(); WorkflowSettings defaults = WorkflowSettings.newBuilder().build();
assertOnChangesToDefaults(defaults); assertOnChangesToDefaults(defaults);
} }
@Test @Test
public void customOutputDirIsSet() { public void customOutputDirIsSet() {
WorkflowSettings settings = WorkflowSettings.newBuilder() WorkflowSettings settings = WorkflowSettings.newBuilder()

View File

@ -18,12 +18,13 @@ package org.openapitools.codegen.validation;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.testng.Assert.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
public class GenericValidatorTest { public class GenericValidatorTest {
static class Person { static class Person {
private int age; private int age;

View File

@ -18,7 +18,8 @@ package org.openapitools.codegen.validation;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.testng.Assert.*; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
public class ValidatedTest { public class ValidatedTest {
@Test @Test

View File

@ -18,7 +18,8 @@ package org.openapitools.codegen.validation;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.testng.Assert.*; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
public class ValidationRuleTest { public class ValidationRuleTest {
static class Sample { static class Sample {

View File

@ -30,11 +30,13 @@ import lombok.Setter;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.*; import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper; import org.apache.maven.project.MavenProjectHelper;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
@ -49,7 +51,10 @@ import org.sonatype.plexus.build.incremental.DefaultBuildContext;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.*; import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.MessageFormat; import java.text.MessageFormat;
@ -1014,6 +1019,7 @@ public class CodeGenMojo extends AbstractMojo {
/** /**
* Try to parse inputSpec setting string into URL * Try to parse inputSpec setting string into URL
*
* @return A valid URL or null if inputSpec is not a valid URL * @return A valid URL or null if inputSpec is not a valid URL
*/ */
private URL inputSpecRemoteUrl() { private URL inputSpecRemoteUrl() {
@ -1026,6 +1032,7 @@ public class CodeGenMojo extends AbstractMojo {
/** /**
* Get specification hash file * Get specification hash file
*
* @param inputSpecFile - Openapi specification input file to calculate its hash. * @param inputSpecFile - Openapi specification input file to calculate its hash.
* Does not take into account if input spec is hosted on remote resource * Does not take into account if input spec is hosted on remote resource
* @return a file with previously calculated hash * @return a file with previously calculated hash

View File

@ -17,10 +17,9 @@
package org.openapitools.codegen.online.api; package org.openapitools.codegen.online.api;
import java.io.IOException;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ApiOriginFilter implements javax.servlet.Filter { public class ApiOriginFilter implements javax.servlet.Filter {

View File

@ -42,8 +42,8 @@ public interface GenApiDelegate {
} }
/** /**
* @see GenApi#clientOptions
* @return A {@link ResponseEntity} listing options for the target client generator. * @return A {@link ResponseEntity} listing options for the target client generator.
* @see GenApi#clientOptions
*/ */
default ResponseEntity<List<String>> clientOptions() { default ResponseEntity<List<String>> clientOptions() {
getRequest().ifPresent(request -> { getRequest().ifPresent(request -> {
@ -60,8 +60,8 @@ public interface GenApiDelegate {
/** /**
* @param fileId The unique id of the file, provided in a {@link ResponseCode} response. * @param fileId The unique id of the file, provided in a {@link ResponseCode} response.
* @see GenApi#downloadFile
* @return A {@link ResponseEntity} of the requested {@link Resource}. * @return A {@link ResponseEntity} of the requested {@link Resource}.
* @see GenApi#downloadFile
*/ */
default ResponseEntity<Resource> downloadFile(String fileId) { default ResponseEntity<Resource> downloadFile(String fileId) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -71,8 +71,8 @@ public interface GenApiDelegate {
/** /**
* @param language The target generator (language is a misnomer here, but kept for API consistency). * @param language The target generator (language is a misnomer here, but kept for API consistency).
* @param generatorInput The configuration settings to be used during client generation. * @param generatorInput The configuration settings to be used during client generation.
* @see GenApi#generateClient
* @return A {@link ResponseEntity} referencing the unique download id and a link to download the requested client code. * @return A {@link ResponseEntity} referencing the unique download id and a link to download the requested client code.
* @see GenApi#generateClient
*/ */
default ResponseEntity<ResponseCode> generateClient(String language, default ResponseEntity<ResponseCode> generateClient(String language,
GeneratorInput generatorInput) { GeneratorInput generatorInput) {
@ -91,8 +91,8 @@ public interface GenApiDelegate {
/** /**
* @param framework The target generator name (framework is a slight misnomer here, as we may have a framework like Spring implemented in multiple languages). * @param framework The target generator name (framework is a slight misnomer here, as we may have a framework like Spring implemented in multiple languages).
* @param generatorInput The configuration settings to be used during server generation. * @param generatorInput The configuration settings to be used during server generation.
* @see GenApi#generateServerForLanguage
* @return A {@link ResponseEntity} referencing the unique download id and a link to download the requested server code. * @return A {@link ResponseEntity} referencing the unique download id and a link to download the requested server code.
* @see GenApi#generateServerForLanguage
*/ */
default ResponseEntity<ResponseCode> generateServerForLanguage(String framework, default ResponseEntity<ResponseCode> generateServerForLanguage(String framework,
GeneratorInput generatorInput) { GeneratorInput generatorInput) {
@ -110,8 +110,8 @@ public interface GenApiDelegate {
/** /**
* @param language The target generator (language is a misnomer here, but kept for API consistency). * @param language The target generator (language is a misnomer here, but kept for API consistency).
* @see GenApi#getClientOptions
* @return A {@link ResponseEntity} of {@link CliOption}, grouped by language (generator name). * @return A {@link ResponseEntity} of {@link CliOption}, grouped by language (generator name).
* @see GenApi#getClientOptions
*/ */
default ResponseEntity<Map<String, CliOption>> getClientOptions(String language) { default ResponseEntity<Map<String, CliOption>> getClientOptions(String language) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -120,8 +120,8 @@ public interface GenApiDelegate {
/** /**
* @param framework The target generator name (framework is a slight misnomer here, as we may have a framework like Spring implemented in multiple languages). * @param framework The target generator name (framework is a slight misnomer here, as we may have a framework like Spring implemented in multiple languages).
* @see GenApi#getServerOptions
* @return A {@link ResponseEntity} of {@link CliOption}, grouped by framework (generator name). * @return A {@link ResponseEntity} of {@link CliOption}, grouped by framework (generator name).
* @see GenApi#getServerOptions
*/ */
default ResponseEntity<Map<String, CliOption>> getServerOptions(String framework) { default ResponseEntity<Map<String, CliOption>> getServerOptions(String framework) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -129,8 +129,8 @@ public interface GenApiDelegate {
} }
/** /**
* @see GenApi#serverOptions
* @return A {@link ResponseEntity} listing options for the target server generator. * @return A {@link ResponseEntity} listing options for the target server generator.
* @see GenApi#serverOptions
*/ */
default ResponseEntity<List<String>> serverOptions() { default ResponseEntity<List<String>> serverOptions() {
getRequest().ifPresent(request -> { getRequest().ifPresent(request -> {

View File

@ -18,6 +18,9 @@
package org.openapitools.codegen.online.configuration; package org.openapitools.codegen.online.configuration;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
@ -28,17 +31,14 @@ import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.HashSet;
@Configuration @Configuration

View File

@ -35,7 +35,8 @@ public class ApiResponse {
@Getter String type; @Getter String type;
@Getter String message; @Getter String message;
public ApiResponse() {} public ApiResponse() {
}
public ApiResponse(int code, String message) { public ApiResponse(int code, String message) {
this.code = code; this.code = code;

View File

@ -20,7 +20,8 @@ package org.openapitools.codegen.online.model;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@Getter @Setter @Getter
@Setter
public class Generated { public class Generated {
private String filename; private String filename;
private String friendlyName; private String friendlyName;

View File

@ -22,7 +22,9 @@ import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@Setter @NoArgsConstructor @AllArgsConstructor @Setter
@NoArgsConstructor
@AllArgsConstructor
public class ResponseCode { public class ResponseCode {
private String code; private String code;
private String link; private String link;

View File

@ -22,11 +22,7 @@ import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.AuthorizationValue; import io.swagger.v3.parser.core.models.AuthorizationValue;
import io.swagger.v3.parser.core.models.ParseOptions; import io.swagger.v3.parser.core.models.ParseOptions;
import org.openapitools.codegen.CliOption; import org.openapitools.codegen.*;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenConfigLoader;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.online.model.GeneratorInput; import org.openapitools.codegen.online.model.GeneratorInput;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -35,11 +31,7 @@ import org.springframework.web.server.ResponseStatusException;
import java.io.File; import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.ArrayList; import java.util.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class Generator { public class Generator {
private static Logger LOGGER = LoggerFactory.getLogger(Generator.class); private static Logger LOGGER = LoggerFactory.getLogger(Generator.class);

View File

@ -17,12 +17,7 @@
package org.openapitools.codegen.online.service; package org.openapitools.codegen.online.service;
import java.io.BufferedInputStream; import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
@ -32,7 +27,6 @@ import java.util.zip.ZipOutputStream;
* sub files and sub directories, recursively. * sub files and sub directories, recursively.
* *
* @author Ha Minh Nam * @author Ha Minh Nam
*
*/ */
public class ZipUtil { public class ZipUtil {
/** /**

View File

@ -19,7 +19,6 @@ package org.openapitools.codegen;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.AuthorizationValue; import io.swagger.v3.parser.core.models.AuthorizationValue;
import lombok.Getter; import lombok.Getter;
import org.openapitools.codegen.api.TemplateDefinition; import org.openapitools.codegen.api.TemplateDefinition;
import org.openapitools.codegen.auth.AuthParser; import org.openapitools.codegen.auth.AuthParser;
@ -84,8 +83,8 @@ public class ClientOptInput {
/** /**
* Sets the generator/config instance * Sets the generator/config instance
* *
* @deprecated use {@link #config(CodegenConfig)} instead
* @param config codegen config * @param config codegen config
* @deprecated use {@link #config(CodegenConfig)} instead
*/ */
@Deprecated @Deprecated
public void setConfig(CodegenConfig config) { public void setConfig(CodegenConfig config) {
@ -118,8 +117,8 @@ public class ClientOptInput {
/** /**
* Sets the OpenAPI document * Sets the OpenAPI document
* *
* @deprecated use {@link #openAPI(OpenAPI)} instead
* @param openAPI the specification * @param openAPI the specification
* @deprecated use {@link #openAPI(OpenAPI)} instead
*/ */
@Deprecated @Deprecated
public void setOpenAPI(OpenAPI openAPI) { public void setOpenAPI(OpenAPI openAPI) {

View File

@ -38,6 +38,7 @@ public class CodegenCallback {
return Objects.equals(that.expression, expression) && return Objects.equals(that.expression, expression) &&
Objects.equals(that.requests, requests) && Objects.equals(that.vendorExtensions, vendorExtensions); Objects.equals(that.requests, requests) && Objects.equals(that.vendorExtensions, vendorExtensions);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(expression, requests, vendorExtensions); return Objects.hash(expression, requests, vendorExtensions);

View File

@ -19,9 +19,11 @@ package org.openapitools.codegen;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.*; import java.util.List;
import java.util.Objects;
@Getter @Setter @Getter
@Setter
public class CodegenComposedSchemas { public class CodegenComposedSchemas {
private List<CodegenProperty> allOf; private List<CodegenProperty> allOf;
private List<CodegenProperty> oneOf; private List<CodegenProperty> oneOf;

View File

@ -8,7 +8,7 @@ import java.util.*;
/** /**
* This class encapsulates the OpenAPI discriminator construct, as specified at * This class encapsulates the OpenAPI discriminator construct, as specified at
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#discriminatorObject. * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#discriminatorObject.
* * <p>
* When request bodies or response payloads may be one of a number of different schemas, * When request bodies or response payloads may be one of a number of different schemas,
* a discriminator object can be used to aid in serialization, deserialization, and validation. * a discriminator object can be used to aid in serialization, deserialization, and validation.
* The discriminator is a specific object in a schema which is used to inform the consumer of * The discriminator is a specific object in a schema which is used to inform the consumer of
@ -61,7 +61,7 @@ public class CodegenDiscriminator {
/** /**
* An object to hold discriminator mappings between payload values and schema names or * An object to hold discriminator mappings between payload values and schema names or
* references. * references.
* * <p>
* In the OpenAPI document, the discriminator "mapping" attribute is optional. * In the OpenAPI document, the discriminator "mapping" attribute is optional.
* In scenarios where the value of the discriminator field does not match the schema name * In scenarios where the value of the discriminator field does not match the schema name
* or implicit mapping is not possible, an optional mapping definition MAY be used. * or implicit mapping is not possible, an optional mapping definition MAY be used.

View File

@ -8,7 +8,8 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@Getter public class CodegenMediaType { @Getter
public class CodegenMediaType {
private CodegenProperty schema; private CodegenProperty schema;
private LinkedHashMap<String, CodegenEncoding> encoding; private LinkedHashMap<String, CodegenEncoding> encoding;
private HashMap<String, SchemaTestCase> testCases = new HashMap<>(); private HashMap<String, SchemaTestCase> testCases = new HashMap<>();

View File

@ -19,13 +19,12 @@ package org.openapitools.codegen;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.models.ExternalDocumentation; import io.swagger.v3.oas.models.ExternalDocumentation;
import java.util.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*;
/** /**
* CodegenModel represents a schema object in a OpenAPI document. * CodegenModel represents a schema object in a OpenAPI document.
*/ */
@ -174,7 +173,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean isArray; public boolean isArray;
public boolean hasChildren; public boolean hasChildren;
public boolean isMap; public boolean isMap;
/** datatype is the generic inner parameter of a std::optional for C++, or Optional (Java) */ /**
* datatype is the generic inner parameter of a std::optional for C++, or Optional (Java)
*/
public boolean isOptional; public boolean isOptional;
public boolean isNull; public boolean isNull;
public boolean isVoid = false; public boolean isVoid = false;
@ -208,7 +209,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
/** /**
* The type of the value for the additionalProperties keyword in the OAS document. * The type of the value for the additionalProperties keyword in the OAS document.
* Used in map like objects, including composed schemas. * Used in map like objects, including composed schemas.
* * <p>
* In most programming languages, the additional (undeclared) properties are stored * In most programming languages, the additional (undeclared) properties are stored
* in a map data structure, such as HashMap in Java, map in golang, or a dict in Python. * in a map data structure, such as HashMap in Java, map in golang, or a dict in Python.
* There are multiple ways to implement the additionalProperties keyword, depending * There are multiple ways to implement the additionalProperties keyword, depending
@ -218,24 +219,23 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
* In that case 'CodegenModel.parent' is set to represent the class hierarchy. * In that case 'CodegenModel.parent' is set to represent the class hierarchy.
* Another way is to use CodegenModel.additionalPropertiesType. A code generator * Another way is to use CodegenModel.additionalPropertiesType. A code generator
* such as Python does not use class inheritance to model additional properties. * such as Python does not use class inheritance to model additional properties.
* * <p>
* For example, in the OAS schema below, the schema has a declared 'id' property * For example, in the OAS schema below, the schema has a declared 'id' property
* and additional, undeclared properties of type 'integer' are allowed. * and additional, undeclared properties of type 'integer' are allowed.
* * <p>
* type: object * type: object
* properties: * properties:
* id: * id:
* type: integer * type: integer
* additionalProperties: * additionalProperties:
* type: integer * type: integer
*
*/ */
@Getter @Setter @Getter @Setter
public String additionalPropertiesType; public String additionalPropertiesType;
/** /**
* True if additionalProperties is set to true (boolean value), any type, free form object, etc * True if additionalProperties is set to true (boolean value), any type, free form object, etc
* * <p>
* TODO: we may rename this to isAdditionalPropertiesEnabled or something * TODO: we may rename this to isAdditionalPropertiesEnabled or something
* else to avoid confusions * else to avoid confusions
*/ */
@ -758,14 +758,22 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
} }
@Override @Override
public boolean getIsUuid() { return isUuid; } public boolean getIsUuid() {
return isUuid;
}
@Override @Override
public void setIsUuid(boolean isUuid) { this.isUuid = isUuid; } public void setIsUuid(boolean isUuid) {
this.isUuid = isUuid;
}
public boolean getIsUri() { return isUri; } public boolean getIsUri() {
return isUri;
}
public void setIsUri(boolean isUri) { this.isUri = isUri; } public void setIsUri(boolean isUri) {
this.isUri = isUri;
}
@Override @Override
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) { public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
@ -833,7 +841,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
} }
@Override @Override
public void setIsBinary(boolean isBinary) {} public void setIsBinary(boolean isBinary) {
}
@Override @Override
public boolean getIsByteArray() { public boolean getIsByteArray() {
@ -841,7 +850,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
} }
@Override @Override
public void setIsByteArray(boolean isByteArray) {} public void setIsByteArray(boolean isByteArray) {
}
@Override @Override
public boolean getIsDecimal() { public boolean getIsDecimal() {
@ -1141,10 +1151,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
} }
@Override @Override
public Map<String, CodegenProperty> getRequiredVarsMap() { return requiredVarsMap; } public Map<String, CodegenProperty> getRequiredVarsMap() {
return requiredVarsMap;
}
@Override @Override
public void setRequiredVarsMap(Map<String, CodegenProperty> requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; } public void setRequiredVarsMap(Map<String, CodegenProperty> requiredVarsMap) {
this.requiredVarsMap = requiredVarsMap;
}
/** /**
* Remove duplicated properties in all variable list * Remove duplicated properties in all variable list

View File

@ -24,7 +24,8 @@ public final class CodegenModelFactory {
public static <T> T newInstance(CodegenModelType type) { public static <T> T newInstance(CodegenModelType type) {
try { try {
return (T) type.getDefaultImplementation().getDeclaredConstructor().newInstance(); return (T) type.getDefaultImplementation().getDeclaredConstructor().newInstance();
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) { } catch (IllegalAccessException | InstantiationException | NoSuchMethodException |
InvocationTargetException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }

View File

@ -19,7 +19,8 @@ package org.openapitools.codegen;
import lombok.Getter; import lombok.Getter;
@Getter public enum CodegenModelType { @Getter
public enum CodegenModelType {
MODEL(CodegenModel.class), MODEL(CodegenModel.class),
OPERATION(CodegenOperation.class), OPERATION(CodegenOperation.class),

View File

@ -220,7 +220,9 @@ public class CodegenOperation {
* *
* @return true if responses contain only 1 entry and it's a default response, false otherwise * @return true if responses contain only 1 entry and it's a default response, false otherwise
*/ */
public boolean getHasOnlyDefaultResponse() { return responses.size() == 1 && getHasDefaultResponse(); } public boolean getHasOnlyDefaultResponse() {
return responses.size() == 1 && getHasDefaultResponse();
}
public boolean getAllResponsesAreErrors() { public boolean getAllResponsesAreErrors() {
return responses.stream().allMatch(response -> response.is4xx || response.is5xx); return responses.stream().allMatch(response -> response.is4xx || response.is5xx);

View File

@ -17,17 +17,12 @@
package org.openapitools.codegen; package org.openapitools.codegen;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.examples.Example;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.*;
/** /**
* Describes a single operation parameter in the OAS specification. * Describes a single operation parameter in the OAS specification.
* A unique parameter is defined by a combination of a name and location. * A unique parameter is defined by a combination of a name and location.
@ -50,7 +45,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary,
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isShort, isUnboundedInteger; isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isShort, isUnboundedInteger;
public boolean isArray, isMap; public boolean isArray, isMap;
/** datatype is the generic inner parameter of a std::optional for C++, or Optional (Java) */ /**
* datatype is the generic inner parameter of a std::optional for C++, or Optional (Java)
*/
public boolean isOptional; public boolean isOptional;
public boolean isFile; public boolean isFile;
public boolean isEnum; public boolean isEnum;

View File

@ -20,12 +20,7 @@ package org.openapitools.codegen;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperties { public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperties {
/** /**
@ -178,7 +173,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public boolean isAnyType; public boolean isAnyType;
public boolean isArray; public boolean isArray;
public boolean isMap; public boolean isMap;
/** datatype is the generic inner parameter of a std::optional for C++, or Optional (Java) */ /**
* datatype is the generic inner parameter of a std::optional for C++, or Optional (Java)
*/
public boolean isOptional; public boolean isOptional;
public boolean isEnum; // true if the enum is defined inline public boolean isEnum; // true if the enum is defined inline
public boolean isInnerEnum; // Enums declared inline will be located inside the generic model, changing how the enum is referenced in some cases. public boolean isInnerEnum; // Enums declared inline will be located inside the generic model, changing how the enum is referenced in some cases.
@ -243,7 +240,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private boolean hasDiscriminatorWithNonEmptyMapping; private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas = null; private CodegenComposedSchemas composedSchemas = null;
private boolean hasMultipleTypes = false; private boolean hasMultipleTypes = false;
/** true if the property's baseName != name, e.g. baseName = '_prop.value', name = 'propValue' after sanitization */ /**
* true if the property's baseName != name, e.g. baseName = '_prop.value', name = 'propValue' after sanitization
*/
private boolean hasSanitizedName = false; private boolean hasSanitizedName = false;
private Map<String, CodegenProperty> requiredVarsMap; private Map<String, CodegenProperty> requiredVarsMap;
private String ref; private String ref;
@ -849,7 +848,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
return hasSanitizedName; return hasSanitizedName;
} }
public void setHasSanitizedName(boolean hasSanitizedName) { this.hasSanitizedName = hasSanitizedName; } public void setHasSanitizedName(boolean hasSanitizedName) {
this.hasSanitizedName = hasSanitizedName;
}
@Override @Override
public boolean getIsUuid() { public boolean getIsUuid() {

View File

@ -63,7 +63,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
public boolean simpleType; public boolean simpleType;
public boolean primitiveType; public boolean primitiveType;
public boolean isMap; public boolean isMap;
/** datatype is the generic inner parameter of a std::optional for C++, or Optional (Java) */ /**
* datatype is the generic inner parameter of a std::optional for C++, or Optional (Java)
*/
public boolean isOptional; public boolean isOptional;
public boolean isArray; public boolean isArray;
public boolean isBinary = false; public boolean isBinary = false;
@ -212,7 +214,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
// use content.mediaType.schema.setContains instead of this // use content.mediaType.schema.setContains instead of this
@Override @Override
public void setContains(CodegenProperty contains) {} public void setContains(CodegenProperty contains) {
}
// use content.mediaType.schema.getDependentRequired instead of this // use content.mediaType.schema.getDependentRequired instead of this
@Override @Override
@ -222,7 +225,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
// use content.mediaType.schema.setDependentRequired instead of this // use content.mediaType.schema.setDependentRequired instead of this
@Override @Override
public void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired) {} public void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired) {
}
// use content.mediaType.schema.getIsBooleanSchemaTrue instead of this // use content.mediaType.schema.getIsBooleanSchemaTrue instead of this
@Override @Override
@ -232,7 +236,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
// use content.mediaType.schema.setIsBooleanSchemaTrue instead of this // use content.mediaType.schema.setIsBooleanSchemaTrue instead of this
@Override @Override
public void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue) {} public void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue) {
}
// use content.mediaType.schema.getIsBooleanSchemaFalse instead of this // use content.mediaType.schema.getIsBooleanSchemaFalse instead of this
@Override @Override
@ -242,7 +247,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
// use content.mediaType.schema.setIsBooleanSchemaFalse instead of this // use content.mediaType.schema.setIsBooleanSchemaFalse instead of this
@Override @Override
public void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse) {} public void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse) {
}
// use content.mediaType.schema.getFormat instead of this // use content.mediaType.schema.getFormat instead of this
@Override @Override
@ -252,7 +258,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
// use content.mediaType.schema.setFormat instead of this // use content.mediaType.schema.setFormat instead of this
@Override @Override
public void setFormat(String format) {} public void setFormat(String format) {
}
@Override @Override
public String getPattern() { public String getPattern() {
@ -782,16 +789,24 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
} }
@Override @Override
public Map<String, CodegenProperty> getRequiredVarsMap() { return requiredVarsMap; } public Map<String, CodegenProperty> getRequiredVarsMap() {
return requiredVarsMap;
}
@Override @Override
public void setRequiredVarsMap(Map<String, CodegenProperty> requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; } public void setRequiredVarsMap(Map<String, CodegenProperty> requiredVarsMap) {
this.requiredVarsMap = requiredVarsMap;
}
@Override @Override
public String getRef() { return ref; } public String getRef() {
return ref;
}
@Override @Override
public void setRef(String ref) { this.ref=ref; } public void setRef(String ref) {
this.ref = ref;
}
@Override @Override
public boolean getSchemaIsFromAdditionalProperties() { public boolean getSchemaIsFromAdditionalProperties() {
@ -889,5 +904,6 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
} }
@Override @Override
public void setIsEnum(boolean isEnum) {} public void setIsEnum(boolean isEnum) {
}
} }

View File

@ -17,11 +17,7 @@
package org.openapitools.codegen; package org.openapitools.codegen;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class CodegenSecurity { public class CodegenSecurity {

View File

@ -70,10 +70,10 @@ import org.openapitools.codegen.utils.OneOfImplementorAdditionalData;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -350,7 +350,6 @@ public class DefaultCodegen implements CodegenConfig {
* first from additionalProperties * first from additionalProperties
* then from the getter in this instance * then from the getter in this instance
* then from the fields in this instance * then from the fields in this instance
*
*/ */
protected void useCodegenAsMustacheParentContext() { protected void useCodegenAsMustacheParentContext() {
additionalProperties.put(CodegenConstants.MUSTACHE_PARENT_CONTEXT, this); additionalProperties.put(CodegenConstants.MUSTACHE_PARENT_CONTEXT, this);
@ -546,6 +545,7 @@ public class DefaultCodegen implements CodegenConfig {
* This usually occurs when the data type is different. * This usually occurs when the data type is different.
* We can also consider discriminators as new because the derived class discriminator will have to be defined again * We can also consider discriminators as new because the derived class discriminator will have to be defined again
* to contain a new value. Doing so prevents having to include the discriminator in the constructor. * to contain a new value. Doing so prevents having to include the discriminator in the constructor.
*
* @param model * @param model
* @param property * @param property
* @return * @return
@ -1133,6 +1133,7 @@ public class DefaultCodegen implements CodegenConfig {
/** /**
* This method escapes text to be used in a single quoted string * This method escapes text to be used in a single quoted string
*
* @param input the input string * @param input the input string
* @return the escaped string * @return the escaped string
*/ */
@ -8391,6 +8392,7 @@ public class DefaultCodegen implements CodegenConfig {
public void addImportsToOneOfInterface(List<Map<String, String>> imports) { public void addImportsToOneOfInterface(List<Map<String, String>> imports) {
} }
/// / End of methods related to the "useOneOfInterfaces" feature /// / End of methods related to the "useOneOfInterfaces" feature
protected void modifyFeatureSet(Consumer<FeatureSet.Builder> processor) { protected void modifyFeatureSet(Consumer<FeatureSet.Builder> processor) {
@ -8403,7 +8405,8 @@ public class DefaultCodegen implements CodegenConfig {
/** /**
* An map entry for cached sanitized names. * An map entry for cached sanitized names.
*/ */
@Getter private static class SanitizeNameOptions { @Getter
private static class SanitizeNameOptions {
public SanitizeNameOptions(String name, String removeCharRegEx, List<String> exceptions) { public SanitizeNameOptions(String name, String removeCharRegEx, List<String> exceptions) {
this.name = name; this.name = name;
this.removeCharRegEx = removeCharRegEx; this.removeCharRegEx = removeCharRegEx;

View File

@ -18,11 +18,7 @@
package org.openapitools.codegen; package org.openapitools.codegen;
import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.Paths;
import io.swagger.v3.oas.models.SpecVersion;
import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.info.License;
@ -35,12 +31,8 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOCase; import org.apache.commons.io.IOCase;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.api.TemplateDefinition; import org.openapitools.codegen.api.*;
import org.openapitools.codegen.api.TemplatePathLocator;
import org.openapitools.codegen.api.TemplateProcessor;
import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.api.TemplatingEngineAdapter;
import org.openapitools.codegen.api.TemplateFileType;
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor; import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.Stability;
@ -50,15 +42,13 @@ import org.openapitools.codegen.templating.CommonTemplateContentLocator;
import org.openapitools.codegen.templating.GeneratorTemplateContentLocator; import org.openapitools.codegen.templating.GeneratorTemplateContentLocator;
import org.openapitools.codegen.templating.MustacheEngineAdapter; import org.openapitools.codegen.templating.MustacheEngineAdapter;
import org.openapitools.codegen.templating.TemplateManagerOptions; import org.openapitools.codegen.templating.TemplateManagerOptions;
import org.openapitools.codegen.utils.ImplementationVersion; import org.openapitools.codegen.utils.*;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.ProcessUtils;
import org.openapitools.codegen.utils.URLPathUtils;
import org.openapitools.codegen.utils.SemVer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.*; import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;

View File

@ -9,7 +9,8 @@ import java.util.Locale;
/** /**
* Holds details about a file's write status for display via the --dry-run option of CLI * Holds details about a file's write status for display via the --dry-run option of CLI
*/ */
@Getter class DryRunStatus { @Getter
class DryRunStatus {
/** /**
* -- GETTER -- * -- GETTER --
* Gets the target path of the file write operation * Gets the target path of the file write operation
@ -110,7 +111,8 @@ import java.util.Locale;
/** /**
* Represents the possible states of a file write operation as determined by the Generator * Represents the possible states of a file write operation as determined by the Generator
*/ */
@Getter enum State { @Getter
enum State {
Write("w", "Write"), Write("w", "Write"),
WriteIfNewer("n", "Write if New/Updated"), WriteIfNewer("n", "Write if New/Updated"),
Ignored("i", "Ignored"), Ignored("i", "Ignored"),

View File

@ -122,6 +122,7 @@ public class DryRunTemplateManager implements TemplateProcessor {
* been enabled via {@link #enableTemplateDataCapturing()} prior to generation.<br> * been enabled via {@link #enableTemplateDataCapturing()} prior to generation.<br>
* Note: Not all files have template data (e.g. Metadata files) in such case an empty * Note: Not all files have template data (e.g. Metadata files) in such case an empty
* map is returned. * map is returned.
*
* @param generatedFile An absolute path to the generated file * @param generatedFile An absolute path to the generated file
* @return Typically one of the *Map types found in {@link org.openapitools.codegen.model} * @return Typically one of the *Map types found in {@link org.openapitools.codegen.model}
*/ */

View File

@ -1,20 +1,13 @@
package org.openapitools.codegen; package org.openapitools.codegen;
import java.util.Arrays; import io.swagger.v3.oas.models.OpenAPI;
import java.util.Collections; import io.swagger.v3.oas.models.media.Schema;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
import org.openapitools.codegen.meta.FeatureSet; import org.openapitools.codegen.meta.FeatureSet;
import org.openapitools.codegen.meta.features.SchemaSupportFeature; import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import io.swagger.v3.oas.models.OpenAPI; import java.util.*;
import io.swagger.v3.oas.models.media.Schema; import java.util.stream.Stream;
public interface IJsonSchemaValidationProperties { public interface IJsonSchemaValidationProperties {
CodegenProperty getContains(); CodegenProperty getContains();
@ -116,6 +109,7 @@ public interface IJsonSchemaValidationProperties {
* but using #isModel alone without #isOptional in mustache might produce <code>const org::openapitools::server::model::std::optional&lt;org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter&gt; &amp;categoryOneOf</code> instead, that do not compile. * but using #isModel alone without #isOptional in mustache might produce <code>const org::openapitools::server::model::std::optional&lt;org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter&gt; &amp;categoryOneOf</code> instead, that do not compile.
*/ */
boolean getIsOptional(); boolean getIsOptional();
void setIsOptional(boolean isOptional); void setIsOptional(boolean isOptional);
boolean getIsArray(); boolean getIsArray();

View File

@ -22,8 +22,6 @@ import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.annotations.Webhook;
import io.swagger.v3.oas.annotations.Webhooks;
import io.swagger.v3.oas.models.*; import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.PathItem.HttpMethod;
import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.callbacks.Callback;
@ -37,7 +35,6 @@ import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.nio.file.Path;
import java.util.*; import java.util.*;
public class InlineModelResolver { public class InlineModelResolver {

View File

@ -20,6 +20,7 @@ public class ObjectWithTypeBooleans {
* Other booleans: isUnboundedInteger/isNumber/isString/isMap/isArray/isBoolean/isNull * Other booleans: isUnboundedInteger/isNumber/isString/isMap/isArray/isBoolean/isNull
* allow generator templates to decide how to render each payload into code * allow generator templates to decide how to render each payload into code
* based upon what type it is. The booleans isX describe the value in value. * based upon what type it is. The booleans isX describe the value in value.
*
* @param value the input payload that is stored * @param value the input payload that is stored
*/ */
public ObjectWithTypeBooleans(Object value) { public ObjectWithTypeBooleans(Object value) {

View File

@ -35,7 +35,6 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.openapitools.codegen.utils.StringUtils.getUniqueString; import static org.openapitools.codegen.utils.StringUtils.getUniqueString;
import static org.openapitools.codegen.utils.StringUtils.underscore;
public class OpenAPINormalizer { public class OpenAPINormalizer {
private OpenAPI openAPI; private OpenAPI openAPI;
@ -1013,7 +1012,6 @@ public class OpenAPINormalizer {
} }
/** /**
* If the schema contains anyOf/oneOf and properties, remove oneOf/anyOf as these serve as rules to * If the schema contains anyOf/oneOf and properties, remove oneOf/anyOf as these serve as rules to
* ensure inter-dependency between properties. It's a workaround as such validation is not supported at the moment. * ensure inter-dependency between properties. It's a workaround as such validation is not supported at the moment.

View File

@ -6,7 +6,8 @@ import lombok.Setter;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
@Getter @Setter @Getter
@Setter
public class SpecValidationException extends RuntimeException { public class SpecValidationException extends RuntimeException {
private Set<String> errors; private Set<String> errors;

View File

@ -27,11 +27,12 @@ import java.util.StringJoiner;
/** /**
* Defines the template definition for a "supporting file", that is any file which is generic and not bound to * Defines the template definition for a "supporting file", that is any file which is generic and not bound to
* api/model definitions and their relevant docs or tests. * api/model definitions and their relevant docs or tests.
* * <p>
* Supporting files are generated once for an entire application while api/model bound definitions are generated multiple * Supporting files are generated once for an entire application while api/model bound definitions are generated multiple
* times according to their target use. * times according to their target use.
*/ */
@Getter public class SupportingFile extends TemplateDefinition { @Getter
public class SupportingFile extends TemplateDefinition {
private boolean canOverwrite = true; private boolean canOverwrite = true;
public SupportingFile(String templateFile, String destinationFilename) { public SupportingFile(String templateFile, String destinationFilename) {

View File

@ -13,8 +13,14 @@ import org.slf4j.LoggerFactory;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.*; import java.nio.file.Files;
import java.util.*; import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -87,7 +93,6 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
* Gets a normalized classpath resource location according to OS-specific file separator * Gets a normalized classpath resource location according to OS-specific file separator
* *
* @param name The name of the resource file/directory to find * @param name The name of the resource file/directory to find
*
* @return A normalized string according to OS-specific file separator * @return A normalized string according to OS-specific file separator
*/ */
public static String getCPResourcePath(final String name) { public static String getCPResourcePath(final String name) {
@ -153,7 +158,6 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
* @param data Input data * @param data Input data
* @param template Input template location * @param template Input template location
* @param target The targeted file output location * @param target The targeted file output location
*
* @return The actual file * @return The actual file
*/ */
@Override @Override

View File

@ -6,7 +6,8 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Getter public enum VendorExtension { @Getter
public enum VendorExtension {
X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"), X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"),
X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters", "false"), X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters", "false"),

View File

@ -48,7 +48,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
/** /**
* A class which manages the contextual configuration for code generation. * A class which manages the contextual configuration for code generation.
* This includes configuring the generator, templating, and the workflow which orchestrates these. * This includes configuring the generator, templating, and the workflow which orchestrates these.
* * <p>
* This helper also enables the deserialization of {@link GeneratorSettings} via application-specific Jackson JSON usage * This helper also enables the deserialization of {@link GeneratorSettings} via application-specific Jackson JSON usage
* (see {@link DynamicSettings}. * (see {@link DynamicSettings}.
*/ */

View File

@ -96,7 +96,8 @@ public class DynamicSettings {
* <p>Constructor for DynamicSettings.</p> * <p>Constructor for DynamicSettings.</p>
*/ */
@JsonCreator @JsonCreator
public DynamicSettings() { } public DynamicSettings() {
}
private void excludeSettingsFromDynamicProperties() { private void excludeSettingsFromDynamicProperties() {
Set<String> fieldNames = new HashSet<>(); Set<String> fieldNames = new HashSet<>();

View File

@ -27,7 +27,7 @@ import java.util.Properties;
* GlobalSettings encapsulates SystemProperties, since the codegen mechanism heavily relies on a stable, * GlobalSettings encapsulates SystemProperties, since the codegen mechanism heavily relies on a stable,
* non-changing System Property Basis. Using plain System.(get|set|clear)Property raises Race-Conditions in combination * non-changing System Property Basis. Using plain System.(get|set|clear)Property raises Race-Conditions in combination
* with Code, that uses System.setProperties (e.g. maven-surefire-plugin). * with Code, that uses System.setProperties (e.g. maven-surefire-plugin).
* * <p>
* This provides a set of properties specific to the executing thread, such that the generator may not modify system properties * This provides a set of properties specific to the executing thread, such that the generator may not modify system properties
* consumed by other threads. * consumed by other threads.
* *

View File

@ -1,32 +1,24 @@
package org.openapitools.codegen.config; package org.openapitools.codegen.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.google.common.collect.ImmutableMap;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.google.common.collect.ImmutableMap;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.ParseOptions;
public class MergedSpecBuilder { public class MergedSpecBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(MergedSpecBuilder.class); private static final Logger LOGGER = LoggerFactory.getLogger(MergedSpecBuilder.class);
@ -134,10 +126,12 @@ public class MergedSpecBuilder {
private void deleteMergedFileFromPreviousRun() { private void deleteMergedFileFromPreviousRun() {
try { try {
Files.deleteIfExists(Paths.get(inputSpecRootDirectory + File.separator + mergeFileName + ".json")); Files.deleteIfExists(Paths.get(inputSpecRootDirectory + File.separator + mergeFileName + ".json"));
} catch (IOException e) { } } catch (IOException e) {
}
try { try {
Files.deleteIfExists(Paths.get(inputSpecRootDirectory + File.separator + mergeFileName + ".yaml")); Files.deleteIfExists(Paths.get(inputSpecRootDirectory + File.separator + mergeFileName + ".yaml"));
} catch (IOException e) { } } catch (IOException e) {
}
} }
private static class SpecWithPaths { private static class SpecWithPaths {

View File

@ -398,6 +398,7 @@ public class ExampleGenerator {
/** /**
* Transverse and resolves all property examples for `allOf` composed schemas into `values` map object * Transverse and resolves all property examples for `allOf` composed schemas into `values` map object
*
* @param mediaType MIME type * @param mediaType MIME type
* @param schema OAS schema * @param schema OAS schema
* @param processedModels Set containing all processed models * @param processedModels Set containing all processed models

View File

@ -172,7 +172,7 @@ public class XmlExampleGenerator {
/** /**
* Get the example string value for the given schema. * Get the example string value for the given schema.
* * <p>
* If an example value was not provided in the specification, a default will be generated. * If an example value was not provided in the specification, a default will be generated.
* *
* @param schema Schema to get example string for * @param schema Schema to get example string for

View File

@ -25,7 +25,10 @@ import org.slf4j.LoggerFactory;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
@ -216,7 +219,7 @@ public class CodegenIgnoreProcessor {
/** /**
* Allows a consumer to manually inspect all "exclusion rules". That is, patterns in the ignore file which represent * Allows a consumer to manually inspect all "exclusion rules". That is, patterns in the ignore file which represent
* files and directories to be excluded, unless explicitly overridden by {@link CodegenIgnoreProcessor#getInclusionRules()} rules. * files and directories to be excluded, unless explicitly overridden by {@link CodegenIgnoreProcessor#getInclusionRules()} rules.
* * <p>
* NOTE: Existence in this list doesn't mean a file is excluded. The rule can be overridden by {@link CodegenIgnoreProcessor#getInclusionRules()} rules. * NOTE: Existence in this list doesn't mean a file is excluded. The rule can be overridden by {@link CodegenIgnoreProcessor#getInclusionRules()} rules.
* *
* @return A {@link Collections#unmodifiableList(List)} of rules which define exclusions by patterns in the ignore file. * @return A {@link Collections#unmodifiableList(List)} of rules which define exclusions by patterns in the ignore file.

View File

@ -33,5 +33,7 @@ public class EverythingRule extends Rule {
} }
@Override @Override
protected Operation getExcludeOperation(){ return Operation.EXCLUDE_AND_TERMINATE; } protected Operation getExcludeOperation() {
return Operation.EXCLUDE_AND_TERMINATE;
}
} }

View File

@ -23,7 +23,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class IgnoreLineParser { public class IgnoreLineParser {
@Getter enum Token { @Getter
enum Token {
MATCH_ALL("**"), MATCH_ALL("**"),
MATCH_ANY("*"), MATCH_ANY("*"),
ESCAPED_EXCLAMATION("\\!"), ESCAPED_EXCLAMATION("\\!"),

View File

@ -21,7 +21,8 @@ import lombok.Getter;
import java.util.List; import java.util.List;
@Getter public class InvalidRule extends Rule { @Getter
public class InvalidRule extends Rule {
private final String reason; private final String reason;
InvalidRule(List<Part> syntax, String definition, String reason) { InvalidRule(List<Part> syntax, String definition, String reason) {

View File

@ -19,7 +19,8 @@ package org.openapitools.codegen.ignore.rules;
import lombok.Getter; import lombok.Getter;
@Getter class Part { @Getter
class Part {
private final IgnoreLineParser.Token token; private final IgnoreLineParser.Token token;
private final String value; private final String value;

View File

@ -83,8 +83,13 @@ public abstract class Rule {
return Operation.NOOP; return Operation.NOOP;
} }
protected Operation getIncludeOperation(){ return Operation.INCLUDE; } protected Operation getIncludeOperation() {
protected Operation getExcludeOperation(){ return Operation.EXCLUDE; } return Operation.INCLUDE;
}
protected Operation getExcludeOperation() {
return Operation.EXCLUDE;
}
public static Rule create(String definition) { public static Rule create(String definition) {
// NOTE: Comments that start with a : (e.g. //:) are pulled from git documentation for .gitignore // NOTE: Comments that start with a : (e.g. //:) are pulled from git documentation for .gitignore

View File

@ -27,12 +27,7 @@ import io.swagger.v3.oas.models.servers.Server;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.ClientModificationFeature; import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.meta.features.GlobalFeature;
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.meta.features.SecurityFeature;
import org.openapitools.codegen.meta.features.WireFormatFeature;
import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationMap;

View File

@ -18,10 +18,9 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache.Lambda;
import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Mustache.Lambda;
import com.samskivert.mustache.Template; import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -504,7 +503,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
} }
} }
/** If the value can be parsed as a double, returns the value, otherwise returns null */ /**
* If the value can be parsed as a double, returns the value, otherwise returns null
*/
public static Double asDouble(String strNum) { public static Double asDouble(String strNum) {
if (strNum == null) { if (strNum == null) {
return null; return null;
@ -516,7 +517,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
} }
} }
/** If the value can be parsed as an integer, returns the value, otherwise returns null */ /**
* If the value can be parsed as an integer, returns the value, otherwise returns null
*/
public static Integer asInteger(String strNum) { public static Integer asInteger(String strNum) {
if (strNum == null) { if (strNum == null) {
return null; return null;
@ -835,6 +838,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
httpStatusesWithReturn.add(status); httpStatusesWithReturn.add(status);
} }
} }
private HashMap<String, String> duplicateOf = new HashMap<String, String>(); private HashMap<String, String> duplicateOf = new HashMap<String, String>();
@Override @Override
@ -1707,8 +1711,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
* @param name The original name * @param name The original name
* @return The adjusted name * @return The adjusted name
*/ */
private String adjustNamingStyle(String name) private String adjustNamingStyle(String name) {
{
switch (getEnumPropertyNaming()) { switch (getEnumPropertyNaming()) {
case camelCase: case camelCase:
// NOTE: Removes hyphens and underscores // NOTE: Removes hyphens and underscores
@ -1765,7 +1768,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
return (this.getValueTypes().contains(var.dataType) || var.isEnum); return (this.getValueTypes().contains(var.dataType) || var.isEnum);
} }
protected boolean useNet60OrLater() { return false; } protected boolean useNet60OrLater() {
return false;
}
protected boolean useDateOnly() { protected boolean useDateOnly() {
return useNet60OrLater() && !useDateTimeForDateFlag; return useNet60OrLater() && !useDateTimeForDateFlag;

View File

@ -19,15 +19,14 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Mustache.Lambda;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.servers.ServerVariables;
import io.swagger.v3.oas.models.servers.ServerVariable; import io.swagger.v3.oas.models.servers.ServerVariable;
import org.openapitools.codegen.*; import io.swagger.v3.oas.models.servers.ServerVariables;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.templating.mustache.IndentedLambda;
@ -38,11 +37,7 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig { abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig {
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class); private final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class);

View File

@ -632,5 +632,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
} }
@Override @Override
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.EIFFEL; } public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.EIFFEL;
}
} }

View File

@ -18,7 +18,6 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Mustache.Lambda;
import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter; import lombok.Getter;
@ -30,7 +29,7 @@ import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.templating.mustache.*; import org.openapitools.codegen.templating.mustache.CamelCaseAndSanitizeLambda;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -26,7 +26,10 @@ import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.oas.models.media.*; import io.swagger.v3.oas.models.media.Content;
import io.swagger.v3.oas.models.media.MediaType;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
@ -144,7 +147,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
@Getter @Setter @Getter @Setter
protected String testFolder = projectTestFolder + "/java"; protected String testFolder = projectTestFolder + "/java";
protected static enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy}; protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy}
protected static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'MACRO_CASE' and 'legacy'"; protected static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'MACRO_CASE' and 'legacy'";
@Getter protected ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = ENUM_PROPERTY_NAMING_TYPE.MACRO_CASE; @Getter protected ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = ENUM_PROPERTY_NAMING_TYPE.MACRO_CASE;
@ -667,6 +671,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
/** /**
* Analyse and post process all Models. * Analyse and post process all Models.
*
* @param objs the models map. * @param objs the models map.
* @return the processed models map. * @return the processed models map.
**/ **/
@ -1734,8 +1739,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
composedSchemas.getOneOf(), composedSchemas.getOneOf(),
composedSchemas.getAllOf()); composedSchemas.getAllOf());
for (final List<CodegenProperty> propertyList : propertyLists) { for (final List<CodegenProperty> propertyList : propertyLists) {
if(propertyList == null) if (propertyList == null) {
{
continue; continue;
} }
for (CodegenProperty cp : propertyList) { for (CodegenProperty cp : propertyList) {
@ -1820,7 +1824,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
/** /**
* Remove annotations from the given data type string. * Remove annotations from the given data type string.
* * <p>
* For example: * For example:
* <ul> * <ul>
* <li>{@code @Min(0) @Max(10)Integer} -> {@code Integer}</li> * <li>{@code @Min(0) @Max(10)Integer} -> {@code Integer}</li>

View File

@ -50,6 +50,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
protected static final String X_MICROPROFILE_OPEN_API_SCHEMA_TYPE = "x-microprofile-open-api-schema-type"; protected static final String X_MICROPROFILE_OPEN_API_SCHEMA_TYPE = "x-microprofile-open-api-schema-type";
protected static final String SCHEMA_TYPE_ARRAY = "org.eclipse.microprofile.openapi.annotations.enums.SchemaType.ARRAY"; protected static final String SCHEMA_TYPE_ARRAY = "org.eclipse.microprofile.openapi.annotations.enums.SchemaType.ARRAY";
protected static final Map<String, String> ARRAY_OF_MICROPROFILE_OPEN_API_SCHEMA_TYPES; protected static final Map<String, String> ARRAY_OF_MICROPROFILE_OPEN_API_SCHEMA_TYPES;
static { static {
final Map<String, String> schemaTypes = new HashMap<>(); final Map<String, String> schemaTypes = new HashMap<>();
schemaTypes.put("integer", "org.eclipse.microprofile.openapi.annotations.enums.SchemaType.INTEGER"); schemaTypes.put("integer", "org.eclipse.microprofile.openapi.annotations.enums.SchemaType.INTEGER");

View File

@ -16,16 +16,24 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache.Lambda;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.servers.Server;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.ClientModificationFeature; import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.meta.features.GlobalFeature;
import org.openapitools.codegen.meta.features.ParameterFeature;
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.meta.features.SecurityFeature;
import org.openapitools.codegen.meta.features.WireFormatFeature;
import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.templating.mustache.EscapeChar;
import org.openapitools.codegen.utils.CamelizeOption;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -33,27 +41,8 @@ import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.servers.Server;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
import org.openapitools.codegen.utils.CamelizeOption;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache.Lambda;
import org.openapitools.codegen.templating.mustache.EscapeChar;
public abstract class AbstractJuliaCodegen extends DefaultCodegen { public abstract class AbstractJuliaCodegen extends DefaultCodegen {
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractJuliaCodegen.class); protected final Logger LOGGER = LoggerFactory.getLogger(AbstractJuliaCodegen.class);

View File

@ -1012,18 +1012,15 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
if (schema.getDefault() != null) { if (schema.getDefault() != null) {
return fixNumberValue(schema.getDefault().toString(), schema); return fixNumberValue(schema.getDefault().toString(), schema);
} }
} } else if (ModelUtils.isIntegerSchema(schema)) {
else if (ModelUtils.isIntegerSchema(schema)) {
if (schema.getDefault() != null) { if (schema.getDefault() != null) {
return fixNumberValue(schema.getDefault().toString(), schema); return fixNumberValue(schema.getDefault().toString(), schema);
} }
} } else if (ModelUtils.isURISchema(schema)) {
else if (ModelUtils.isURISchema(schema)) {
if (schema.getDefault() != null) { if (schema.getDefault() != null) {
return importMapping.get("URI") + ".create(\"" + schema.getDefault() + "\")"; return importMapping.get("URI") + ".create(\"" + schema.getDefault() + "\")";
} }
} } else if (ModelUtils.isArraySchema(schema)) {
else if (ModelUtils.isArraySchema(schema)) {
return toArrayDefaultValue(cp, schema); return toArrayDefaultValue(cp, schema);
} else if (ModelUtils.isStringSchema(schema)) { } else if (ModelUtils.isStringSchema(schema)) {
if (schema.getDefault() != null) { if (schema.getDefault() != null) {

View File

@ -34,8 +34,8 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR; import static org.openapitools.codegen.utils.CamelizeOption.UPPERCASE_FIRST_CHAR;

View File

@ -16,44 +16,14 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import static org.openapitools.codegen.utils.StringUtils.camelize; import com.github.curiousoddman.rgxgen.RgxGen;
import static org.openapitools.codegen.utils.StringUtils.escape; import io.swagger.v3.oas.models.examples.Example;
import static org.openapitools.codegen.utils.StringUtils.underscore; import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.*;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenMediaType;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.CodegenResponse;
import org.openapitools.codegen.DefaultCodegen;
import org.openapitools.codegen.GeneratorLanguage;
import org.openapitools.codegen.IJsonSchemaValidationProperties;
import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.meta.features.SecurityFeature;
import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.ModelsMap;
@ -63,14 +33,14 @@ import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.github.curiousoddman.rgxgen.RgxGen; import javax.annotation.Nullable;
import java.io.File;
import io.swagger.v3.oas.models.examples.Example; import java.util.*;
import io.swagger.v3.oas.models.media.Schema; import java.util.regex.Matcher;
import io.swagger.v3.oas.models.parameters.Parameter; import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.openapitools.codegen.utils.StringUtils.*;
public abstract class AbstractPythonCodegen extends DefaultCodegen implements CodegenConfig { public abstract class AbstractPythonCodegen extends DefaultCodegen implements CodegenConfig {

View File

@ -16,30 +16,6 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import java.io.File;
import java.io.IOException;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.model.ApiInfoMap;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.JsonSerializer;
@ -49,7 +25,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.Operation;
@ -59,8 +34,19 @@ import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.security.SecurityScheme; import io.swagger.v3.oas.models.security.SecurityScheme;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.model.*;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.openapitools.codegen.utils.StringUtils.*; import java.io.File;
import java.io.IOException;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractPythonConnexionServerCodegen extends AbstractPythonCodegen implements CodegenConfig { public abstract class AbstractPythonConnexionServerCodegen extends AbstractPythonCodegen implements CodegenConfig {
private static class PythonBooleanSerializer extends JsonSerializer<Boolean> { private static class PythonBooleanSerializer extends JsonSerializer<Boolean> {

View File

@ -22,7 +22,6 @@ import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template; import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.oas.models.media.StringSchema;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;

View File

@ -25,7 +25,9 @@ import org.openapitools.codegen.model.OperationsMap;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.*; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
public class Apache2ConfigCodegen extends DefaultCodegen implements CodegenConfig { public class Apache2ConfigCodegen extends DefaultCodegen implements CodegenConfig {

View File

@ -16,11 +16,16 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -32,15 +37,6 @@ import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.openapitools.codegen.meta.features.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.OpenAPI;
/** /**
* basic asciidoc markup generator. * basic asciidoc markup generator.
* *

View File

@ -21,7 +21,6 @@ import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.parser.util.SchemaTypeUtil; import io.swagger.v3.parser.util.SchemaTypeUtil;
import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.*;

View File

@ -1,13 +1,15 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import org.openapitools.codegen.*; import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenOperation;
import java.io.File; import org.openapitools.codegen.CodegenType;
import java.util.*; import org.openapitools.codegen.SupportingFile;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Locale;
import static java.util.UUID.randomUUID; import static java.util.UUID.randomUUID;
public class AspnetFastendpointsServerCodegen extends AbstractCSharpCodegen implements CodegenConfig { public class AspnetFastendpointsServerCodegen extends AbstractCSharpCodegen implements CodegenConfig {

View File

@ -16,32 +16,23 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.ModelsMap;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import lombok.Getter; import java.io.File;
import lombok.Setter; import java.util.*;
import java.util.stream.Collectors;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig { public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
private final Logger LOGGER = LoggerFactory.getLogger(AvroSchemaCodegen.class); private final Logger LOGGER = LoggerFactory.getLogger(AvroSchemaCodegen.class);

View File

@ -26,8 +26,8 @@ import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
@ -37,7 +37,8 @@ import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
import static org.openapitools.codegen.utils.StringUtils.*; import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
public class BashClientCodegen extends DefaultCodegen implements CodegenConfig { public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
private final Logger LOGGER = LoggerFactory.getLogger(BashClientCodegen.class); private final Logger LOGGER = LoggerFactory.getLogger(BashClientCodegen.class);
@ -795,5 +796,7 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
@Override @Override
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.BASH; } public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.BASH;
}
} }

View File

@ -18,8 +18,8 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -128,6 +128,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
ALPHABETICAL, ALPHABETICAL,
LEGACY LEGACY
} }
private SortingMethod operationParameterSorting = SortingMethod.DEFAULT; private SortingMethod operationParameterSorting = SortingMethod.DEFAULT;
private SortingMethod modelPropertySorting = SortingMethod.DEFAULT; private SortingMethod modelPropertySorting = SortingMethod.DEFAULT;
@ -504,8 +505,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
Collections.sort(codegenModel.readOnlyVars, propertyComparatorByNotNullableRequiredNoDefaultLegacy); Collections.sort(codegenModel.readOnlyVars, propertyComparatorByNotNullableRequiredNoDefaultLegacy);
Collections.sort(codegenModel.readWriteVars, propertyComparatorByNotNullableRequiredNoDefaultLegacy); Collections.sort(codegenModel.readWriteVars, propertyComparatorByNotNullableRequiredNoDefaultLegacy);
Collections.sort(codegenModel.parentVars, propertyComparatorByNotNullableRequiredNoDefaultLegacy); Collections.sort(codegenModel.parentVars, propertyComparatorByNotNullableRequiredNoDefaultLegacy);
} } else {
else {
Collections.sort(codegenModel.vars, propertyComparatorByNotNullableRequiredNoDefault); Collections.sort(codegenModel.vars, propertyComparatorByNotNullableRequiredNoDefault);
Collections.sort(codegenModel.allVars, propertyComparatorByNotNullableRequiredNoDefault); Collections.sort(codegenModel.allVars, propertyComparatorByNotNullableRequiredNoDefault);
Collections.sort(codegenModel.requiredVars, propertyComparatorByNotNullableRequiredNoDefault); Collections.sort(codegenModel.requiredVars, propertyComparatorByNotNullableRequiredNoDefault);

View File

@ -635,7 +635,8 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
final AtomicReference<Boolean> excludeTests = new AtomicReference<>(); final AtomicReference<Boolean> excludeTests = new AtomicReference<>();
syncBooleanProperty(additionalProperties, CodegenConstants.EXCLUDE_TESTS, excludeTests::set, false); syncBooleanProperty(additionalProperties, CodegenConstants.EXCLUDE_TESTS, excludeTests::set, false);
syncStringProperty(additionalProperties, "clientPackage", (s) -> {}, clientPackage); syncStringProperty(additionalProperties, "clientPackage", (s) -> {
}, clientPackage);
syncStringProperty(additionalProperties, CodegenConstants.API_PACKAGE, this::setApiPackage, apiPackage); syncStringProperty(additionalProperties, CodegenConstants.API_PACKAGE, this::setApiPackage, apiPackage);
syncStringProperty(additionalProperties, CodegenConstants.MODEL_PACKAGE, this::setModelPackage, modelPackage); syncStringProperty(additionalProperties, CodegenConstants.MODEL_PACKAGE, this::setModelPackage, modelPackage);

View File

@ -24,7 +24,10 @@ import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.meta.features.ParameterFeature;
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.meta.features.SecurityFeature;
import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.model.OperationsMap;
@ -400,5 +403,7 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
} }
@Override @Override
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.CLOJURE; } public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.CLOJURE;
}
} }

View File

@ -18,6 +18,7 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelMap;
@ -25,7 +26,6 @@ import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
@ -158,5 +158,7 @@ public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConf
} }
@Override @Override
public GeneratorLanguage generatorLanguage() { return null; } public GeneratorLanguage generatorLanguage() {
return null;
}
} }

View File

@ -52,28 +52,44 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
protected final String PREFIX = ""; protected final String PREFIX = "";
protected String helpersPackage = ""; protected String helpersPackage = "";
/** OpenApi types that shouldn't have a namespace added with getTypeDeclaration() at generation time (for nlohmann::json) */ /**
* OpenApi types that shouldn't have a namespace added with getTypeDeclaration() at generation time (for nlohmann::json)
*/
private final Set<String> openAPITypesWithoutModelNamespace = new HashSet<>(); private final Set<String> openAPITypesWithoutModelNamespace = new HashSet<>();
/** int32_t (for integer) */ /**
* int32_t (for integer)
*/
private static final String INT32_T = "int32_t"; private static final String INT32_T = "int32_t";
/** int64_t (for long) */ /**
* int64_t (for long)
*/
private static final String INT64_T = "int64_t"; private static final String INT64_T = "int64_t";
/** nlohmann::json (for object, AnyType) */ /**
* nlohmann::json (for object, AnyType)
*/
private static final String NLOHMANN_JSON = "nlohmann::json"; private static final String NLOHMANN_JSON = "nlohmann::json";
/** std:string (for date, DateTime, string, file, binary, UUID, URI, ByteArray) */ /**
* std:string (for date, DateTime, string, file, binary, UUID, URI, ByteArray)
*/
private static final String STD_STRING = "std::string"; private static final String STD_STRING = "std::string";
/** std:map (for map) */ /**
* std:map (for map)
*/
private static final String STD_MAP = "std::map"; private static final String STD_MAP = "std::map";
/** std:set (for set) */ /**
* std:set (for set)
*/
private static final String STD_SET = "std::set"; private static final String STD_SET = "std::set";
/** std:vector (for array) */ /**
* std:vector (for array)
*/
private static final String STD_VECTOR = "std::vector"; private static final String STD_VECTOR = "std::vector";
@Override @Override
@ -354,6 +370,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
/** /**
* postProcessSingleParam - Modifies a single parameter, adjusting generated * postProcessSingleParam - Modifies a single parameter, adjusting generated
* data types for Header and Query parameters. * data types for Header and Query parameters.
*
* @param param CodegenParameter to be modified. * @param param CodegenParameter to be modified.
*/ */
private void postProcessSingleParam(CodegenParameter param) { private void postProcessSingleParam(CodegenParameter param) {
@ -443,6 +460,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
/** /**
* Prefix an open API type with a namespace or not, depending of its current type and if it is on a list to avoid it. * Prefix an open API type with a namespace or not, depending of its current type and if it is on a list to avoid it.
*
* @param openAPIType Open API Type. * @param openAPIType Open API Type.
* @return type prefixed with the namespace or not. * @return type prefixed with the namespace or not.
*/ */
@ -450,8 +468,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
// Some types might not support namespace // Some types might not support namespace
if (this.openAPITypesWithoutModelNamespace.contains(openAPIType) || openAPIType.startsWith("std::")) { if (this.openAPITypesWithoutModelNamespace.contains(openAPIType) || openAPIType.startsWith("std::")) {
return openAPIType; return openAPIType;
} } else {
else {
String namespace = (String) additionalProperties.get("modelNamespace"); String namespace = (String) additionalProperties.get("modelNamespace");
return namespace + "::" + openAPIType; return namespace + "::" + openAPIType;
} }

View File

@ -31,7 +31,7 @@ import org.openapitools.codegen.model.OperationsMap;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import static org.openapitools.codegen.utils.StringUtils.*; import static org.openapitools.codegen.utils.StringUtils.camelize;
public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenConfig { public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenConfig {
public static final String OPTIONAL_PROJECT_FILE_DESC = "Generate client.pri."; public static final String OPTIONAL_PROJECT_FILE_DESC = "Generate client.pri.";

View File

@ -348,8 +348,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
op.operationIdCamelCase = op1.operationIdCamelCase; op.operationIdCamelCase = op1.operationIdCamelCase;
currentOtherMethodList.add(op); currentOtherMethodList.add(op);
op1.vendorExtensions.put(X_CODEGEN_OTHER_METHODS, currentOtherMethodList); op1.vendorExtensions.put(X_CODEGEN_OTHER_METHODS, currentOtherMethodList);
} } else {
else {
newOpList.add(op); newOpList.add(op);
} }
} }

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