mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
Refactoring: Use lombok for simple getters & setters (#18559)
* Add missing @Override annotation * Fix JavaDoc unresolved symbol * Fix JavaDoc method link * Remove unnecessary semicolon * Remove method identical to super implementations * Replace repetitive getter code with Lombok @Getter See https://projectlombok.org/features/GetterSetter * Replace repetitive setter code with Lombok @Setter See https://projectlombok.org/features/GetterSetter * Generate no-args constructor with Lombok * Generate all-args constructor with Lombok * Fix parameter naming * Replace stubbed abstract class implementations with Mockito mocks * Remove unused import(s)
This commit is contained in:
parent
42c78403cb
commit
aef4d75fd5
@ -19,16 +19,12 @@ package org.openapitools.codegen.cmd;
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
|
||||
import com.fasterxml.jackson.databind.deser.std.DelegatingDeserializer;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.databind.util.TokenBuffer;
|
||||
|
||||
import io.airlift.airline.Arguments;
|
||||
|
@ -28,7 +28,6 @@ import io.airlift.airline.Command;
|
||||
import io.airlift.airline.Option;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.DefaultGenerator;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.TemplateManager;
|
||||
import org.openapitools.codegen.api.TemplatePathLocator;
|
||||
@ -40,7 +39,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -9,7 +9,6 @@ import org.testng.annotations.Test;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AuthorTemplateTest {
|
||||
Path outputDirectory;
|
||||
|
@ -6,7 +6,6 @@ import org.openapitools.codegen.config.Context;
|
||||
import org.openapitools.codegen.config.GeneratorSettings;
|
||||
import org.openapitools.codegen.config.WorkflowSettings;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.TestRunner;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -24,7 +24,6 @@ import org.openapitools.codegen.DefaultGenerator;
|
||||
import org.openapitools.codegen.Generator;
|
||||
import org.openapitools.codegen.SpecValidationException;
|
||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.testng.TestException;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -38,5 +38,5 @@ public enum DocumentationFeature {
|
||||
* Generated output includes documentation for all generated APIs.
|
||||
*/
|
||||
@ToolingExtension
|
||||
Api;
|
||||
Api
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.CharSource;
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
import io.swagger.v3.parser.util.ClasspathHelper;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -96,6 +97,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
* The build context is only avail when running from within eclipse.
|
||||
* It is used to update the eclipse-m2e-layer when the plugin is executed inside the IDE.
|
||||
*/
|
||||
@Setter
|
||||
@Component
|
||||
private BuildContext buildContext = new DefaultBuildContext();
|
||||
|
||||
@ -556,10 +558,6 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(readonly = true, required = true, defaultValue = "${project}")
|
||||
private MavenProject project;
|
||||
|
||||
public void setBuildContext(BuildContext buildContext) {
|
||||
this.buildContext = buildContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException {
|
||||
if (StringUtils.isBlank(inputSpec) && StringUtils.isBlank(inputSpecRootDirectory)) {
|
||||
|
@ -39,10 +39,8 @@ import org.apache.maven.project.ProjectBuilder;
|
||||
import org.apache.maven.project.ProjectBuildingRequest;
|
||||
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
import org.eclipse.aether.impl.DefaultServiceLocator;
|
||||
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
|
||||
public class CodeGenMojoTest extends BaseTestCase {
|
||||
@Override
|
||||
|
@ -17,8 +17,12 @@
|
||||
|
||||
package org.openapitools.codegen.online.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@Setter
|
||||
@javax.xml.bind.annotation.XmlRootElement
|
||||
public class ApiResponse {
|
||||
public static final int ERROR = 1;
|
||||
@ -28,8 +32,8 @@ public class ApiResponse {
|
||||
public static final int TOO_BUSY = 5;
|
||||
|
||||
int code;
|
||||
String type;
|
||||
String message;
|
||||
@Getter String type;
|
||||
@Getter String message;
|
||||
|
||||
public ApiResponse() {}
|
||||
|
||||
@ -62,24 +66,4 @@ public class ApiResponse {
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
@ -17,23 +17,11 @@
|
||||
|
||||
package org.openapitools.codegen.online.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter @Setter
|
||||
public class Generated {
|
||||
private String filename;
|
||||
private String friendlyName;
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String getFriendlyName() {
|
||||
return friendlyName;
|
||||
}
|
||||
|
||||
public void setFriendlyName(String friendlyName) {
|
||||
this.friendlyName = friendlyName;
|
||||
}
|
||||
}
|
||||
|
@ -20,45 +20,20 @@ package org.openapitools.codegen.online.model;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Setter
|
||||
public class GeneratorInput {
|
||||
private JsonNode spec;
|
||||
private Map<String, String> options;
|
||||
@Getter private JsonNode spec;
|
||||
@Getter private Map<String, String> options;
|
||||
private String openAPIUrl;
|
||||
private AuthorizationValue authorizationValue;
|
||||
|
||||
public AuthorizationValue getAuthorizationValue() {
|
||||
return authorizationValue;
|
||||
}
|
||||
|
||||
public void setAuthorizationValue(AuthorizationValue authorizationValue) {
|
||||
this.authorizationValue = authorizationValue;
|
||||
}
|
||||
|
||||
public JsonNode getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public void setSpec(JsonNode spec) {
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public Map<String, String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(Map<String, String> options) {
|
||||
this.options = options;
|
||||
}
|
||||
@Getter private AuthorizationValue authorizationValue;
|
||||
|
||||
@ApiModelProperty(example = "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml")
|
||||
public String getOpenAPIUrl() {
|
||||
return openAPIUrl;
|
||||
}
|
||||
|
||||
public void setOpenAPIUrl(String url) {
|
||||
this.openAPIUrl = url;
|
||||
}
|
||||
}
|
||||
|
@ -18,36 +18,25 @@
|
||||
package org.openapitools.codegen.online.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter @NoArgsConstructor @AllArgsConstructor
|
||||
public class ResponseCode {
|
||||
private String code;
|
||||
private String link;
|
||||
|
||||
public ResponseCode() {}
|
||||
|
||||
public ResponseCode(String code, String link) {
|
||||
setCode(code);
|
||||
setLink(link);
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "File download code",
|
||||
example = "d40029be-eda6-4d62-b1ef-d05e2e91a72a")
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "URL for fetching the generated client",
|
||||
example = "http://localhost:8080/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a")
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
}
|
||||
|
@ -19,17 +19,21 @@ package org.openapitools.codegen;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CliOption {
|
||||
private final String opt;
|
||||
@Getter private final String opt;
|
||||
@Getter @Setter
|
||||
private String description;
|
||||
@Getter @Setter
|
||||
private String type;
|
||||
private String defaultValue;
|
||||
private String optValue;
|
||||
@Getter private String optValue;
|
||||
private Map<String, String> enumValues;
|
||||
|
||||
public CliOption(String opt, String description) {
|
||||
@ -42,26 +46,6 @@ public class CliOption {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getOpt() {
|
||||
return opt;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDefault() {
|
||||
return defaultValue;
|
||||
}
|
||||
@ -75,10 +59,6 @@ public class CliOption {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOptValue() {
|
||||
return this.optValue;
|
||||
}
|
||||
|
||||
public void setOptValue(String optValue) {
|
||||
if (this.enumValues!=null && this.enumValues.containsKey(optValue)) {
|
||||
this.optValue = optValue;
|
||||
|
@ -20,6 +20,7 @@ package org.openapitools.codegen;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.openapitools.codegen.api.TemplateDefinition;
|
||||
import org.openapitools.codegen.auth.AuthParser;
|
||||
import org.openapitools.codegen.config.GeneratorSettings;
|
||||
@ -31,7 +32,8 @@ public class ClientOptInput {
|
||||
private GeneratorSettings generatorSettings;
|
||||
private OpenAPI openAPI;
|
||||
private List<AuthorizationValue> auths;
|
||||
private List<TemplateDefinition> userDefinedTemplates;
|
||||
// not deprecated as this is added to match other functionality, we need to move to Context<?> instead of ClientOptInput.
|
||||
@Getter private List<TemplateDefinition> userDefinedTemplates;
|
||||
|
||||
public ClientOptInput openAPI(OpenAPI openAPI) {
|
||||
this.setOpenAPI(openAPI);
|
||||
@ -79,11 +81,6 @@ public class ClientOptInput {
|
||||
return config;
|
||||
}
|
||||
|
||||
public List<TemplateDefinition> getUserDefinedTemplates() {
|
||||
// not deprecated as this is added to match other functionality, we need to move to Context<?> instead of ClientOptInput.
|
||||
return userDefinedTemplates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the generator/config instance
|
||||
*
|
||||
|
@ -16,8 +16,12 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Getter @Setter
|
||||
public class CodegenComposedSchemas {
|
||||
private List<CodegenProperty> allOf;
|
||||
private List<CodegenProperty> oneOf;
|
||||
@ -31,38 +35,6 @@ public class CodegenComposedSchemas {
|
||||
this.not = not;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getAllOf() {
|
||||
return allOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getOneOf() {
|
||||
return oneOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getAnyOf() {
|
||||
return anyOf;
|
||||
}
|
||||
|
||||
public CodegenProperty getNot() {
|
||||
return not;
|
||||
}
|
||||
|
||||
public void setAllOf(List<CodegenProperty> allOf) {
|
||||
this.allOf = allOf;
|
||||
}
|
||||
|
||||
public void setOneOf(List<CodegenProperty> oneOf) {
|
||||
this.oneOf = oneOf;
|
||||
}
|
||||
|
||||
public void setAnyOf(List<CodegenProperty> anyOf) {
|
||||
this.anyOf = anyOf;
|
||||
}
|
||||
|
||||
public void setNot(CodegenProperty not) {
|
||||
this.not = not;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenComposedSchemas{");
|
||||
sb.append("oneOf=").append(oneOf);
|
||||
|
@ -1,5 +1,8 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -14,10 +17,15 @@ import java.util.*;
|
||||
public class CodegenDiscriminator {
|
||||
// The name of the property in the payload that will hold the discriminator value.
|
||||
// This is the propertyName as specified in the OpenAPI discriminator object.
|
||||
@Getter @Setter
|
||||
private String propertyName;
|
||||
@Getter @Setter
|
||||
private String propertyBaseName;
|
||||
@Getter @Setter
|
||||
private String propertyGetter;
|
||||
@Getter @Setter
|
||||
private String propertyType;
|
||||
@Getter @Setter
|
||||
private Map<String, String> mapping;
|
||||
private boolean isEnum;
|
||||
|
||||
@ -36,58 +44,12 @@ public class CodegenDiscriminator {
|
||||
//
|
||||
// see the method createDiscriminator in DefaultCodegen.java
|
||||
|
||||
@Getter @Setter
|
||||
private Set<MappedModel> mappedModels = new TreeSet<>();
|
||||
@Getter @Setter
|
||||
private Map<String, Object> vendorExtensions = new HashMap<>();
|
||||
|
||||
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
public void setPropertyName(String propertyName) {
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
||||
public String getPropertyGetter() {
|
||||
return propertyGetter;
|
||||
}
|
||||
|
||||
public void setPropertyGetter(String propertyGetter) {
|
||||
this.propertyGetter = propertyGetter;
|
||||
}
|
||||
|
||||
public String getPropertyBaseName() {
|
||||
return propertyBaseName;
|
||||
}
|
||||
|
||||
public void setPropertyBaseName(String propertyBaseName) {
|
||||
this.propertyBaseName = propertyBaseName;
|
||||
}
|
||||
|
||||
public String getPropertyType() {
|
||||
return propertyType;
|
||||
}
|
||||
|
||||
public void setPropertyType(String propertyType) {
|
||||
this.propertyType = propertyType;
|
||||
}
|
||||
|
||||
public Map<String, String> getMapping() {
|
||||
return mapping;
|
||||
}
|
||||
|
||||
public void setMapping(Map<String, String> mapping) {
|
||||
this.mapping = mapping;
|
||||
}
|
||||
|
||||
public Set<MappedModel> getMappedModels() {
|
||||
return mappedModels;
|
||||
}
|
||||
|
||||
public void setMappedModels(Set<MappedModel> mappedModels) {
|
||||
this.mappedModels = mappedModels;
|
||||
}
|
||||
|
||||
public boolean getIsEnum() {
|
||||
return isEnum;
|
||||
}
|
||||
@ -95,15 +57,7 @@ public class CodegenDiscriminator {
|
||||
public void setIsEnum(boolean isEnum) {
|
||||
this.isEnum = isEnum;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
public void setVendorExtensions(Map<String, Object> vendorExtensions) {
|
||||
this.vendorExtensions = vendorExtensions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An object to hold discriminator mappings between payload values and schema names or
|
||||
* references.
|
||||
@ -116,11 +70,14 @@ public class CodegenDiscriminator {
|
||||
*/
|
||||
public static class MappedModel implements Comparable<MappedModel>{
|
||||
// The value of the discriminator property in the payload.
|
||||
@Getter @Setter
|
||||
private String mappingName;
|
||||
// The OAS schema name. It is obtained from the OAS document, and the string value
|
||||
// is converted to a sanitized, internal representation within codegen.
|
||||
@Getter @Setter
|
||||
private String modelName;
|
||||
|
||||
@Getter @Setter
|
||||
private CodegenModel model;
|
||||
|
||||
private final boolean explicitMapping;
|
||||
@ -154,26 +111,6 @@ public class CodegenDiscriminator {
|
||||
}
|
||||
}
|
||||
|
||||
public String getMappingName() {
|
||||
return mappingName;
|
||||
}
|
||||
|
||||
public void setMappingName(String mappingName) {
|
||||
this.mappingName = mappingName;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return modelName;
|
||||
}
|
||||
|
||||
public void setModelName(String modelName) {
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public CodegenModel getModel() { return model; }
|
||||
|
||||
public void setModel(CodegenModel model) { this.model = model; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -1,17 +1,19 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CodegenEncoding {
|
||||
private String contentType;
|
||||
private List<CodegenParameter> headers;
|
||||
private String style;
|
||||
@Getter private String contentType;
|
||||
@Getter private List<CodegenParameter> headers;
|
||||
@Getter private String style;
|
||||
private boolean explode;
|
||||
private boolean allowReserved;
|
||||
public Map<String, Object> vendorExtensions = new HashMap<>();
|
||||
@Getter public Map<String, Object> vendorExtensions = new HashMap<>();
|
||||
|
||||
public CodegenEncoding(String contentType, List<CodegenParameter> headers, String style, boolean explode, boolean allowReserved) {
|
||||
this.contentType = contentType;
|
||||
@ -21,18 +23,6 @@ public class CodegenEncoding {
|
||||
this.allowReserved = allowReserved;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public List<CodegenParameter> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public boolean getExplode() {
|
||||
return explode;
|
||||
}
|
||||
@ -41,10 +31,6 @@ public class CodegenEncoding {
|
||||
return allowReserved;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenEncoding{");
|
||||
sb.append("contentType=").append(contentType);
|
||||
|
@ -1,13 +1,14 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CodegenMediaType {
|
||||
@Getter public class CodegenMediaType {
|
||||
private CodegenProperty schema;
|
||||
private LinkedHashMap<String, CodegenEncoding> encoding;
|
||||
private HashMap<String, SchemaTestCase> testCases = new HashMap<>();
|
||||
@ -33,28 +34,6 @@ public class CodegenMediaType {
|
||||
this.example = example;
|
||||
}
|
||||
|
||||
public CodegenProperty getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, CodegenEncoding> getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public HashMap<String, SchemaTestCase> getTestCases() { return testCases; }
|
||||
|
||||
public Map<String, Example> getExamples() {
|
||||
return examples;
|
||||
}
|
||||
|
||||
public Object getExample() {
|
||||
return example;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenMediaType{");
|
||||
sb.append("schema=").append(schema);
|
||||
|
@ -22,6 +22,8 @@ import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
@ -35,15 +37,21 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
// object is a discriminator, that object is set as the parent. If no discriminator is specified,
|
||||
// codegen returns the first one in the list, i.e. there is no obvious parent in the OpenAPI specification.
|
||||
// When possible, the mustache templates should use 'allParents' to handle multiple parents.
|
||||
@Getter @Setter
|
||||
public String parent, parentSchema;
|
||||
@Getter @Setter
|
||||
public List<String> interfaces;
|
||||
// The list of parent model name from the schemas. In order of preference, the parent is obtained
|
||||
// from the 'allOf' attribute, then 'anyOf', and finally 'oneOf'.
|
||||
@Getter @Setter
|
||||
public List<String> allParents;
|
||||
|
||||
// References to parent and interface CodegenModels. Only set when code generator supports inheritance.
|
||||
@Getter @Setter
|
||||
public CodegenModel parentModel;
|
||||
@Getter @Setter
|
||||
public List<CodegenModel> interfaceModels;
|
||||
@Getter @Setter
|
||||
public List<CodegenModel> children;
|
||||
|
||||
// anyOf, oneOf, allOf
|
||||
@ -53,42 +61,101 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
|
||||
// The schema name as written in the OpenAPI document
|
||||
// If it's a reserved word, it will be escaped.
|
||||
@Getter @Setter
|
||||
public String name;
|
||||
// The original schema name as written in the OpenAPI document.
|
||||
@Getter @Setter
|
||||
public String schemaName;
|
||||
// The language-specific name of the class that implements this schema.
|
||||
// The name of the class is derived from the OpenAPI schema name with formatting rules applied.
|
||||
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
|
||||
@Getter @Setter
|
||||
public String classname;
|
||||
// The value of the 'title' attribute in the OpenAPI document.
|
||||
@Getter @Setter
|
||||
public String title;
|
||||
@Getter @Setter
|
||||
public String description, classVarName, modelJson, dataType, xmlPrefix, xmlNamespace, xmlName;
|
||||
@Getter @Setter
|
||||
public String classFilename; // store the class file name, mainly used for import
|
||||
@Getter @Setter
|
||||
public String unescapedDescription;
|
||||
public CodegenDiscriminator discriminator;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Returns the discriminator for this schema object, or null if no discriminator has been specified.
|
||||
* The list of all possible schema discriminator mapping values is obtained
|
||||
* from explicit discriminator mapping values in the OpenAPI document, and from
|
||||
* inherited discriminators through oneOf, allOf, anyOf.
|
||||
* For example, a discriminator may be defined in a 'Pet' schema as shown below.
|
||||
* The Dog and Cat schemas inherit the discriminator through the allOf reference.
|
||||
* In the 'Pet' schema, the supported discriminator mapping values for the
|
||||
* 'objectType' properties are 'Dog' and 'Cat'.
|
||||
* The allowed discriminator mapping value for the Dog schema is 'Dog'.
|
||||
* The allowed discriminator mapping value for the Cat schema is 'Dog'.
|
||||
* Pet:
|
||||
* type: object
|
||||
* discriminator:
|
||||
* propertyName: objectType
|
||||
* required:
|
||||
* - objectType
|
||||
* properties:
|
||||
* objectType:
|
||||
* type: string
|
||||
* Dog:
|
||||
* allOf:
|
||||
* - $ref: '#/components/schemas/Pet'
|
||||
* - type: object
|
||||
* properties:
|
||||
* p1:
|
||||
* type: string
|
||||
* Cat:
|
||||
* allOf:
|
||||
* - $ref: '#/components/schemas/Pet'
|
||||
* - type: object
|
||||
* properties:
|
||||
* p2:
|
||||
* type: string
|
||||
*
|
||||
* @return the discriminator.
|
||||
*/
|
||||
@Getter public CodegenDiscriminator discriminator;
|
||||
@Getter @Setter
|
||||
public String defaultValue;
|
||||
@Getter @Setter
|
||||
public String arrayModelType;
|
||||
public boolean isAlias; // Is this effectively an alias of another simple type
|
||||
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime,
|
||||
isDecimal, isShort, isUnboundedInteger, isPrimitiveType, isBoolean, isFreeFormObject;
|
||||
private boolean additionalPropertiesIsAnyType;
|
||||
public List<CodegenProperty> vars = new ArrayList<>(); // all properties (without parent's properties)
|
||||
@Getter @Setter
|
||||
public List<CodegenProperty> allVars = new ArrayList<>(); // all properties (with parent's properties)
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<>(); // a list of required properties
|
||||
@Getter @Setter
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<>(); // a list of optional properties
|
||||
@Getter @Setter
|
||||
public List<CodegenProperty> readOnlyVars = new ArrayList<>(); // a list of read-only properties
|
||||
@Getter @Setter
|
||||
public List<CodegenProperty> readWriteVars = new ArrayList<>(); // a list of properties for read, write
|
||||
@Getter @Setter
|
||||
public List<CodegenProperty> parentVars = new ArrayList<>();
|
||||
public List<CodegenProperty> parentRequiredVars = new ArrayList<>();
|
||||
@Getter @Setter
|
||||
public List<CodegenProperty> nonNullableVars = new ArrayList<>(); // a list of non-nullable properties
|
||||
@Getter @Setter
|
||||
public Map<String, Object> allowableValues;
|
||||
|
||||
// Sorted sets of required parameters.
|
||||
@Getter @Setter
|
||||
public Set<String> mandatory = new TreeSet<>(); // without parent's required properties
|
||||
@Getter @Setter
|
||||
public Set<String> allMandatory = new TreeSet<>(); // with parent's required properties
|
||||
|
||||
@Getter @Setter
|
||||
public Set<String> imports = new TreeSet<>();
|
||||
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation;
|
||||
@Getter @Setter
|
||||
public boolean emptyVars;
|
||||
public boolean hasVars, hasMoreModels, hasEnums, isEnum, hasValidation;
|
||||
/**
|
||||
* Indicates the OAS schema specifies "nullable: true".
|
||||
*/
|
||||
@ -120,8 +187,10 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
* Indicates the all properties of the type are read-only.
|
||||
*/
|
||||
public boolean hasOnlyReadOnly = true;
|
||||
@Getter @Setter
|
||||
public ExternalDocumentation externalDocumentation;
|
||||
|
||||
@Getter @Setter
|
||||
public Map<String, Object> vendorExtensions = new HashMap<>();
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
@ -158,6 +227,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
* type: integer
|
||||
*
|
||||
*/
|
||||
@Getter @Setter
|
||||
public String additionalPropertiesType;
|
||||
|
||||
/**
|
||||
@ -193,14 +263,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
private Map<String, CodegenProperty> requiredVarsMap;
|
||||
private String ref;
|
||||
|
||||
public String getAdditionalPropertiesType() {
|
||||
return additionalPropertiesType;
|
||||
}
|
||||
|
||||
public void setAdditionalPropertiesType(String additionalPropertiesType) {
|
||||
this.additionalPropertiesType = additionalPropertiesType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty getContains() {
|
||||
return contains;
|
||||
@ -271,78 +333,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.schemaIsFromAdditionalProperties = schemaIsFromAdditionalProperties;
|
||||
}
|
||||
|
||||
public Set<String> getAllMandatory() {
|
||||
return allMandatory;
|
||||
}
|
||||
|
||||
public void setAllMandatory(Set<String> allMandatory) {
|
||||
this.allMandatory = allMandatory;
|
||||
}
|
||||
|
||||
public List<String> getAllParents() {
|
||||
return allParents;
|
||||
}
|
||||
|
||||
public void setAllParents(List<String> allParents) {
|
||||
this.allParents = allParents;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getAllVars() {
|
||||
return allVars;
|
||||
}
|
||||
|
||||
public void setAllVars(List<CodegenProperty> allVars) {
|
||||
this.allVars = allVars;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getNonNullableVars() {
|
||||
return nonNullableVars;
|
||||
}
|
||||
|
||||
public void setNonNullableVars(List<CodegenProperty> nonNullableVars) {
|
||||
this.nonNullableVars = nonNullableVars;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAllowableValues() {
|
||||
return allowableValues;
|
||||
}
|
||||
|
||||
public void setAllowableValues(Map<String, Object> allowableValues) {
|
||||
this.allowableValues = allowableValues;
|
||||
}
|
||||
|
||||
public String getArrayModelType() {
|
||||
return arrayModelType;
|
||||
}
|
||||
|
||||
public void setArrayModelType(String arrayModelType) {
|
||||
this.arrayModelType = arrayModelType;
|
||||
}
|
||||
|
||||
public List<CodegenModel> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<CodegenModel> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getClassFilename() {
|
||||
return classFilename;
|
||||
}
|
||||
|
||||
public void setClassFilename(String classFilename) {
|
||||
this.classFilename = classFilename;
|
||||
}
|
||||
|
||||
public String getClassVarName() {
|
||||
return classVarName;
|
||||
}
|
||||
|
||||
public void setClassVarName(String classVarName) {
|
||||
this.classVarName = classVarName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the classname property is sanitized, false if it is the same as the OpenAPI schema name.
|
||||
* The OpenAPI schema name may be any valid JSON schema name, including non-ASCII characters.
|
||||
@ -354,81 +344,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
return !StringUtils.equals(classname, name);
|
||||
}
|
||||
|
||||
public String getClassname() {
|
||||
return classname;
|
||||
}
|
||||
|
||||
public void setClassname(String classname) {
|
||||
this.classname = classname;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the discriminator for this schema object, or null if no discriminator has been specified.
|
||||
*
|
||||
* The list of all possible schema discriminator mapping values is obtained
|
||||
* from explicit discriminator mapping values in the OpenAPI document, and from
|
||||
* inherited discriminators through oneOf, allOf, anyOf.
|
||||
* For example, a discriminator may be defined in a 'Pet' schema as shown below.
|
||||
* The Dog and Cat schemas inherit the discriminator through the allOf reference.
|
||||
* In the 'Pet' schema, the supported discriminator mapping values for the
|
||||
* 'objectType' properties are 'Dog' and 'Cat'.
|
||||
* The allowed discriminator mapping value for the Dog schema is 'Dog'.
|
||||
* The allowed discriminator mapping value for the Cat schema is 'Dog'.
|
||||
*
|
||||
* Pet:
|
||||
* type: object
|
||||
* discriminator:
|
||||
* propertyName: objectType
|
||||
* required:
|
||||
* - objectType
|
||||
* properties:
|
||||
* objectType:
|
||||
* type: string
|
||||
* Dog:
|
||||
* allOf:
|
||||
* - $ref: '#/components/schemas/Pet'
|
||||
* - type: object
|
||||
* properties:
|
||||
* p1:
|
||||
* type: string
|
||||
* Cat:
|
||||
* allOf:
|
||||
* - $ref: '#/components/schemas/Pet'
|
||||
* - type: object
|
||||
* properties:
|
||||
* p2:
|
||||
* type: string
|
||||
*
|
||||
* @return the discriminator.
|
||||
*/
|
||||
public CodegenDiscriminator getDiscriminator() {
|
||||
return discriminator;
|
||||
}
|
||||
|
||||
public void setDiscriminator(CodegenDiscriminator discriminator) {
|
||||
this.discriminator = discriminator;
|
||||
if (discriminator != null && !discriminator.getMappedModels().isEmpty()) {
|
||||
@ -448,110 +363,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
return discriminator == null ? null : discriminator.getPropertyName();
|
||||
}
|
||||
|
||||
public ExternalDocumentation getExternalDocumentation() {
|
||||
return externalDocumentation;
|
||||
}
|
||||
|
||||
public void setExternalDocumentation(ExternalDocumentation externalDocumentation) {
|
||||
this.externalDocumentation = externalDocumentation;
|
||||
}
|
||||
|
||||
public Set<String> getImports() {
|
||||
return imports;
|
||||
}
|
||||
|
||||
public void setImports(Set<String> imports) {
|
||||
this.imports = imports;
|
||||
}
|
||||
|
||||
public List<CodegenModel> getInterfaceModels() {
|
||||
return interfaceModels;
|
||||
}
|
||||
|
||||
public void setInterfaceModels(List<CodegenModel> interfaceModels) {
|
||||
this.interfaceModels = interfaceModels;
|
||||
}
|
||||
|
||||
public List<String> getInterfaces() {
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
public void setInterfaces(List<String> interfaces) {
|
||||
this.interfaces = interfaces;
|
||||
}
|
||||
|
||||
public Set<String> getMandatory() {
|
||||
return mandatory;
|
||||
}
|
||||
|
||||
public void setMandatory(Set<String> mandatory) {
|
||||
this.mandatory = mandatory;
|
||||
}
|
||||
|
||||
public String getModelJson() {
|
||||
return modelJson;
|
||||
}
|
||||
|
||||
public void setModelJson(String modelJson) {
|
||||
this.modelJson = modelJson;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSchemaName() {
|
||||
return schemaName;
|
||||
}
|
||||
|
||||
public void setSchemaName(String schemaName) {
|
||||
this.schemaName = schemaName;
|
||||
}
|
||||
|
||||
|
||||
public List<CodegenProperty> getOptionalVars() {
|
||||
return optionalVars;
|
||||
}
|
||||
|
||||
public void setOptionalVars(List<CodegenProperty> optionalVars) {
|
||||
this.optionalVars = optionalVars;
|
||||
}
|
||||
|
||||
public String getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public CodegenModel getParentModel() {
|
||||
return parentModel;
|
||||
}
|
||||
|
||||
public void setParentModel(CodegenModel parentModel) {
|
||||
this.parentModel = parentModel;
|
||||
}
|
||||
|
||||
public String getParentSchema() {
|
||||
return parentSchema;
|
||||
}
|
||||
|
||||
public void setParentSchema(String parentSchema) {
|
||||
this.parentSchema = parentSchema;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getParentVars() {
|
||||
return parentVars;
|
||||
}
|
||||
|
||||
public void setParentVars(List<CodegenProperty> parentVars) {
|
||||
this.parentVars = parentVars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
@ -823,22 +634,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.hasValidation = hasValidation;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getReadOnlyVars() {
|
||||
return readOnlyVars;
|
||||
}
|
||||
|
||||
public void setReadOnlyVars(List<CodegenProperty> readOnlyVars) {
|
||||
this.readOnlyVars = readOnlyVars;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getReadWriteVars() {
|
||||
return readWriteVars;
|
||||
}
|
||||
|
||||
public void setReadWriteVars(List<CodegenProperty> readWriteVars) {
|
||||
this.readWriteVars = readWriteVars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodegenProperty> getRequiredVars() {
|
||||
return requiredVars;
|
||||
@ -849,22 +644,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.requiredVars = requiredVars;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getUnescapedDescription() {
|
||||
return unescapedDescription;
|
||||
}
|
||||
|
||||
public void setUnescapedDescription(String unescapedDescription) {
|
||||
this.unescapedDescription = unescapedDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodegenProperty> getVars() {
|
||||
return vars;
|
||||
@ -875,38 +654,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.vars = vars;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
public void setVendorExtensions(Map<String, Object> vendorExtensions) {
|
||||
this.vendorExtensions = vendorExtensions;
|
||||
}
|
||||
|
||||
public String getXmlName() {
|
||||
return xmlName;
|
||||
}
|
||||
|
||||
public void setXmlName(String xmlName) {
|
||||
this.xmlName = xmlName;
|
||||
}
|
||||
|
||||
public String getXmlNamespace() {
|
||||
return xmlNamespace;
|
||||
}
|
||||
|
||||
public void setXmlNamespace(String xmlNamespace) {
|
||||
this.xmlNamespace = xmlNamespace;
|
||||
}
|
||||
|
||||
public String getXmlPrefix() {
|
||||
return xmlPrefix;
|
||||
}
|
||||
|
||||
public void setXmlPrefix(String xmlPrefix) {
|
||||
this.xmlPrefix = xmlPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsNull() {
|
||||
return isNull;
|
||||
@ -1007,8 +754,10 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.isFreeFormObject = isFreeFormObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsUuid() { return isUuid; }
|
||||
|
||||
@Override
|
||||
public void setIsUuid(boolean isUuid) { this.isUuid = isUuid; }
|
||||
|
||||
public boolean getIsUri() { return isUri; }
|
||||
@ -1382,14 +1131,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmptyVars() {
|
||||
return emptyVars;
|
||||
}
|
||||
|
||||
public void setEmptyVars(boolean emptyVars) {
|
||||
this.emptyVars = emptyVars;
|
||||
}
|
||||
|
||||
public boolean getHasItems() {
|
||||
return this.items != null;
|
||||
}
|
||||
|
@ -17,7 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
public enum CodegenModelType {
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter public enum CodegenModelType {
|
||||
|
||||
MODEL(CodegenModel.class),
|
||||
OPERATION(CodegenOperation.class),
|
||||
@ -32,7 +34,4 @@ public enum CodegenModelType {
|
||||
this.defaultImplementation = defaultImplementation;
|
||||
}
|
||||
|
||||
public Class<?> getDefaultImplementation() {
|
||||
return defaultImplementation;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Describes a single operation parameter in the OAS specification.
|
||||
@ -67,6 +69,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
public String containerType;
|
||||
public String containerTypeMapped; // language-specified container type (e.g. `dict` in python for map)
|
||||
|
||||
@Getter @Setter
|
||||
private CodegenProperty schema;
|
||||
private boolean additionalPropertiesIsAnyType;
|
||||
private boolean hasVars;
|
||||
@ -130,6 +133,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
@Getter @Setter
|
||||
private LinkedHashMap<String, CodegenMediaType> content;
|
||||
private Map<String, CodegenProperty> requiredVarsMap;
|
||||
private String ref;
|
||||
@ -923,8 +927,6 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
return hasDiscriminatorWithNonEmptyMapping;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
|
||||
@ -990,22 +992,6 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
this.hasMultipleTypes = hasMultipleTypes;
|
||||
}
|
||||
|
||||
public CodegenProperty getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public void setSchema(CodegenProperty schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseType() {
|
||||
return baseType;
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -29,42 +32,58 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
* The value of the 'type' attribute in the OpenAPI schema.
|
||||
* The per-language codegen logic may change to a language-specific type.
|
||||
*/
|
||||
@Getter
|
||||
public String openApiType;
|
||||
@Getter @Setter
|
||||
public String baseName;
|
||||
public String complexType;
|
||||
@Setter public String complexType;
|
||||
@Getter @Setter
|
||||
public String getter;
|
||||
@Getter @Setter
|
||||
public String setter;
|
||||
/**
|
||||
* The value of the 'description' attribute in the OpenAPI schema.
|
||||
*/
|
||||
@Getter @Setter
|
||||
public String description;
|
||||
/**
|
||||
* The language-specific data type for this property. For example, the OpenAPI type 'integer'
|
||||
* may be represented as 'int', 'int32', 'Integer', etc, depending on the programming language.
|
||||
*/
|
||||
public String dataType;
|
||||
@Getter @Setter
|
||||
public String datatypeWithEnum;
|
||||
@Getter @Setter
|
||||
public String dataFormat;
|
||||
/**
|
||||
* The name of this property in the OpenAPI schema.
|
||||
*/
|
||||
@Getter @Setter
|
||||
public String name;
|
||||
@Getter @Setter
|
||||
public String min; // TODO: is this really used?
|
||||
@Getter @Setter
|
||||
public String max; // TODO: is this really used?
|
||||
@Getter @Setter
|
||||
public String defaultValue;
|
||||
@Getter @Setter
|
||||
public String defaultValueWithParam;
|
||||
public String baseType;
|
||||
@Setter public String baseType;
|
||||
@Getter @Setter
|
||||
public String containerType;
|
||||
@Getter @Setter
|
||||
public String containerTypeMapped; // language-specified container type (e.g. `dict` in python for map)
|
||||
|
||||
/**
|
||||
* The value of the 'title' attribute in the OpenAPI schema.
|
||||
*/
|
||||
@Getter @Setter
|
||||
public String title;
|
||||
|
||||
/**
|
||||
* The 'description' string without escape characters needed by some programming languages/targets
|
||||
*/
|
||||
@Getter @Setter
|
||||
public String unescapedDescription;
|
||||
|
||||
/**
|
||||
@ -82,8 +101,10 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
/**
|
||||
* A free-form property to include an example of an instance for this schema.
|
||||
*/
|
||||
@Getter @Setter
|
||||
public String example;
|
||||
|
||||
@Getter @Setter
|
||||
public String jsonSchema;
|
||||
/**
|
||||
* The value of the 'minimum' attribute in the OpenAPI schema.
|
||||
@ -110,7 +131,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
* The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance.
|
||||
*/
|
||||
public boolean exclusiveMaximum;
|
||||
public boolean required;
|
||||
@Setter public boolean required;
|
||||
public boolean deprecated;
|
||||
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
|
||||
public boolean isPrimitiveType;
|
||||
@ -170,7 +191,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
public boolean isDiscriminator;
|
||||
public boolean isNew; // true when this property overrides an inherited property
|
||||
public Boolean isOverridden; // true if the property is a parent property (not defined in child/current schema)
|
||||
@Getter @Setter
|
||||
public List<String> _enum;
|
||||
@Getter @Setter
|
||||
public Map<String, Object> allowableValues;
|
||||
// If 'additionalProperties' is not set, items is null.
|
||||
// If 'additionalProperties' is set to a type or refers to a type, 'items' provides the type information for
|
||||
@ -180,16 +203,22 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<>();
|
||||
public CodegenProperty mostInnerItems;
|
||||
@Getter @Setter
|
||||
public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
public boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
|
||||
public boolean isInherited;
|
||||
public String discriminatorValue;
|
||||
|
||||
@Getter @Setter
|
||||
public String nameInLowerCase; // property name in lower case
|
||||
@Getter @Setter
|
||||
public String nameInCamelCase; // property name in camel case (e.g. modifiedDate)
|
||||
@Getter @Setter
|
||||
public String nameInPascalCase; // property name in pascal case (e.g. ModifiedDate)
|
||||
@Getter
|
||||
public String nameInSnakeCase; // property name in upper snake case
|
||||
// enum name based on the property name, usually use as a prefix (e.g. VAR_NAME) for enum name (e.g. VAR_NAME_VALUE1)
|
||||
@Getter @Setter
|
||||
public String enumName;
|
||||
public Integer maxItems;
|
||||
public Integer minItems;
|
||||
@ -201,8 +230,11 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
|
||||
// XML
|
||||
public boolean isXmlAttribute = false;
|
||||
@Getter @Setter
|
||||
public String xmlPrefix;
|
||||
@Getter @Setter
|
||||
public String xmlName;
|
||||
@Getter @Setter
|
||||
public String xmlNamespace;
|
||||
public boolean isXmlWrapped = false;
|
||||
private boolean additionalPropertiesIsAnyType;
|
||||
@ -270,48 +302,11 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.isBooleanSchemaFalse = isBooleanSchemaFalse;
|
||||
}
|
||||
|
||||
public String getOpenApiType() { return openApiType; }
|
||||
|
||||
public String getBaseName() {
|
||||
return baseName;
|
||||
}
|
||||
|
||||
public void setBaseName(String baseName) {
|
||||
this.baseName = baseName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComplexType() {
|
||||
return complexType;
|
||||
}
|
||||
|
||||
public void setComplexType(String complexType) {
|
||||
this.complexType = complexType;
|
||||
}
|
||||
|
||||
public String getGetter() {
|
||||
return getter;
|
||||
}
|
||||
|
||||
public void setGetter(String getter) {
|
||||
this.getter = getter;
|
||||
}
|
||||
|
||||
public String getSetter() {
|
||||
return setter;
|
||||
}
|
||||
|
||||
public void setSetter(String setter) {
|
||||
this.setter = setter;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return dataType
|
||||
* @deprecated since version 3.0.0, use {@link #getDataType()} instead.<br>
|
||||
@ -322,119 +317,29 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
return getDataType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setDataType()} instead.
|
||||
* @deprecated use {@link #setDataType(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDatatype(String datatype) {
|
||||
this.dataType = datatype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDatatypeWithEnum() {
|
||||
return datatypeWithEnum;
|
||||
}
|
||||
|
||||
public void setDatatypeWithEnum(String datatypeWithEnum) {
|
||||
this.datatypeWithEnum = datatypeWithEnum;
|
||||
}
|
||||
|
||||
public String getDataFormat() {
|
||||
return dataFormat;
|
||||
}
|
||||
|
||||
public void setDataFormat(String dataFormat) {
|
||||
this.dataFormat = dataFormat;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(String min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public String getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(String max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDefaultValueWithParam() {
|
||||
return defaultValueWithParam;
|
||||
}
|
||||
|
||||
public void setDefaultValueWithParam(String defaultValueWithParam) {
|
||||
this.defaultValueWithParam = defaultValueWithParam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseType() {
|
||||
return baseType;
|
||||
}
|
||||
|
||||
public void setBaseType(String baseType) {
|
||||
this.baseType = baseType;
|
||||
}
|
||||
|
||||
public String getContainerType() {
|
||||
return containerType;
|
||||
}
|
||||
|
||||
public void setContainerType(String containerType) {
|
||||
this.containerType = containerType;
|
||||
}
|
||||
|
||||
public String getContainerTypeMapped() {
|
||||
return containerTypeMapped;
|
||||
}
|
||||
|
||||
public void setContainerTypeMapped(String containerTypeMapped) {
|
||||
this.containerTypeMapped = containerTypeMapped;
|
||||
}
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getUnescapedDescription() {
|
||||
return unescapedDescription;
|
||||
}
|
||||
|
||||
public void setUnescapedDescription(String unescapedDescription) {
|
||||
this.unescapedDescription = unescapedDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSchemaIsFromAdditionalProperties() {
|
||||
return schemaIsFromAdditionalProperties;
|
||||
@ -475,22 +380,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public String getExample() {
|
||||
return example;
|
||||
}
|
||||
|
||||
public void setExample(String example) {
|
||||
this.example = example;
|
||||
}
|
||||
|
||||
public String getJsonSchema() {
|
||||
return jsonSchema;
|
||||
}
|
||||
|
||||
public void setJsonSchema(String jsonSchema) {
|
||||
this.jsonSchema = jsonSchema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMinimum() {
|
||||
return minimum;
|
||||
@ -547,26 +436,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
return !getRequired() || isNullable;
|
||||
}
|
||||
|
||||
public void setRequired(boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public List<String> get_enum() {
|
||||
return _enum;
|
||||
}
|
||||
|
||||
public void set_enum(List<String> _enum) {
|
||||
this._enum = _enum;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAllowableValues() {
|
||||
return allowableValues;
|
||||
}
|
||||
|
||||
public void setAllowableValues(Map<String, Object> allowableValues) {
|
||||
this.allowableValues = allowableValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty getItems() {
|
||||
return items;
|
||||
@ -687,50 +556,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.isPrimitiveType = isPrimitiveType;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
public void setVendorExtensions(Map<String, Object> vendorExtensions) {
|
||||
this.vendorExtensions = vendorExtensions;
|
||||
}
|
||||
|
||||
public String getNameInLowerCase() {
|
||||
return nameInLowerCase;
|
||||
}
|
||||
|
||||
public void setNameInLowerCase(String nameInLowerCase) {
|
||||
this.nameInLowerCase = nameInLowerCase;
|
||||
}
|
||||
|
||||
public String getNameInCamelCase() {
|
||||
return nameInCamelCase;
|
||||
}
|
||||
|
||||
public void setNameInCamelCase(String nameInCamelCase) {
|
||||
this.nameInCamelCase = nameInCamelCase;
|
||||
}
|
||||
|
||||
public String getNameInPascalCase() {
|
||||
return nameInPascalCase;
|
||||
}
|
||||
|
||||
public void setNameInPascalCase(String nameInPascalCase) {
|
||||
this.nameInPascalCase = nameInPascalCase;
|
||||
}
|
||||
|
||||
public String getNameInSnakeCase() {
|
||||
return nameInSnakeCase;
|
||||
}
|
||||
|
||||
public String getEnumName() {
|
||||
return enumName;
|
||||
}
|
||||
|
||||
public void setEnumName(String enumName) {
|
||||
this.enumName = enumName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getMaxItems() {
|
||||
return maxItems;
|
||||
@ -751,30 +576,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.minItems = minItems;
|
||||
}
|
||||
|
||||
public String getXmlPrefix() {
|
||||
return xmlPrefix;
|
||||
}
|
||||
|
||||
public void setXmlPrefix(String xmlPrefix) {
|
||||
this.xmlPrefix = xmlPrefix;
|
||||
}
|
||||
|
||||
public String getXmlName() {
|
||||
return xmlName;
|
||||
}
|
||||
|
||||
public void setXmlName(String xmlName) {
|
||||
this.xmlName = xmlName;
|
||||
}
|
||||
|
||||
public String getXmlNamespace() {
|
||||
return xmlNamespace;
|
||||
}
|
||||
|
||||
public void setXmlNamespace(String xmlNamespace) {
|
||||
this.xmlNamespace = xmlNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
|
||||
this.composedSchemas = composedSchemas;
|
||||
@ -983,8 +784,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
return hasDiscriminatorWithNonEmptyMapping;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
|
||||
@ -1044,10 +843,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.hasMultipleTypes = hasMultipleTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsUuid() {
|
||||
return isUuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsUuid(boolean isUuid) {
|
||||
this.isUuid = isUuid;
|
||||
}
|
||||
|
@ -17,10 +17,14 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
||||
@Getter @Setter
|
||||
private List<CodegenParameter> responseHeaders = new ArrayList<CodegenParameter>();
|
||||
public String code;
|
||||
public boolean is1xx;
|
||||
@ -94,6 +98,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
@Getter @Setter
|
||||
private LinkedHashMap<String, CodegenMediaType> content;
|
||||
private Map<String, CodegenProperty> requiredVarsMap;
|
||||
private String ref;
|
||||
@ -249,22 +254,6 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
@Override
|
||||
public void setFormat(String format) {}
|
||||
|
||||
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<CodegenParameter> getResponseHeaders() {
|
||||
return responseHeaders;
|
||||
}
|
||||
|
||||
public void setResponseHeaders(List<CodegenParameter> responseHeaders) {
|
||||
this.responseHeaders = responseHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
@ -722,8 +711,6 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
return hasDiscriminatorWithNonEmptyMapping;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
|
||||
|
@ -42,6 +42,8 @@ import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import io.swagger.v3.oas.models.servers.ServerVariable;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
@ -181,12 +183,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> operationIdNameMapping = new HashMap<>();
|
||||
// a map to store the rules in OpenAPI Normalizer
|
||||
protected Map<String, String> openapiNormalizer = new HashMap<>();
|
||||
protected String modelPackage = "", apiPackage = "", fileSuffix;
|
||||
@Setter protected String modelPackage = "", apiPackage = "";
|
||||
protected String fileSuffix;
|
||||
@Getter @Setter
|
||||
protected String modelNamePrefix = "", modelNameSuffix = "";
|
||||
@Getter @Setter
|
||||
protected String apiNamePrefix = "", apiNameSuffix = "Api";
|
||||
protected String testPackage = "";
|
||||
protected String filesMetadataFilename = "FILES";
|
||||
protected String versionMetadataFilename = "VERSION";
|
||||
@Setter protected String filesMetadataFilename = "FILES";
|
||||
@Setter protected String versionMetadataFilename = "VERSION";
|
||||
/*
|
||||
apiTemplateFiles are for API outputs only (controllers/handlers).
|
||||
API templates may be written multiple times; APIs are grouped by tag and the file is written once per tag group.
|
||||
@ -198,7 +203,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<>();
|
||||
protected String templateDir;
|
||||
@Setter protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected Map<String, Object> additionalProperties = new HashMap<>();
|
||||
protected Map<String, String> serverVariables = new HashMap<>();
|
||||
@ -213,7 +218,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected List<CliOption> cliOptions = new ArrayList<>();
|
||||
protected boolean skipOverwrite;
|
||||
protected boolean removeOperationIdPrefix;
|
||||
@Getter @Setter
|
||||
protected String removeOperationIdPrefixDelimiter = "_";
|
||||
@Getter @Setter
|
||||
protected int removeOperationIdPrefixCount = 1;
|
||||
protected boolean skipOperationExample;
|
||||
|
||||
@ -246,9 +253,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean supportsMixins;
|
||||
protected Map<String, String> supportedLibraries = new LinkedHashMap<>();
|
||||
protected String library;
|
||||
@Getter @Setter
|
||||
protected Boolean sortParamsByRequiredFlag = true;
|
||||
@Getter @Setter
|
||||
protected Boolean sortModelPropertiesByRequiredFlag = false;
|
||||
@Getter @Setter
|
||||
protected Boolean ensureUniqueParams = true;
|
||||
@Getter @Setter
|
||||
protected Boolean allowUnicodeIdentifiers = false;
|
||||
protected String gitHost, gitUserId, gitRepoId, releaseNote;
|
||||
protected String httpUserAgent;
|
||||
@ -259,6 +270,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> specialCharReplacements = new LinkedHashMap<>();
|
||||
// When a model is an alias for a simple type
|
||||
protected Map<String, String> typeAliases = Collections.emptyMap();
|
||||
@Getter @Setter
|
||||
protected Boolean prependFormOrBodyParameters = false;
|
||||
// The extension of the generated documentation files (defaults to markdown .md)
|
||||
protected String docExtension;
|
||||
@ -281,15 +293,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean removeEnumValuePrefix = true;
|
||||
|
||||
// Support legacy logic for evaluating discriminators
|
||||
protected boolean legacyDiscriminatorBehavior = true;
|
||||
@Setter protected boolean legacyDiscriminatorBehavior = true;
|
||||
|
||||
// Specify what to do if the 'additionalProperties' keyword is not present in a schema.
|
||||
// See CodegenConstants.java for more details.
|
||||
protected boolean disallowAdditionalPropertiesIfNotPresent = true;
|
||||
@Setter protected boolean disallowAdditionalPropertiesIfNotPresent = true;
|
||||
|
||||
// If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.
|
||||
// With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.
|
||||
protected boolean enumUnknownDefaultCase = false;
|
||||
@Setter protected boolean enumUnknownDefaultCase = false;
|
||||
protected String enumUnknownDefaultCaseName = "unknown_default_open_api";
|
||||
|
||||
// make openapi available to all methods
|
||||
@ -312,8 +324,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean addSuffixToDuplicateOperationNicknames = true;
|
||||
|
||||
// Whether to automatically hardcode params that are considered Constants by OpenAPI Spec
|
||||
protected boolean autosetConstants = false;
|
||||
@Setter protected boolean autosetConstants = false;
|
||||
|
||||
@Override
|
||||
public boolean getAddSuffixToDuplicateOperationNicknames() {
|
||||
return addSuffixToDuplicateOperationNicknames;
|
||||
}
|
||||
@ -1456,127 +1469,23 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return filesMetadataFilename;
|
||||
}
|
||||
|
||||
public void setFilesMetadataFilename(String filesMetadataFilename) {
|
||||
this.filesMetadataFilename = filesMetadataFilename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersionMetadataFilename() {
|
||||
return versionMetadataFilename;
|
||||
}
|
||||
|
||||
public void setVersionMetadataFilename(String versionMetadataFilename) {
|
||||
this.versionMetadataFilename = versionMetadataFilename;
|
||||
}
|
||||
|
||||
public void setTemplateDir(String templateDir) {
|
||||
this.templateDir = templateDir;
|
||||
}
|
||||
|
||||
public void setModelPackage(String modelPackage) {
|
||||
this.modelPackage = modelPackage;
|
||||
}
|
||||
|
||||
public String getModelNamePrefix() {
|
||||
return modelNamePrefix;
|
||||
}
|
||||
|
||||
public void setModelNamePrefix(String modelNamePrefix) {
|
||||
this.modelNamePrefix = modelNamePrefix;
|
||||
}
|
||||
|
||||
public String getModelNameSuffix() {
|
||||
return modelNameSuffix;
|
||||
}
|
||||
|
||||
public void setModelNameSuffix(String modelNameSuffix) {
|
||||
this.modelNameSuffix = modelNameSuffix;
|
||||
}
|
||||
|
||||
public String getApiNameSuffix() {
|
||||
return apiNameSuffix;
|
||||
}
|
||||
|
||||
public void setApiNameSuffix(String apiNameSuffix) {
|
||||
this.apiNameSuffix = apiNameSuffix;
|
||||
}
|
||||
|
||||
public String getApiNamePrefix() {
|
||||
return apiNamePrefix;
|
||||
}
|
||||
|
||||
public void setApiNamePrefix(String apiNamePrefix) {
|
||||
this.apiNamePrefix = apiNamePrefix;
|
||||
}
|
||||
|
||||
public void setApiPackage(String apiPackage) {
|
||||
this.apiPackage = apiPackage;
|
||||
}
|
||||
|
||||
public Boolean getSortParamsByRequiredFlag() {
|
||||
return sortParamsByRequiredFlag;
|
||||
}
|
||||
|
||||
public void setSortParamsByRequiredFlag(Boolean sortParamsByRequiredFlag) {
|
||||
this.sortParamsByRequiredFlag = sortParamsByRequiredFlag;
|
||||
}
|
||||
|
||||
public Boolean getSortModelPropertiesByRequiredFlag() {
|
||||
return sortModelPropertiesByRequiredFlag;
|
||||
}
|
||||
|
||||
public void setSortModelPropertiesByRequiredFlag(Boolean sortModelPropertiesByRequiredFlag) {
|
||||
this.sortModelPropertiesByRequiredFlag = sortModelPropertiesByRequiredFlag;
|
||||
}
|
||||
|
||||
public Boolean getPrependFormOrBodyParameters() {
|
||||
return prependFormOrBodyParameters;
|
||||
}
|
||||
|
||||
public void setPrependFormOrBodyParameters(Boolean prependFormOrBodyParameters) {
|
||||
this.prependFormOrBodyParameters = prependFormOrBodyParameters;
|
||||
}
|
||||
|
||||
public Boolean getEnsureUniqueParams() {
|
||||
return ensureUniqueParams;
|
||||
}
|
||||
|
||||
public void setEnsureUniqueParams(Boolean ensureUniqueParams) {
|
||||
this.ensureUniqueParams = ensureUniqueParams;
|
||||
}
|
||||
|
||||
public Boolean getLegacyDiscriminatorBehavior() {
|
||||
return legacyDiscriminatorBehavior;
|
||||
}
|
||||
|
||||
public void setLegacyDiscriminatorBehavior(boolean val) {
|
||||
this.legacyDiscriminatorBehavior = val;
|
||||
}
|
||||
|
||||
public Boolean getDisallowAdditionalPropertiesIfNotPresent() {
|
||||
return disallowAdditionalPropertiesIfNotPresent;
|
||||
}
|
||||
|
||||
public void setDisallowAdditionalPropertiesIfNotPresent(boolean val) {
|
||||
this.disallowAdditionalPropertiesIfNotPresent = val;
|
||||
}
|
||||
|
||||
public Boolean getEnumUnknownDefaultCase() {
|
||||
return enumUnknownDefaultCase;
|
||||
}
|
||||
|
||||
public void setEnumUnknownDefaultCase(boolean val) {
|
||||
this.enumUnknownDefaultCase = val;
|
||||
}
|
||||
|
||||
public Boolean getAllowUnicodeIdentifiers() {
|
||||
return allowUnicodeIdentifiers;
|
||||
}
|
||||
|
||||
public void setAllowUnicodeIdentifiers(Boolean allowUnicodeIdentifiers) {
|
||||
this.allowUnicodeIdentifiers = allowUnicodeIdentifiers;
|
||||
}
|
||||
|
||||
public Boolean getUseOneOfInterfaces() {
|
||||
return useOneOfInterfaces;
|
||||
}
|
||||
@ -6277,22 +6186,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
this.removeOperationIdPrefix = removeOperationIdPrefix;
|
||||
}
|
||||
|
||||
public String getRemoveOperationIdPrefixDelimiter() {
|
||||
return removeOperationIdPrefixDelimiter;
|
||||
}
|
||||
|
||||
public void setRemoveOperationIdPrefixDelimiter(String removeOperationIdPrefixDelimiter) {
|
||||
this.removeOperationIdPrefixDelimiter = removeOperationIdPrefixDelimiter;
|
||||
}
|
||||
|
||||
public int getRemoveOperationIdPrefixCount() {
|
||||
return removeOperationIdPrefixCount;
|
||||
}
|
||||
|
||||
public void setRemoveOperationIdPrefixCount(int removeOperationIdPrefixCount) {
|
||||
this.removeOperationIdPrefixCount = removeOperationIdPrefixCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkipOperationExample(boolean skipOperationExample) {
|
||||
this.skipOperationExample = skipOperationExample;
|
||||
@ -8302,7 +8195,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
/**
|
||||
* An map entry for cached sanitized names.
|
||||
*/
|
||||
private static class SanitizeNameOptions {
|
||||
@Getter private static class SanitizeNameOptions {
|
||||
public SanitizeNameOptions(String name, String removeCharRegEx, List<String> exceptions) {
|
||||
this.name = name;
|
||||
this.removeCharRegEx = removeCharRegEx;
|
||||
@ -8313,18 +8206,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRemoveCharRegEx() {
|
||||
return removeCharRegEx;
|
||||
}
|
||||
|
||||
public List<String> getExceptions() {
|
||||
return exceptions;
|
||||
}
|
||||
|
||||
private final String name;
|
||||
private final String removeCharRegEx;
|
||||
private final List<String> exceptions;
|
||||
@ -8533,10 +8414,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public void setAutosetConstants(boolean autosetConstants) {
|
||||
this.autosetConstants = autosetConstants;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method removes all constant Query, Header and Cookie Params from allParams and sets them as constantParams in the CodegenOperation.
|
||||
* The definition of constant is single valued required enum params.
|
||||
|
@ -29,7 +29,7 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.security.*;
|
||||
import io.swagger.v3.oas.models.tags.Tag;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.comparator.PathFileComparator;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -95,7 +95,15 @@ public class DefaultGenerator implements Generator {
|
||||
private String basePathWithoutHost;
|
||||
private String contextPath;
|
||||
private Map<String, String> generatorPropertyDefaults = new HashMap<>();
|
||||
protected TemplateProcessor templateProcessor = null;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Retrieves an instance to the configured template processor, available after user-defined options are
|
||||
* applied via
|
||||
* .
|
||||
*
|
||||
* @return A configured {@link TemplateProcessor}, or null.
|
||||
*/
|
||||
@Getter protected TemplateProcessor templateProcessor = null;
|
||||
|
||||
private List<TemplateDefinition> userDefinedTemplates = new ArrayList<>();
|
||||
private String generatorCheck = "spring";
|
||||
@ -160,16 +168,6 @@ public class DefaultGenerator implements Generator {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an instance to the configured template processor, available after user-defined options are
|
||||
* applied via {@link DefaultGenerator#opts(ClientOptInput)}.
|
||||
*
|
||||
* @return A configured {@link TemplateProcessor}, or null.
|
||||
*/
|
||||
public TemplateProcessor getTemplateProcessor() {
|
||||
return templateProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmatically disable the output of .openapi-generator/VERSION, .openapi-generator-ignore,
|
||||
* or other metadata files used by OpenAPI Generator.
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
@ -7,9 +9,28 @@ import java.util.Locale;
|
||||
/**
|
||||
* Holds details about a file's write status for display via the --dry-run option of CLI
|
||||
*/
|
||||
class DryRunStatus {
|
||||
@Getter class DryRunStatus {
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Gets the target path of the file write operation
|
||||
*
|
||||
* @return a {@link Path} instance
|
||||
*/
|
||||
private Path path;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Gets the
|
||||
* as determined by the generator's workflow
|
||||
*
|
||||
* @return A {@link State} enum detailing the expected operation of the generator's workflow
|
||||
*/
|
||||
private State state;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Gets the reason for the file's
|
||||
*
|
||||
* @return A human-readable string which explains why this file's dry-run resulted in the defined {@link State}
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
@ -55,33 +76,6 @@ class DryRunStatus {
|
||||
appendable.append(String.format(Locale.ROOT, "%s %s", this.state.getShortDisplay(), this.path.toAbsolutePath()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the target path of the file write operation
|
||||
*
|
||||
* @return a {@link Path} instance
|
||||
*/
|
||||
public Path getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason for the file's {@link State}
|
||||
*
|
||||
* @return A human-readable string which explains why this file's dry-run resulted in the defined {@link State}
|
||||
*/
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link State} as determined by the generator's workflow
|
||||
*
|
||||
* @return A {@link State} enum detailing the expected operation of the generator's workflow
|
||||
*/
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link State} as determined by the generator's workflow.
|
||||
* <p>
|
||||
@ -116,7 +110,7 @@ class DryRunStatus {
|
||||
/**
|
||||
* Represents the possible states of a file write operation as determined by the Generator
|
||||
*/
|
||||
enum State {
|
||||
@Getter enum State {
|
||||
Write("w", "Write"),
|
||||
WriteIfNewer("n", "Write if New/Updated"),
|
||||
Ignored("i", "Ignored"),
|
||||
@ -124,7 +118,19 @@ class DryRunStatus {
|
||||
Skipped("k", "Skipped by user option(s)"),
|
||||
Error("e", "Error evaluating file write state");
|
||||
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Gets the short value used for display
|
||||
*
|
||||
* @return A character representing this state
|
||||
*/
|
||||
private final String shortDisplay;
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Gets a description of the state which is more human-readable than the enum's name
|
||||
*
|
||||
* @return A human-readable description
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
@ -139,22 +145,5 @@ class DryRunStatus {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a description of the state which is more human-readable than the enum's name
|
||||
*
|
||||
* @return A human-readable description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the short value used for display
|
||||
*
|
||||
* @return A character representing this state
|
||||
*/
|
||||
public String getShortDisplay() {
|
||||
return shortDisplay;
|
||||
}
|
||||
}
|
||||
}
|
@ -119,7 +119,7 @@ public interface IJsonSchemaValidationProperties {
|
||||
|
||||
boolean getIsArray();
|
||||
|
||||
void setIsArray(boolean isShort);
|
||||
void setIsArray(boolean isArray);
|
||||
|
||||
boolean getIsShort();
|
||||
|
||||
@ -192,7 +192,7 @@ public interface IJsonSchemaValidationProperties {
|
||||
|
||||
boolean getIsString();
|
||||
|
||||
void setIsString(boolean isNumber);
|
||||
void setIsString(boolean isString);
|
||||
|
||||
boolean getIsNumber();
|
||||
|
||||
@ -248,7 +248,7 @@ public interface IJsonSchemaValidationProperties {
|
||||
|
||||
boolean getIsDouble();
|
||||
|
||||
void setIsInteger(boolean isDouble);
|
||||
void setIsInteger(boolean isInteger);
|
||||
|
||||
boolean getIsInteger();
|
||||
|
||||
@ -290,7 +290,6 @@ public interface IJsonSchemaValidationProperties {
|
||||
setIsArray(true);
|
||||
} else if (ModelUtils.isFileSchema(p) && !ModelUtils.isStringSchema(p)) {
|
||||
// swagger v2 only, type file
|
||||
;
|
||||
} else if (ModelUtils.isStringSchema(p)) {
|
||||
setIsString(true);
|
||||
if (ModelUtils.isByteArraySchema(p)) {
|
||||
|
@ -1,8 +1,12 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter @Setter
|
||||
public class SpecValidationException extends RuntimeException {
|
||||
|
||||
private Set<String> errors;
|
||||
@ -81,22 +85,6 @@ public class SpecValidationException extends RuntimeException {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public Set<String> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
public Set<String> getWarnings() {
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void setErrors(Set<String> errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public void setWarnings(Set<String> warnings) {
|
||||
this.warnings = warnings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the detail message string of this throwable.
|
||||
*
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.openapitools.codegen.api.TemplateDefinition;
|
||||
import org.openapitools.codegen.api.TemplateFileType;
|
||||
|
||||
@ -30,7 +31,7 @@ import java.util.StringJoiner;
|
||||
* Supporting files are generated once for an entire application while api/model bound definitions are generated multiple
|
||||
* times according to their target use.
|
||||
*/
|
||||
public class SupportingFile extends TemplateDefinition {
|
||||
@Getter public class SupportingFile extends TemplateDefinition {
|
||||
private boolean canOverwrite = true;
|
||||
|
||||
public SupportingFile(String templateFile, String destinationFilename) {
|
||||
@ -80,10 +81,6 @@ public class SupportingFile extends TemplateDefinition {
|
||||
return isCanOverwrite() == that.isCanOverwrite();
|
||||
}
|
||||
|
||||
public boolean isCanOverwrite() {
|
||||
return canOverwrite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), isCanOverwrite());
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public enum VendorExtension {
|
||||
@Getter public enum VendorExtension {
|
||||
|
||||
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"),
|
||||
@ -38,22 +40,6 @@ public enum VendorExtension {
|
||||
this(name, Collections.singletonList(level), description, defaultValue);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<ExtensionLevel> getLevels() {
|
||||
return levels;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public enum ExtensionLevel {
|
||||
FIELD,
|
||||
MODEL,
|
||||
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.api.TemplateDefinition;
|
||||
import org.openapitools.codegen.api.TemplateFileType;
|
||||
@ -20,7 +21,13 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public class DynamicSettings {
|
||||
@JsonAnySetter
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Gets all "custom" properties included in the config object.
|
||||
*
|
||||
* @return All user-specified custom properties.
|
||||
*/
|
||||
@Getter @JsonAnySetter
|
||||
private Map<String, Object> dynamicProperties = new HashMap<>();
|
||||
|
||||
@JsonUnwrapped
|
||||
@ -91,15 +98,6 @@ public class DynamicSettings {
|
||||
@JsonCreator
|
||||
public DynamicSettings() { }
|
||||
|
||||
/**
|
||||
* Gets all "custom" properties included in the config object.
|
||||
*
|
||||
* @return All user-specified custom properties.
|
||||
*/
|
||||
public Map<String, Object> getDynamicProperties() {
|
||||
return dynamicProperties;
|
||||
}
|
||||
|
||||
private void excludeSettingsFromDynamicProperties(){
|
||||
Set<String> fieldNames = new HashSet<>();
|
||||
for (Field field : GeneratorSettings.class.getDeclaredFields()) {
|
||||
|
@ -45,7 +45,7 @@ public class GlobalSettings {
|
||||
Properties copy = new Properties();
|
||||
copy.putAll(System.getProperties());
|
||||
return copy;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
public static String getProperty(String key, String defaultValue) {
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.examples;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.XML;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -17,11 +17,13 @@
|
||||
|
||||
package org.openapitools.codegen.ignore.rules;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class IgnoreLineParser {
|
||||
enum Token {
|
||||
@Getter enum Token {
|
||||
MATCH_ALL("**"),
|
||||
MATCH_ANY("*"),
|
||||
ESCAPED_EXCLAMATION("\\!"),
|
||||
@ -39,9 +41,6 @@ public class IgnoreLineParser {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Comments that start with a : (e.g. //:) are pulled from git documentation for .gitignore
|
||||
|
@ -17,9 +17,11 @@
|
||||
|
||||
package org.openapitools.codegen.ignore.rules;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InvalidRule extends Rule {
|
||||
@Getter public class InvalidRule extends Rule {
|
||||
private final String reason;
|
||||
|
||||
InvalidRule(List<Part> syntax, String definition, String reason) {
|
||||
@ -37,7 +39,4 @@ public class InvalidRule extends Rule {
|
||||
return Operation.NOOP;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen.ignore.rules;
|
||||
|
||||
class Part {
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter class Part {
|
||||
private final IgnoreLineParser.Token token;
|
||||
private final String value;
|
||||
|
||||
@ -31,11 +33,4 @@ class Part {
|
||||
this.value = token.getPattern();
|
||||
}
|
||||
|
||||
public IgnoreLineParser.Token getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@
|
||||
|
||||
package org.openapitools.codegen.ignore.rules;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Rule {
|
||||
@ -24,7 +26,7 @@ public abstract class Rule {
|
||||
public enum Operation {EXCLUDE, INCLUDE, NOOP, EXCLUDE_AND_TERMINATE}
|
||||
|
||||
// The original rule
|
||||
private final String definition;
|
||||
@Getter private final String definition;
|
||||
|
||||
private final List<Part> syntax;
|
||||
|
||||
@ -35,10 +37,6 @@ public abstract class Rule {
|
||||
|
||||
public abstract Boolean matches(String relativePath);
|
||||
|
||||
public String getDefinition() {
|
||||
return this.definition;
|
||||
}
|
||||
|
||||
protected String getPattern() {
|
||||
if(syntax == null) return this.definition;
|
||||
|
||||
|
@ -20,7 +20,6 @@ package org.openapitools.codegen.languages;
|
||||
import com.samskivert.mustache.Escapers;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
@ -885,6 +884,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ModelDepend second) {
|
||||
|
||||
if (depend != null && depend.contains(second.name)) {
|
||||
|
@ -19,11 +19,11 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.MapSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.model.ModelsMap;
|
||||
@ -39,7 +39,7 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractApexCodegen.class);
|
||||
|
||||
protected Boolean serializableModel = false;
|
||||
@Setter protected Boolean serializableModel = false;
|
||||
|
||||
public AbstractApexCodegen() {
|
||||
super();
|
||||
@ -208,14 +208,6 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlias(String name) {
|
||||
if (typeAliases != null && typeAliases.containsKey(name)) {
|
||||
return typeAliases.get(name);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
@ -634,10 +626,6 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
|
||||
public void setSerializableModel(Boolean serializableModel) {
|
||||
this.serializableModel = serializableModel;
|
||||
}
|
||||
|
||||
private String sanitizePath(String p) {
|
||||
//prefer replace a ", instead of a fuLL URL encode for readability
|
||||
return p.replaceAll("\"", "%22");
|
||||
|
@ -23,6 +23,8 @@ import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -52,53 +54,55 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
protected boolean optionalEmitDefaultValuesFlag = false;
|
||||
protected boolean conditionalSerialization = false;
|
||||
protected boolean optionalProjectFileFlag = true;
|
||||
protected boolean optionalMethodArgumentFlag = true;
|
||||
@Setter protected boolean optionalMethodArgumentFlag = true;
|
||||
protected boolean useDateTimeOffsetFlag = false;
|
||||
protected boolean useDateTimeForDateFlag = false;
|
||||
protected boolean useCollection = false;
|
||||
protected boolean returnICollection = false;
|
||||
protected boolean netCoreProjectFileFlag = false;
|
||||
@Setter protected boolean returnICollection = false;
|
||||
@Setter protected boolean netCoreProjectFileFlag = false;
|
||||
protected boolean nullReferenceTypesFlag = false;
|
||||
protected boolean useSourceGeneration = false;
|
||||
|
||||
protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();
|
||||
|
||||
protected String licenseUrl = "http://localhost";
|
||||
protected String licenseName = "NoLicense";
|
||||
@Setter protected String licenseUrl = "http://localhost";
|
||||
@Setter protected String licenseName = "NoLicense";
|
||||
|
||||
protected String packageVersion = "1.0.0";
|
||||
protected String packageName = "Org.OpenAPITools";
|
||||
protected String packageTitle = "OpenAPI Library";
|
||||
protected String packageProductName = "OpenAPILibrary";
|
||||
protected String packageDescription = "A library generated from a OpenAPI doc";
|
||||
protected String packageCompany = "OpenAPI";
|
||||
protected String packageCopyright = "No Copyright";
|
||||
protected String packageAuthors = "OpenAPI";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageName = "Org.OpenAPITools";
|
||||
@Setter protected String packageTitle = "OpenAPI Library";
|
||||
@Setter protected String packageProductName = "OpenAPILibrary";
|
||||
@Setter protected String packageDescription = "A library generated from a OpenAPI doc";
|
||||
@Setter protected String packageCompany = "OpenAPI";
|
||||
@Setter protected String packageCopyright = "No Copyright";
|
||||
@Setter protected String packageAuthors = "OpenAPI";
|
||||
public static final String DATE_FORMAT = "dateFormat";
|
||||
protected String dateFormat = "yyyy'-'MM'-'dd";
|
||||
@Setter protected String dateFormat = "yyyy'-'MM'-'dd";
|
||||
public static final String DATETIME_FORMAT = "dateTimeFormat";
|
||||
protected String dateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK";
|
||||
@Setter protected String dateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK";
|
||||
|
||||
@Getter @Setter
|
||||
protected String interfacePrefix = "I";
|
||||
protected String enumNameSuffix = "Enum";
|
||||
protected String enumValueSuffix = "Enum";
|
||||
@Setter protected String enumNameSuffix = "Enum";
|
||||
@Setter protected String enumValueSuffix = "Enum";
|
||||
|
||||
protected String sourceFolder = "src";
|
||||
@Setter protected String sourceFolder = "src";
|
||||
protected static final String invalidParameterNamePrefix = "var";
|
||||
protected static final String invalidPropertyNamePrefix = "Var";
|
||||
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.PascalCase;
|
||||
@Getter protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.PascalCase;
|
||||
|
||||
// TODO: Add option for test folder output location. Nice to allow e.g. ./test instead of ./src.
|
||||
// This would require updating relative paths (e.g. path to main project file in test project file)
|
||||
protected String testFolder = sourceFolder;
|
||||
@Setter protected String testFolder = sourceFolder;
|
||||
|
||||
protected Set<String> collectionTypes;
|
||||
protected Set<String> mapTypes;
|
||||
|
||||
// true if support nullable type
|
||||
@Getter @Setter
|
||||
protected boolean supportNullable = Boolean.FALSE;
|
||||
|
||||
protected Boolean zeroBasedEnums = null;
|
||||
@Setter protected Boolean zeroBasedEnums = null;
|
||||
protected static final String zeroBasedEnumVendorExtension = "x-zero-based-enum";
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCSharpCodegen.class);
|
||||
@ -211,10 +215,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
// this.setSortModelPropertiesByRequiredFlag(true);
|
||||
}
|
||||
|
||||
public void setReturnICollection(boolean returnICollection) {
|
||||
this.returnICollection = returnICollection;
|
||||
}
|
||||
|
||||
public void setUseCollection(boolean useCollection) {
|
||||
this.useCollection = useCollection;
|
||||
if (useCollection) {
|
||||
@ -224,14 +224,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
this.setTypeMapping();
|
||||
}
|
||||
|
||||
public void setOptionalMethodArgumentFlag(boolean flag) {
|
||||
this.optionalMethodArgumentFlag = flag;
|
||||
}
|
||||
|
||||
public void setNetCoreProjectFileFlag(boolean flag) {
|
||||
this.netCoreProjectFileFlag = flag;
|
||||
}
|
||||
|
||||
public void useDateTimeOffset(boolean flag) {
|
||||
this.useDateTimeOffsetFlag = flag;
|
||||
this.setTypeMapping();
|
||||
@ -1541,70 +1533,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
return toModelName(name) + "Tests";
|
||||
}
|
||||
|
||||
public void setLicenseUrl(String licenseUrl) {
|
||||
this.licenseUrl = licenseUrl;
|
||||
}
|
||||
|
||||
public void setLicenseName(String licenseName) {
|
||||
this.licenseName = licenseName;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
public void setPackageTitle(String packageTitle) {
|
||||
this.packageTitle = packageTitle;
|
||||
}
|
||||
|
||||
public void setPackageProductName(String packageProductName) {
|
||||
this.packageProductName = packageProductName;
|
||||
}
|
||||
|
||||
public void setDateFormat(String dateFormat) {
|
||||
this.dateFormat = dateFormat;
|
||||
}
|
||||
|
||||
public void setDateTimeFormat(String dateTimeFormat) {
|
||||
this.dateTimeFormat = dateTimeFormat;
|
||||
}
|
||||
|
||||
public void setPackageDescription(String packageDescription) {
|
||||
this.packageDescription = packageDescription;
|
||||
}
|
||||
|
||||
public void setPackageCompany(String packageCompany) {
|
||||
this.packageCompany = packageCompany;
|
||||
}
|
||||
|
||||
public void setPackageCopyright(String packageCopyright) {
|
||||
this.packageCopyright = packageCopyright;
|
||||
}
|
||||
|
||||
public void setPackageAuthors(String packageAuthors) {
|
||||
this.packageAuthors = packageAuthors;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public void setTestFolder(String testFolder) {
|
||||
this.testFolder = testFolder;
|
||||
}
|
||||
|
||||
public String getInterfacePrefix() {
|
||||
return interfacePrefix;
|
||||
}
|
||||
|
||||
public void setZeroBasedEnums(final Boolean zeroBasedEnums) {
|
||||
this.zeroBasedEnums = zeroBasedEnums;
|
||||
}
|
||||
|
||||
public void setNullableReferenceTypes(final Boolean nullReferenceTypesFlag) {
|
||||
this.nullReferenceTypesFlag = nullReferenceTypesFlag;
|
||||
additionalProperties.put("nullableReferenceTypes", nullReferenceTypesFlag);
|
||||
@ -1631,30 +1559,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
return this.useSourceGeneration;
|
||||
}
|
||||
|
||||
public void setInterfacePrefix(final String interfacePrefix) {
|
||||
this.interfacePrefix = interfacePrefix;
|
||||
}
|
||||
|
||||
public void setEnumNameSuffix(final String enumNameSuffix) {
|
||||
this.enumNameSuffix = enumNameSuffix;
|
||||
}
|
||||
|
||||
public void setEnumValueSuffix(final String enumValueSuffix) {
|
||||
this.enumValueSuffix = enumValueSuffix;
|
||||
}
|
||||
|
||||
public boolean isSupportNullable() {
|
||||
return supportNullable;
|
||||
}
|
||||
|
||||
public void setSupportNullable(final boolean supportNullable) {
|
||||
this.supportNullable = supportNullable;
|
||||
}
|
||||
|
||||
public CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming() {
|
||||
return this.enumPropertyNaming;
|
||||
}
|
||||
|
||||
public void setEnumPropertyNaming(final String enumPropertyNamingType) {
|
||||
try {
|
||||
this.enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.valueOf(enumPropertyNamingType);
|
||||
|
@ -44,7 +44,6 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class);
|
||||
|
@ -2,11 +2,11 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -48,17 +48,17 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
public static final String PUB_PUBLISH_TO = "pubPublishTo";
|
||||
public static final String USE_ENUM_EXTENSION = "useEnumExtension";
|
||||
|
||||
protected String pubLibrary = "openapi.api";
|
||||
protected String pubName = "openapi";
|
||||
protected String pubVersion = "1.0.0";
|
||||
protected String pubDescription = "OpenAPI API client";
|
||||
protected String pubAuthor = "Author";
|
||||
protected String pubAuthorEmail = "author@homepage";
|
||||
protected String pubHomepage = "homepage";
|
||||
protected String pubRepository = null;
|
||||
protected String pubPublishTo = null;
|
||||
protected boolean useEnumExtension = false;
|
||||
protected String sourceFolder = "src";
|
||||
@Setter protected String pubLibrary = "openapi.api";
|
||||
@Setter protected String pubName = "openapi";
|
||||
@Setter protected String pubVersion = "1.0.0";
|
||||
@Setter protected String pubDescription = "OpenAPI API client";
|
||||
@Setter protected String pubAuthor = "Author";
|
||||
@Setter protected String pubAuthorEmail = "author@homepage";
|
||||
@Setter protected String pubHomepage = "homepage";
|
||||
@Setter protected String pubRepository = null;
|
||||
@Setter protected String pubPublishTo = null;
|
||||
@Setter protected boolean useEnumExtension = false;
|
||||
@Setter protected String sourceFolder = "src";
|
||||
protected String libPath = "lib" + File.separator;
|
||||
protected String apiDocPath = "doc/";
|
||||
protected String modelDocPath = "doc/";
|
||||
@ -764,50 +764,6 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
return operationId;
|
||||
}
|
||||
|
||||
public void setPubLibrary(String pubLibrary) {
|
||||
this.pubLibrary = pubLibrary;
|
||||
}
|
||||
|
||||
public void setPubName(String pubName) {
|
||||
this.pubName = pubName;
|
||||
}
|
||||
|
||||
public void setPubVersion(String pubVersion) {
|
||||
this.pubVersion = pubVersion;
|
||||
}
|
||||
|
||||
public void setPubDescription(String pubDescription) {
|
||||
this.pubDescription = pubDescription;
|
||||
}
|
||||
|
||||
public void setPubAuthor(String pubAuthor) {
|
||||
this.pubAuthor = pubAuthor;
|
||||
}
|
||||
|
||||
public void setPubAuthorEmail(String pubAuthorEmail) {
|
||||
this.pubAuthorEmail = pubAuthorEmail;
|
||||
}
|
||||
|
||||
public void setPubHomepage(String pubHomepage) {
|
||||
this.pubHomepage = pubHomepage;
|
||||
}
|
||||
|
||||
public void setPubRepository(String pubRepository) {
|
||||
this.pubRepository = pubRepository;
|
||||
}
|
||||
|
||||
public void setPubPublishTo(String pubPublishTo) {
|
||||
this.pubPublishTo = pubPublishTo;
|
||||
}
|
||||
|
||||
public void setUseEnumExtension(boolean useEnumExtension) {
|
||||
this.useEnumExtension = useEnumExtension;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
|
@ -20,7 +20,6 @@ package org.openapitools.codegen.languages;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -20,8 +20,9 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache.Lambda;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -49,33 +50,35 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
protected boolean useDateTimeOffsetFlag = false;
|
||||
protected boolean useCollection = false;
|
||||
protected boolean returnICollection = false;
|
||||
protected boolean netCoreProjectFileFlag = false;
|
||||
@Setter protected boolean returnICollection = false;
|
||||
@Setter protected boolean netCoreProjectFileFlag = false;
|
||||
|
||||
protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();
|
||||
@Getter protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();
|
||||
|
||||
protected String licenseUrl = "http://localhost";
|
||||
protected String licenseName = "NoLicense";
|
||||
@Setter protected String licenseUrl = "http://localhost";
|
||||
@Setter protected String licenseName = "NoLicense";
|
||||
|
||||
protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String packageName = "OpenAPI";
|
||||
protected String packageTitle = "OpenAPI Library";
|
||||
protected String packageProductName = "OpenAPILibrary";
|
||||
protected String packageDescription = "A library generated from a OpenAPI doc";
|
||||
protected String packageCompany = "OpenAPI";
|
||||
protected String packageCopyright = "No Copyright";
|
||||
protected String packageAuthors = "OpenAPI";
|
||||
@Setter protected String packageTitle = "OpenAPI Library";
|
||||
@Setter protected String packageProductName = "OpenAPILibrary";
|
||||
@Setter protected String packageDescription = "A library generated from a OpenAPI doc";
|
||||
@Setter protected String packageCompany = "OpenAPI";
|
||||
@Setter protected String packageCopyright = "No Copyright";
|
||||
@Setter protected String packageAuthors = "OpenAPI";
|
||||
|
||||
@Getter @Setter
|
||||
protected String interfacePrefix = "I";
|
||||
|
||||
protected String projectFolder = packageName;
|
||||
protected String sourceFolder = projectFolder + File.separator + "src";
|
||||
@Setter protected String sourceFolder = projectFolder + File.separator + "src";
|
||||
protected String testFolder = projectFolder + ".Tests";
|
||||
|
||||
protected Set<String> collectionTypes;
|
||||
protected Set<String> mapTypes;
|
||||
|
||||
// true if nullable types will be supported (as option)
|
||||
@Getter @Setter
|
||||
protected boolean supportNullable = Boolean.TRUE;
|
||||
|
||||
protected Set<String> nullableType = new HashSet<>();
|
||||
@ -187,10 +190,6 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
);
|
||||
}
|
||||
|
||||
public void setReturnICollection(boolean returnICollection) {
|
||||
this.returnICollection = returnICollection;
|
||||
}
|
||||
|
||||
public void setUseCollection(boolean useCollection) {
|
||||
this.useCollection = useCollection;
|
||||
if (useCollection) {
|
||||
@ -202,10 +201,6 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
|
||||
public void setNetCoreProjectFileFlag(boolean flag) {
|
||||
this.netCoreProjectFileFlag = flag;
|
||||
}
|
||||
|
||||
public void useDateTimeOffset(boolean flag) {
|
||||
this.useDateTimeOffsetFlag = flag;
|
||||
if (flag) {
|
||||
@ -641,10 +636,6 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
return camelize(sanitizeName(operationId));
|
||||
}
|
||||
|
||||
public String getModelPropertyNaming() {
|
||||
return this.modelPropertyNaming;
|
||||
}
|
||||
|
||||
public void setModelPropertyNaming(String naming) {
|
||||
if ("original".equals(naming) || "camelCase".equals(naming) ||
|
||||
"PascalCase".equals(naming) || "snake_case".equals(naming)) {
|
||||
@ -936,14 +927,6 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
return toModelName(name) + "Tests";
|
||||
}
|
||||
|
||||
public void setLicenseUrl(String licenseUrl) {
|
||||
this.licenseUrl = licenseUrl;
|
||||
}
|
||||
|
||||
public void setLicenseName(String licenseName) {
|
||||
this.licenseName = licenseName;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
this.projectFolder = packageName;
|
||||
@ -951,54 +934,6 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
this.testFolder = projectFolder + ".Tests";
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
public void setPackageTitle(String packageTitle) {
|
||||
this.packageTitle = packageTitle;
|
||||
}
|
||||
|
||||
public void setPackageProductName(String packageProductName) {
|
||||
this.packageProductName = packageProductName;
|
||||
}
|
||||
|
||||
public void setPackageDescription(String packageDescription) {
|
||||
this.packageDescription = packageDescription;
|
||||
}
|
||||
|
||||
public void setPackageCompany(String packageCompany) {
|
||||
this.packageCompany = packageCompany;
|
||||
}
|
||||
|
||||
public void setPackageCopyright(String packageCopyright) {
|
||||
this.packageCopyright = packageCopyright;
|
||||
}
|
||||
|
||||
public void setPackageAuthors(String packageAuthors) {
|
||||
this.packageAuthors = packageAuthors;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public String getInterfacePrefix() {
|
||||
return interfacePrefix;
|
||||
}
|
||||
|
||||
public void setInterfacePrefix(final String interfacePrefix) {
|
||||
this.interfacePrefix = interfacePrefix;
|
||||
}
|
||||
|
||||
public boolean isSupportNullable() {
|
||||
return supportNullable;
|
||||
}
|
||||
|
||||
public void setSupportNullable(final boolean supportNullable) {
|
||||
this.supportNullable = supportNullable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
// C# only supports enums as literals for int, int?, long, long?, byte, and byte?. All else must be treated as strings.
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -40,18 +40,17 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractGoCodegen.class);
|
||||
private static final String NUMERIC_ENUM_PREFIX = "_";
|
||||
|
||||
protected boolean withGoCodegenComment = false;
|
||||
protected boolean withAWSV4Signature = false;
|
||||
protected boolean withXml = false;
|
||||
protected boolean enumClassPrefix = false;
|
||||
protected boolean structPrefix = false;
|
||||
protected boolean generateInterfaces = false;
|
||||
protected boolean withGoMod = false;
|
||||
protected boolean generateMarshalJSON = true;
|
||||
protected boolean generateUnmarshalJSON = true;
|
||||
@Setter protected boolean withGoCodegenComment = false;
|
||||
@Setter protected boolean withAWSV4Signature = false;
|
||||
@Setter protected boolean withXml = false;
|
||||
@Setter protected boolean enumClassPrefix = false;
|
||||
@Setter protected boolean structPrefix = false;
|
||||
@Setter protected boolean generateInterfaces = false;
|
||||
@Setter protected boolean withGoMod = false;
|
||||
@Setter protected boolean generateMarshalJSON = true;
|
||||
@Setter protected boolean generateUnmarshalJSON = true;
|
||||
|
||||
|
||||
protected String packageName = "openapi";
|
||||
@Setter protected String packageName = "openapi";
|
||||
protected Set<String> numberTypes;
|
||||
|
||||
public AbstractGoCodegen() {
|
||||
@ -814,10 +813,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
return !defaultIncludes.contains(type) && !languageSpecificPrimitives.contains(type);
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
@ -906,42 +901,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
}
|
||||
}
|
||||
|
||||
public void setWithGoCodegenComment(boolean withGoCodegenComment) {
|
||||
this.withGoCodegenComment = withGoCodegenComment;
|
||||
}
|
||||
|
||||
public void setWithAWSV4Signature(boolean withAWSV4Signature) {
|
||||
this.withAWSV4Signature = withAWSV4Signature;
|
||||
}
|
||||
|
||||
public void setWithXml(boolean withXml) {
|
||||
this.withXml = withXml;
|
||||
}
|
||||
|
||||
public void setEnumClassPrefix(boolean enumClassPrefix) {
|
||||
this.enumClassPrefix = enumClassPrefix;
|
||||
}
|
||||
|
||||
public void setStructPrefix(boolean structPrefix) {
|
||||
this.structPrefix = structPrefix;
|
||||
}
|
||||
|
||||
public void setGenerateInterfaces(boolean generateInterfaces) {
|
||||
this.generateInterfaces = generateInterfaces;
|
||||
}
|
||||
|
||||
public void setWithGoMod(boolean withGoMod) {
|
||||
this.withGoMod = withGoMod;
|
||||
}
|
||||
|
||||
public void setGenerateMarshalJSON(boolean generateMarshalJSON) {
|
||||
this.generateMarshalJSON = generateMarshalJSON;
|
||||
}
|
||||
|
||||
public void setGenerateUnmarshalJSON(boolean generateUnmarshalJSON) {
|
||||
this.generateUnmarshalJSON = generateUnmarshalJSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema schema) {
|
||||
schema = unaliasSchema(schema);
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -39,8 +39,8 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractGraphQLCodegen.class);
|
||||
|
||||
protected String specFolder = "spec";
|
||||
protected String packageName = "openapi2graphql";
|
||||
protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageName = "openapi2graphql";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
@ -116,14 +116,6 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
// Can't start with an underscore, as our fields need to start with an
|
||||
|
@ -31,6 +31,8 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -96,55 +98,87 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi";
|
||||
public static final String GENERATE_CONSTRUCTOR_WITH_ALL_ARGS = "generateConstructorWithAllArgs";
|
||||
public static final String GENERATE_BUILDERS = "generateBuilders";
|
||||
|
||||
@Getter @Setter
|
||||
protected String dateLibrary = "java8";
|
||||
protected boolean supportAsync = false;
|
||||
protected boolean withXml = false;
|
||||
@Setter protected boolean supportAsync = false;
|
||||
@Setter protected boolean withXml = false;
|
||||
@Getter @Setter
|
||||
protected String invokerPackage = "org.openapitools";
|
||||
@Getter @Setter
|
||||
protected String groupId = "org.openapitools";
|
||||
@Getter @Setter
|
||||
protected String artifactId = "openapi-java";
|
||||
@Getter @Setter
|
||||
protected String artifactVersion = null;
|
||||
@Getter @Setter
|
||||
protected String artifactUrl = "https://github.com/openapitools/openapi-generator";
|
||||
@Getter @Setter
|
||||
protected String artifactDescription = "OpenAPI Java";
|
||||
@Getter @Setter
|
||||
protected String developerName = "OpenAPI-Generator Contributors";
|
||||
@Getter @Setter
|
||||
protected String developerEmail = "team@openapitools.org";
|
||||
@Getter @Setter
|
||||
protected String developerOrganization = "OpenAPITools.org";
|
||||
@Getter @Setter
|
||||
protected String developerOrganizationUrl = "http://openapitools.org";
|
||||
@Getter @Setter
|
||||
protected String scmConnection = "scm:git:git@github.com:openapitools/openapi-generator.git";
|
||||
@Getter @Setter
|
||||
protected String scmDeveloperConnection = "scm:git:git@github.com:openapitools/openapi-generator.git";
|
||||
@Getter @Setter
|
||||
protected String scmUrl = "https://github.com/openapitools/openapi-generator";
|
||||
@Getter @Setter
|
||||
protected String licenseName = "Unlicense";
|
||||
@Getter @Setter
|
||||
protected String licenseUrl = "http://unlicense.org";
|
||||
protected String projectFolder = "src/main";
|
||||
protected String projectTestFolder = "src/test";
|
||||
// this must not be OS-specific
|
||||
@Getter @Setter
|
||||
protected String sourceFolder = projectFolder + "/java";
|
||||
@Getter @Setter
|
||||
protected String testFolder = projectTestFolder + "/java";
|
||||
protected boolean discriminatorCaseSensitive = true; // True if the discriminator value lookup should be case-sensitive.
|
||||
/**
|
||||
* -- SETTER --
|
||||
* Set whether discriminator value lookup is case-sensitive or not.
|
||||
*
|
||||
* @param discriminatorCaseSensitive true if the discriminator value lookup should be case-sensitive.
|
||||
*/
|
||||
@Setter protected boolean discriminatorCaseSensitive = true;
|
||||
@Getter @Setter
|
||||
protected Boolean serializableModel = false;
|
||||
protected boolean serializeBigDecimalAsString = false;
|
||||
@Setter protected boolean serializeBigDecimalAsString = false;
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected boolean disableHtmlEscaping = false;
|
||||
@Setter protected boolean disableHtmlEscaping = false;
|
||||
@Getter @Setter
|
||||
protected String booleanGetterPrefix = "get";
|
||||
protected boolean ignoreAnyOfInEnum = false;
|
||||
protected String parentGroupId = "";
|
||||
protected String parentArtifactId = "";
|
||||
protected String parentVersion = "";
|
||||
protected boolean parentOverridden = false;
|
||||
@Setter protected boolean ignoreAnyOfInEnum = false;
|
||||
@Setter protected String parentGroupId = "";
|
||||
@Setter protected String parentArtifactId = "";
|
||||
@Setter protected String parentVersion = "";
|
||||
@Setter protected boolean parentOverridden = false;
|
||||
@Getter @Setter
|
||||
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
||||
protected Map<String, Boolean> lombokAnnotations = null;
|
||||
@Getter @Setter
|
||||
protected List<String> additionalOneOfTypeAnnotations = new LinkedList<>();
|
||||
protected List<String> additionalEnumTypeAnnotations = new LinkedList<>();
|
||||
@Setter protected List<String> additionalEnumTypeAnnotations = new LinkedList<>();
|
||||
@Getter @Setter
|
||||
protected boolean openApiNullable = true;
|
||||
protected String outputTestFolder = "";
|
||||
@Setter protected String outputTestFolder = "";
|
||||
protected DocumentationProvider documentationProvider;
|
||||
protected AnnotationLibrary annotationLibrary;
|
||||
protected boolean implicitHeaders = false;
|
||||
protected String implicitHeadersRegex = null;
|
||||
protected boolean camelCaseDollarSign = false;
|
||||
protected boolean useJakartaEe = false;
|
||||
protected boolean containerDefaultToNull = false;
|
||||
@Setter protected boolean implicitHeaders = false;
|
||||
@Setter protected String implicitHeadersRegex = null;
|
||||
@Setter protected boolean camelCaseDollarSign = false;
|
||||
@Setter protected boolean useJakartaEe = false;
|
||||
@Setter protected boolean containerDefaultToNull = false;
|
||||
@Getter @Setter
|
||||
protected boolean generateConstructorWithAllArgs = false;
|
||||
@Getter @Setter
|
||||
protected boolean generateBuilder = false;
|
||||
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
|
||||
@ -692,22 +726,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
});
|
||||
}
|
||||
|
||||
public void setGenerateConstructorWithAllArgs(boolean aValue) {
|
||||
this.generateConstructorWithAllArgs = aValue;
|
||||
}
|
||||
|
||||
public boolean isGenerateConstructorWithAllArgs() {
|
||||
return generateConstructorWithAllArgs;
|
||||
}
|
||||
|
||||
public void setGenerateBuilder(boolean aValue) {
|
||||
this.generateBuilder = aValue;
|
||||
}
|
||||
|
||||
public boolean isGenerateBuilder() {
|
||||
return generateBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyse and post process all Models.
|
||||
* @param objs the models map.
|
||||
@ -1241,14 +1259,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return validations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlias(String name) {
|
||||
if (typeAliases != null && typeAliases.containsKey(name)) {
|
||||
return typeAliases.get(name);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of array property
|
||||
* <p>
|
||||
@ -1838,6 +1848,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessResponseWithProperty(CodegenResponse response, CodegenProperty property) {
|
||||
if (response == null || property == null || response.dataType == null || property.dataType == null) {
|
||||
return;
|
||||
@ -2140,208 +2151,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public String getInvokerPackage() {
|
||||
return invokerPackage;
|
||||
}
|
||||
|
||||
public void setInvokerPackage(String invokerPackage) {
|
||||
this.invokerPackage = invokerPackage;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getArtifactId() {
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public String getArtifactVersion() {
|
||||
return artifactVersion;
|
||||
}
|
||||
|
||||
public void setArtifactVersion(String artifactVersion) {
|
||||
this.artifactVersion = artifactVersion;
|
||||
}
|
||||
|
||||
public String getArtifactUrl() {
|
||||
return artifactUrl;
|
||||
}
|
||||
|
||||
public void setArtifactUrl(String artifactUrl) {
|
||||
this.artifactUrl = artifactUrl;
|
||||
}
|
||||
|
||||
public String getArtifactDescription() {
|
||||
return artifactDescription;
|
||||
}
|
||||
|
||||
public void setArtifactDescription(String artifactDescription) {
|
||||
this.artifactDescription = artifactDescription;
|
||||
}
|
||||
|
||||
public String getScmConnection() {
|
||||
return scmConnection;
|
||||
}
|
||||
|
||||
public void setScmConnection(String scmConnection) {
|
||||
this.scmConnection = scmConnection;
|
||||
}
|
||||
|
||||
public String getScmDeveloperConnection() {
|
||||
return scmDeveloperConnection;
|
||||
}
|
||||
|
||||
public void setScmDeveloperConnection(String scmDeveloperConnection) {
|
||||
this.scmDeveloperConnection = scmDeveloperConnection;
|
||||
}
|
||||
|
||||
public String getScmUrl() {
|
||||
return scmUrl;
|
||||
}
|
||||
|
||||
public void setScmUrl(String scmUrl) {
|
||||
this.scmUrl = scmUrl;
|
||||
}
|
||||
|
||||
public String getDeveloperName() {
|
||||
return developerName;
|
||||
}
|
||||
|
||||
public void setDeveloperName(String developerName) {
|
||||
this.developerName = developerName;
|
||||
}
|
||||
|
||||
public String getDeveloperEmail() {
|
||||
return developerEmail;
|
||||
}
|
||||
|
||||
public void setDeveloperEmail(String developerEmail) {
|
||||
this.developerEmail = developerEmail;
|
||||
}
|
||||
|
||||
public String getDeveloperOrganization() {
|
||||
return developerOrganization;
|
||||
}
|
||||
|
||||
public void setDeveloperOrganization(String developerOrganization) {
|
||||
this.developerOrganization = developerOrganization;
|
||||
}
|
||||
|
||||
public String getDeveloperOrganizationUrl() {
|
||||
return developerOrganizationUrl;
|
||||
}
|
||||
|
||||
public void setDeveloperOrganizationUrl(String developerOrganizationUrl) {
|
||||
this.developerOrganizationUrl = developerOrganizationUrl;
|
||||
}
|
||||
|
||||
public String getLicenseName() {
|
||||
return licenseName;
|
||||
}
|
||||
|
||||
public void setLicenseName(String licenseName) {
|
||||
this.licenseName = licenseName;
|
||||
}
|
||||
|
||||
public String getLicenseUrl() {
|
||||
return licenseUrl;
|
||||
}
|
||||
|
||||
public void setLicenseUrl(String licenseUrl) {
|
||||
this.licenseUrl = licenseUrl;
|
||||
}
|
||||
|
||||
public String getSourceFolder() {
|
||||
return sourceFolder;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public String getTestFolder() {
|
||||
return testFolder;
|
||||
}
|
||||
|
||||
public void setTestFolder(String testFolder) {
|
||||
this.testFolder = testFolder;
|
||||
}
|
||||
|
||||
public void setSerializeBigDecimalAsString(boolean s) {
|
||||
this.serializeBigDecimalAsString = s;
|
||||
}
|
||||
|
||||
public Boolean getSerializableModel() {
|
||||
return serializableModel;
|
||||
}
|
||||
|
||||
public void setSerializableModel(Boolean serializableModel) {
|
||||
this.serializableModel = serializableModel;
|
||||
}
|
||||
|
||||
private String sanitizePath(String p) {
|
||||
//prefer replace a ", instead of a fuLL URL encode for readability
|
||||
return p.replaceAll("\"", "%22");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether discriminator value lookup is case-sensitive or not.
|
||||
*
|
||||
* @param discriminatorCaseSensitive true if the discriminator value lookup should be case sensitive.
|
||||
*/
|
||||
public void setDiscriminatorCaseSensitive(boolean discriminatorCaseSensitive) {
|
||||
this.discriminatorCaseSensitive = discriminatorCaseSensitive;
|
||||
}
|
||||
|
||||
public void setWithXml(boolean withXml) {
|
||||
this.withXml = withXml;
|
||||
}
|
||||
|
||||
public String getDateLibrary() {
|
||||
return dateLibrary;
|
||||
}
|
||||
|
||||
public void setDateLibrary(String library) {
|
||||
this.dateLibrary = library;
|
||||
}
|
||||
|
||||
public void setSupportAsync(boolean enabled) {
|
||||
this.supportAsync = enabled;
|
||||
}
|
||||
|
||||
public void setDisableHtmlEscaping(boolean disabled) {
|
||||
this.disableHtmlEscaping = disabled;
|
||||
}
|
||||
|
||||
public String getBooleanGetterPrefix() {
|
||||
return booleanGetterPrefix;
|
||||
}
|
||||
|
||||
public void setBooleanGetterPrefix(String booleanGetterPrefix) {
|
||||
this.booleanGetterPrefix = booleanGetterPrefix;
|
||||
}
|
||||
|
||||
public void setIgnoreAnyOfInEnum(boolean ignoreAnyOfInEnum) {
|
||||
this.ignoreAnyOfInEnum = ignoreAnyOfInEnum;
|
||||
}
|
||||
|
||||
public boolean isOpenApiNullable() {
|
||||
return openApiNullable;
|
||||
}
|
||||
|
||||
public void setOpenApiNullable(final boolean openApiNullable) {
|
||||
this.openApiNullable = openApiNullable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputDir(String dir) {
|
||||
super.setOutputDir(dir);
|
||||
@ -2357,10 +2171,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return outputTestFolder;
|
||||
}
|
||||
|
||||
public void setOutputTestFolder(String outputTestFolder) {
|
||||
this.outputTestFolder = outputTestFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentationProvider getDocumentationProvider() {
|
||||
return documentationProvider;
|
||||
@ -2381,26 +2191,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.annotationLibrary = annotationLibrary;
|
||||
}
|
||||
|
||||
public void setImplicitHeaders(boolean implicitHeaders) {
|
||||
this.implicitHeaders = implicitHeaders;
|
||||
}
|
||||
|
||||
public void setImplicitHeadersRegex(String implicitHeadersRegex) {
|
||||
this.implicitHeadersRegex = implicitHeadersRegex;
|
||||
}
|
||||
|
||||
public void setCamelCaseDollarSign(boolean camelCaseDollarSign) {
|
||||
this.camelCaseDollarSign = camelCaseDollarSign;
|
||||
}
|
||||
|
||||
public void setUseJakartaEe(boolean useJakartaEe) {
|
||||
this.useJakartaEe = useJakartaEe;
|
||||
}
|
||||
|
||||
public void setContainerDefaultToNull(boolean containerDefaultToNull) {
|
||||
this.containerDefaultToNull = containerDefaultToNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
@ -2527,42 +2317,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
}
|
||||
|
||||
public void setParentGroupId(final String parentGroupId) {
|
||||
this.parentGroupId = parentGroupId;
|
||||
}
|
||||
|
||||
public void setParentArtifactId(final String parentArtifactId) {
|
||||
this.parentArtifactId = parentArtifactId;
|
||||
}
|
||||
|
||||
public void setParentVersion(final String parentVersion) {
|
||||
this.parentVersion = parentVersion;
|
||||
}
|
||||
|
||||
public void setParentOverridden(final boolean parentOverridden) {
|
||||
this.parentOverridden = parentOverridden;
|
||||
}
|
||||
|
||||
public List<String> getAdditionalModelTypeAnnotations() {
|
||||
return additionalModelTypeAnnotations;
|
||||
}
|
||||
|
||||
public void setAdditionalModelTypeAnnotations(final List<String> additionalModelTypeAnnotations) {
|
||||
this.additionalModelTypeAnnotations = additionalModelTypeAnnotations;
|
||||
}
|
||||
|
||||
public List<String> getAdditionalOneOfTypeAnnotations() {
|
||||
return additionalOneOfTypeAnnotations;
|
||||
}
|
||||
|
||||
public void setAdditionalOneOfTypeAnnotations(final List<String> additionalOneOfTypeAnnotations) {
|
||||
this.additionalOneOfTypeAnnotations = additionalOneOfTypeAnnotations;
|
||||
}
|
||||
|
||||
public void setAdditionalEnumTypeAnnotations(final List<String> additionalEnumTypeAnnotations) {
|
||||
this.additionalEnumTypeAnnotations = additionalEnumTypeAnnotations;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
if (!supportsAdditionalPropertiesWithComposedSchema) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.ClientModificationFeature;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
@ -32,7 +33,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
@ -63,9 +63,9 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
protected String packageName;
|
||||
protected Boolean exportModels;
|
||||
protected Boolean exportOperations;
|
||||
@Setter protected String packageName;
|
||||
@Setter protected Boolean exportModels;
|
||||
@Setter protected Boolean exportOperations;
|
||||
|
||||
protected final DateTimeFormatter OFFSET_DATE_TIME_FORMAT = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
protected final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT);
|
||||
@ -147,18 +147,6 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
|
||||
return GeneratorLanguage.JULIA;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setExportModels(Boolean exportModels) {
|
||||
this.exportModels = exportModels;
|
||||
}
|
||||
|
||||
public void setExportOperations(Boolean exportOperations) {
|
||||
this.exportOperations = exportOperations;
|
||||
}
|
||||
|
||||
protected static String dropDots(String str) {
|
||||
return str.replaceAll("\\.", "_");
|
||||
}
|
||||
@ -440,6 +428,7 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
|
||||
* @param input String to be cleaned up
|
||||
* @return string with quotation mark removed or escaped
|
||||
*/
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
return input.replace("\"", "\\\"");
|
||||
}
|
||||
@ -500,6 +489,7 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
|
||||
* @param operationId operation ID
|
||||
* @return the sanitized method name
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String toOperationId(String operationId) {
|
||||
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||
|
@ -20,9 +20,10 @@ package org.openapitools.codegen.languages;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -55,32 +56,34 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
|
||||
|
||||
protected String artifactId;
|
||||
protected String artifactVersion = "1.0.0";
|
||||
protected String groupId = "org.openapitools";
|
||||
protected String packageName = "org.openapitools";
|
||||
protected String apiSuffix = "Api";
|
||||
@Setter protected String artifactId;
|
||||
@Setter protected String artifactVersion = "1.0.0";
|
||||
@Setter protected String groupId = "org.openapitools";
|
||||
@Setter protected String packageName = "org.openapitools";
|
||||
@Setter protected String apiSuffix = "Api";
|
||||
|
||||
protected String sourceFolder = "src/main/kotlin";
|
||||
protected String testFolder = "src/test/kotlin";
|
||||
@Setter protected String sourceFolder = "src/main/kotlin";
|
||||
@Setter protected String testFolder = "src/test/kotlin";
|
||||
protected String resourcesFolder = "src/main/resources";
|
||||
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected boolean parcelizeModels = false;
|
||||
@Getter @Setter
|
||||
protected boolean serializableModel = false;
|
||||
|
||||
protected boolean useJakartaEe = false;
|
||||
@Setter protected boolean useJakartaEe = false;
|
||||
|
||||
protected boolean nonPublicApi = false;
|
||||
@Setter protected boolean nonPublicApi = false;
|
||||
|
||||
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.original;
|
||||
@Getter protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.original;
|
||||
|
||||
// model classes cannot use the same property names defined in HashMap
|
||||
// ref: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-hash-map/
|
||||
protected Set<String> propertyAdditionalKeywords = new HashSet<>(Arrays.asList("entries", "keys", "size", "values"));
|
||||
|
||||
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
@Getter @Setter
|
||||
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
||||
|
||||
public AbstractKotlinCodegen() {
|
||||
@ -304,10 +307,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
return input.replace("*/", "*_/").replace("/*", "/_*");
|
||||
}
|
||||
|
||||
public CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming() {
|
||||
return this.enumPropertyNaming;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the naming convention for Kotlin enum properties
|
||||
@ -537,34 +536,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
return Boolean.TRUE.equals(additionalProperties.get(MODEL_MUTABLE));
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactVersion(String artifactVersion) {
|
||||
this.artifactVersion = artifactVersion;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setApiSuffix(String apiSuffix) {
|
||||
this.apiSuffix = apiSuffix;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public void setTestFolder(String testFolder) {
|
||||
this.testFolder = testFolder;
|
||||
}
|
||||
|
||||
public Boolean getParcelizeModels() {
|
||||
return parcelizeModels;
|
||||
}
|
||||
@ -573,26 +544,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
this.parcelizeModels = parcelizeModels;
|
||||
}
|
||||
|
||||
public boolean isSerializableModel() {
|
||||
return serializableModel;
|
||||
}
|
||||
|
||||
public void setSerializableModel(boolean serializableModel) {
|
||||
this.serializableModel = serializableModel;
|
||||
}
|
||||
|
||||
public void setUseJakartaEe(boolean useJakartaEe) {
|
||||
this.useJakartaEe = useJakartaEe;
|
||||
}
|
||||
|
||||
public boolean nonPublicApi() {
|
||||
return nonPublicApi;
|
||||
}
|
||||
|
||||
public void setNonPublicApi(boolean nonPublicApi) {
|
||||
this.nonPublicApi = nonPublicApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sanitized variable name for enum
|
||||
*
|
||||
@ -1166,14 +1121,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
setAddProps(schema, m);
|
||||
}
|
||||
|
||||
public List<String> getAdditionalModelTypeAnnotations() {
|
||||
return additionalModelTypeAnnotations;
|
||||
}
|
||||
|
||||
public void setAdditionalModelTypeAnnotations(final List<String> additionalModelTypeAnnotations) {
|
||||
this.additionalModelTypeAnnotations = additionalModelTypeAnnotations;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
|
||||
return super.addMustacheLambdas()
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -48,15 +49,17 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
public static final String VARIABLE_NAMING_CONVENTION = "variableNamingConvention";
|
||||
public static final String PACKAGE_NAME = "packageName";
|
||||
public static final String SRC_BASE_PATH = "srcBasePath";
|
||||
@Getter @Setter
|
||||
protected String invokerPackage = "php";
|
||||
@Getter @Setter
|
||||
protected String packageName = "php-base";
|
||||
protected String artifactVersion = null;
|
||||
protected String artifactUrl = "https://openapi-generator.tech";
|
||||
protected String licenseName = "unlicense";
|
||||
protected String developerOrganization = "OpenAPI";
|
||||
protected String developerOrganizationUrl = "https://openapi-generator.tech";
|
||||
protected String srcBasePath = "lib";
|
||||
protected String testBasePath = "test";
|
||||
@Setter protected String artifactVersion = null;
|
||||
@Setter protected String artifactUrl = "https://openapi-generator.tech";
|
||||
@Setter protected String licenseName = "unlicense";
|
||||
@Setter protected String developerOrganization = "OpenAPI";
|
||||
@Setter protected String developerOrganizationUrl = "https://openapi-generator.tech";
|
||||
@Setter protected String srcBasePath = "lib";
|
||||
@Setter protected String testBasePath = "test";
|
||||
protected String docsBasePath = "docs";
|
||||
protected String apiDirName = "Api";
|
||||
protected String modelDirName = "Model";
|
||||
@ -282,10 +285,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public String toSrcPath(final String packageName, final String basePath) {
|
||||
String modifiedPackageName = packageName.replace(invokerPackage, "");
|
||||
String modifiedBasePath = basePath;
|
||||
@ -417,46 +416,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
public String getInvokerPackage() {
|
||||
return invokerPackage;
|
||||
}
|
||||
|
||||
public void setInvokerPackage(String invokerPackage) {
|
||||
this.invokerPackage = invokerPackage;
|
||||
}
|
||||
|
||||
public void setArtifactVersion(String artifactVersion) {
|
||||
this.artifactVersion = artifactVersion;
|
||||
}
|
||||
|
||||
public void setArtifactUrl(String artifactUrl) {
|
||||
this.artifactUrl = artifactUrl;
|
||||
}
|
||||
|
||||
public void setLicenseName(String licenseName) {
|
||||
this.licenseName = licenseName;
|
||||
}
|
||||
|
||||
public void setDeveloperOrganization(String developerOrganization) {
|
||||
this.developerOrganization = developerOrganization;
|
||||
}
|
||||
|
||||
public void setDeveloperOrganizationUrl(String developerOrganizationUrl) {
|
||||
this.developerOrganizationUrl = developerOrganizationUrl;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setSrcBasePath(String srcBasePath) {
|
||||
this.srcBasePath = srcBasePath;
|
||||
}
|
||||
|
||||
public void setTestBasePath(String testBasePath) {
|
||||
this.testBasePath = testBasePath;
|
||||
}
|
||||
|
||||
public void setParameterNamingConvention(String variableNamingConvention) {
|
||||
this.variableNamingConvention = variableNamingConvention;
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenDiscriminator;
|
||||
import org.openapitools.codegen.CodegenMediaType;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
@ -66,7 +66,6 @@ import org.slf4j.LoggerFactory;
|
||||
import com.github.curiousoddman.rgxgen.RgxGen;
|
||||
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
|
||||
@ -80,8 +79,8 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
public static final String MAP_NUMBER_TO = "mapNumberTo";
|
||||
|
||||
protected String packageName = "openapi_client";
|
||||
protected String packageVersion = "1.0.0";
|
||||
protected String projectName; // for setup.py, e.g. petstore-api
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
@Setter protected String projectName; // for setup.py, e.g. petstore-api
|
||||
protected boolean hasModelsToImport = Boolean.FALSE;
|
||||
protected String mapNumberTo = "Union[StrictFloat, StrictInt]";
|
||||
protected Map<Character, String> regexModifiers;
|
||||
@ -679,14 +678,6 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, this.packageName);
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
p = ModelUtils.unaliasSchema(openAPI, p);
|
||||
|
@ -55,7 +55,6 @@ import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.PathItem.HttpMethod;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
@ -737,6 +736,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
* does not support this in as natural a way so it needs to convert it. See
|
||||
* https://docs.python.org/2/howto/regex.html#compilation-flags for details.
|
||||
*/
|
||||
@Override
|
||||
public void postProcessPattern(String pattern, Map<String, Object> vendorExtensions) {
|
||||
if (pattern != null) {
|
||||
int i = pattern.lastIndexOf('/');
|
||||
|
@ -18,9 +18,9 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.github.curiousoddman.rgxgen.RgxGen;
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -48,8 +48,8 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
|
||||
public static final String MAP_NUMBER_TO = "mapNumberTo";
|
||||
|
||||
protected String packageName = "openapi_client";
|
||||
protected String packageVersion = "1.0.0";
|
||||
protected String projectName; // for setup.py, e.g. petstore-api
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
@Setter protected String projectName; // for setup.py, e.g. petstore-api
|
||||
protected boolean hasModelsToImport = Boolean.FALSE;
|
||||
protected String mapNumberTo = "Union[StrictFloat, StrictInt]";
|
||||
protected Map<Character, String> regexModifiers;
|
||||
@ -642,14 +642,6 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, this.packageName);
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
p = ModelUtils.unaliasSchema(openAPI, p);
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -2,7 +2,6 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Strings;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.FileSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -148,8 +147,6 @@ public abstract class AbstractRustCodegen extends DefaultCodegen implements Code
|
||||
|
||||
public enum CasingType {CAMEL_CASE, SNAKE_CASE}
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* General purpose sanitizing function for Rust identifiers (fields, variables, structs, parameters, etc.).<br>
|
||||
* Rules for Rust are fairly simple:
|
||||
|
@ -20,10 +20,11 @@ package org.openapitools.codegen.languages;
|
||||
import com.samskivert.mustache.Escapers;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -48,8 +49,9 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractScalaCodegen.class);
|
||||
|
||||
protected String modelPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase.name();
|
||||
protected String invokerPackage = "org.openapitools.client";
|
||||
@Getter protected String modelPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase.name();
|
||||
@Setter protected String invokerPackage = "org.openapitools.client";
|
||||
@Getter @Setter
|
||||
protected String sourceFolder = "src/main/scala";
|
||||
protected String appName = "OpenAPI Sample";
|
||||
protected String appDescription = "A sample openapi server";
|
||||
@ -59,7 +61,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
protected String licenseUrl = "http://apache.org/licenses/LICENSE-2.0.html";
|
||||
protected String apiVersion = "1.0";
|
||||
protected boolean stripPackageName = true;
|
||||
protected String dateLibrary = DateLibraries.java8.name();
|
||||
@Getter protected String dateLibrary = DateLibraries.java8.name();
|
||||
|
||||
protected enum DateLibraries {
|
||||
java8("Java 8 native JSR310 (preferred for JDK 1.8+)"),
|
||||
@ -255,10 +257,6 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
throw new IllegalArgumentException("Invalid dateLibrary. Must be 'java8' or 'joda'");
|
||||
}
|
||||
|
||||
public String getDateLibrary() {
|
||||
return this.dateLibrary;
|
||||
}
|
||||
|
||||
public void setModelPropertyNaming(String naming) {
|
||||
try {
|
||||
this.modelPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.valueOf(naming).name();
|
||||
@ -269,10 +267,6 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
public String getModelPropertyNaming() {
|
||||
return this.modelPropertyNaming;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
@ -316,14 +310,6 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
public String getSourceFolder() {
|
||||
return sourceFolder;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
if (this.reservedWordsMappings().containsKey(name)) {
|
||||
@ -614,10 +600,6 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
return operationId;
|
||||
}
|
||||
|
||||
public void setInvokerPackage(String invokerPackage) {
|
||||
this.invokerPackage = invokerPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorLanguage generatorLanguage() {
|
||||
return GeneratorLanguage.SCALA;
|
||||
|
@ -18,10 +18,10 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@ -240,14 +240,18 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
@SuppressWarnings("squid:S5164")
|
||||
protected static final ThreadLocal<SimpleDateFormat> SNAPSHOT_SUFFIX_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT));
|
||||
|
||||
protected MODEL_PROPERTY_NAMING_TYPE modelPropertyNaming = MODEL_PROPERTY_NAMING_TYPE.original;
|
||||
@Getter protected MODEL_PROPERTY_NAMING_TYPE modelPropertyNaming = MODEL_PROPERTY_NAMING_TYPE.original;
|
||||
protected ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = ENUM_PROPERTY_NAMING_TYPE.PascalCase;
|
||||
protected PARAM_NAMING_TYPE paramNaming = PARAM_NAMING_TYPE.camelCase;
|
||||
@Getter protected PARAM_NAMING_TYPE paramNaming = PARAM_NAMING_TYPE.camelCase;
|
||||
protected boolean enumPropertyNamingReplaceSpecialChar = false;
|
||||
@Getter @Setter
|
||||
protected Boolean supportsES6 = false;
|
||||
@Getter @Setter
|
||||
protected Boolean nullSafeAdditionalProps = false;
|
||||
protected HashSet<String> languageGenericTypes;
|
||||
@Getter @Setter
|
||||
protected String npmName = null;
|
||||
@Getter @Setter
|
||||
protected String npmVersion = "1.0.0";
|
||||
|
||||
protected String enumSuffix = "Enum";
|
||||
@ -827,14 +831,6 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
}
|
||||
}
|
||||
|
||||
public MODEL_PROPERTY_NAMING_TYPE getModelPropertyNaming() {
|
||||
return modelPropertyNaming;
|
||||
}
|
||||
|
||||
public PARAM_NAMING_TYPE getParamNaming() {
|
||||
return paramNaming;
|
||||
}
|
||||
|
||||
private String getNameUsingParamNaming(String name) {
|
||||
switch (getParamNaming()) {
|
||||
case original:
|
||||
@ -1037,38 +1033,6 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setSupportsES6(Boolean value) {
|
||||
supportsES6 = value;
|
||||
}
|
||||
|
||||
public Boolean getSupportsES6() {
|
||||
return supportsES6;
|
||||
}
|
||||
|
||||
public Boolean getNullSafeAdditionalProps() {
|
||||
return nullSafeAdditionalProps;
|
||||
}
|
||||
|
||||
public void setNullSafeAdditionalProps(Boolean value) {
|
||||
nullSafeAdditionalProps = value;
|
||||
}
|
||||
|
||||
public String getNpmName() {
|
||||
return npmName;
|
||||
}
|
||||
|
||||
public void setNpmName(String npmName) {
|
||||
this.npmName = npmName;
|
||||
}
|
||||
|
||||
public String getNpmVersion() {
|
||||
return npmVersion;
|
||||
}
|
||||
|
||||
public void setNpmVersion(String npmVersion) {
|
||||
this.npmVersion = npmVersion;
|
||||
}
|
||||
|
||||
private void setDiscriminatorValue(CodegenModel model, String baseName, String value) {
|
||||
for (CodegenProperty prop : model.allVars) {
|
||||
if (prop.baseName.equals(baseName)) {
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
@ -40,21 +41,26 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
public static final String ANDROID_GRADLE_VERSION = "androidGradleVersion";
|
||||
public static final String ANDROID_SDK_VERSION = "androidSdkVersion";
|
||||
public static final String ANDROID_BUILD_TOOLS_VERSION = "androidBuildToolsVersion";
|
||||
@Getter @Setter
|
||||
protected String invokerPackage = "org.openapitools.client";
|
||||
protected String groupId = "org.openapitools";
|
||||
protected String artifactId = "openapi-android-client";
|
||||
protected String artifactVersion = "1.0.0";
|
||||
@Setter protected String groupId = "org.openapitools";
|
||||
@Setter protected String artifactId = "openapi-android-client";
|
||||
@Setter protected String artifactVersion = "1.0.0";
|
||||
protected String projectFolder = "src/main";
|
||||
protected String sourceFolder = projectFolder + "/java";
|
||||
@Setter protected String sourceFolder = projectFolder + "/java";
|
||||
@Getter @Setter
|
||||
protected Boolean useAndroidMavenGradlePlugin = true;
|
||||
@Getter @Setter
|
||||
protected String androidGradleVersion;
|
||||
@Getter @Setter
|
||||
protected String androidSdkVersion;
|
||||
@Getter @Setter
|
||||
protected String androidBuildToolsVersion;
|
||||
protected Boolean serializableModel = false;
|
||||
@Setter protected Boolean serializableModel = false;
|
||||
|
||||
// requestPackage and authPackage are used by the "volley" template/library
|
||||
protected String requestPackage = "org.openapitools.client.request";
|
||||
protected String authPackage = "org.openapitools.client.auth";
|
||||
@Setter protected String requestPackage = "org.openapitools.client.request";
|
||||
@Setter protected String authPackage = "org.openapitools.client.auth";
|
||||
protected String gradleWrapperPackage = "gradle.wrapper";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
@ -498,74 +504,6 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getUseAndroidMavenGradlePlugin() {
|
||||
return useAndroidMavenGradlePlugin;
|
||||
}
|
||||
|
||||
public String getAndroidGradleVersion() {
|
||||
return androidGradleVersion;
|
||||
}
|
||||
|
||||
public String getAndroidSdkVersion() {
|
||||
return androidSdkVersion;
|
||||
}
|
||||
|
||||
public String getAndroidBuildToolsVersion() {
|
||||
return androidBuildToolsVersion;
|
||||
}
|
||||
|
||||
public void setUseAndroidMavenGradlePlugin(Boolean useAndroidMavenGradlePlugin) {
|
||||
this.useAndroidMavenGradlePlugin = useAndroidMavenGradlePlugin;
|
||||
}
|
||||
|
||||
public void setAndroidGradleVersion(String androidGradleVersion) {
|
||||
this.androidGradleVersion = androidGradleVersion;
|
||||
}
|
||||
|
||||
public void setAndroidSdkVersion(String androidSdkVersion) {
|
||||
this.androidSdkVersion = androidSdkVersion;
|
||||
}
|
||||
|
||||
public void setAndroidBuildToolsVersion(String androidBuildToolsVersion) {
|
||||
this.androidBuildToolsVersion = androidBuildToolsVersion;
|
||||
}
|
||||
|
||||
public String getInvokerPackage() {
|
||||
return invokerPackage;
|
||||
}
|
||||
|
||||
public void setInvokerPackage(String invokerPackage) {
|
||||
this.invokerPackage = invokerPackage;
|
||||
}
|
||||
|
||||
public void setRequestPackage(String requestPackage) {
|
||||
this.requestPackage = requestPackage;
|
||||
}
|
||||
|
||||
public void setAuthPackage(String authPackage) {
|
||||
this.authPackage = authPackage;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactVersion(String artifactVersion) {
|
||||
this.artifactVersion = artifactVersion;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public void setSerializableModel(Boolean serializableModel) {
|
||||
this.serializableModel = serializableModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
|
@ -18,8 +18,8 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
@ -45,9 +45,9 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
private static final String NAMED_CREDENTIAL = "namedCredential";
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(ApexClientCodegen.class);
|
||||
private String classPrefix = "OAS";
|
||||
private String apiVersion = "42.0";
|
||||
@Setter private String apiVersion = "42.0";
|
||||
private String buildMethod = "sfdx";
|
||||
private String namedCredential;
|
||||
@Setter private String namedCredential;
|
||||
private String srcPath = "force-app/main/default/";
|
||||
private String sfdxConfigPath = "config/";
|
||||
private HashMap<String, Object> primitiveDefaults = new HashMap<>();
|
||||
@ -263,20 +263,12 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
this.buildMethod = buildMethod;
|
||||
}
|
||||
|
||||
public void setNamedCredential(String namedCredential) {
|
||||
this.namedCredential = namedCredential;
|
||||
}
|
||||
|
||||
public void setClassPrefix(String classPrefix) {
|
||||
// the best thing we can do without namespacing in Apex
|
||||
modelNamePrefix = classPrefix;
|
||||
this.classPrefix = classPrefix;
|
||||
}
|
||||
|
||||
public void setApiVersion(String apiVersion) {
|
||||
this.apiVersion = apiVersion;
|
||||
}
|
||||
|
||||
private String toApiVersion(String apiVersion) {
|
||||
if (apiVersion.matches("^\\d{2}(\\.0)?$")) {
|
||||
return apiVersion.substring(0, 2) + ".0";
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
|
||||
import java.io.File;
|
||||
@ -153,10 +155,15 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
protected String groupId = "org.openapitools";
|
||||
protected String artifactId = "openapi-client";
|
||||
protected String artifactVersion = "1.0.0";
|
||||
@Getter @Setter
|
||||
protected boolean headerAttributes = true;
|
||||
@Getter @Setter
|
||||
protected boolean useIntroduction = false;
|
||||
@Getter @Setter
|
||||
protected boolean skipExamples = false;
|
||||
@Getter @Setter
|
||||
protected boolean useMethodAndPath = false;
|
||||
@Getter @Setter
|
||||
protected boolean useTableTitles = false;
|
||||
|
||||
private IncludeMarkupLambda includeSpecMarkupLambda;
|
||||
@ -281,46 +288,6 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
return input; // just return the original string
|
||||
}
|
||||
|
||||
public boolean isHeaderAttributes() {
|
||||
return headerAttributes;
|
||||
}
|
||||
|
||||
public void setHeaderAttributes(boolean headerAttributes) {
|
||||
this.headerAttributes = headerAttributes;
|
||||
}
|
||||
|
||||
public boolean isUseIntroduction() {
|
||||
return useIntroduction;
|
||||
}
|
||||
|
||||
public void setUseIntroduction(boolean useIntroduction) {
|
||||
this.useIntroduction = useIntroduction;
|
||||
}
|
||||
|
||||
public boolean isSkipExamples() {
|
||||
return skipExamples;
|
||||
}
|
||||
|
||||
public void setSkipExamples(boolean skipExamples) {
|
||||
this.skipExamples = skipExamples;
|
||||
}
|
||||
|
||||
public boolean isUseMethodAndPath() {
|
||||
return useMethodAndPath;
|
||||
}
|
||||
|
||||
public void setUseMethodAndPath(boolean useMethodAndPath) {
|
||||
this.useMethodAndPath = useMethodAndPath;
|
||||
}
|
||||
|
||||
public boolean isUseTableTitles() {
|
||||
return useTableTitles;
|
||||
}
|
||||
|
||||
public void setUseTableTitles(boolean useTableTitles) {
|
||||
this.useTableTitles = useTableTitles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
@ -21,6 +21,7 @@ import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -64,7 +65,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
public static final String USE_DEFAULT_ROUTING = "useDefaultRouting";
|
||||
public static final String NEWTONSOFT_VERSION = "newtonsoftVersion";
|
||||
|
||||
private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
@Setter private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
private String userSecretsGuid = randomUUID().toString();
|
||||
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(AspNetServerCodegen.class);
|
||||
@ -307,11 +308,6 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
"DateTime", "DateOnly", "DateTimeOffset", "Guid"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getValueTypes() {
|
||||
return new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double", "DateTime", "DateOnly", "DateTimeOffset", "Guid"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
@ -472,10 +468,6 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
return additionalProperties.containsKey(NET_60_OR_LATER);
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
this.packageGuid = packageGuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + packageName + File.separator + "Controllers";
|
||||
|
@ -22,10 +22,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -44,14 +44,14 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
|
||||
protected String curlOptions;
|
||||
protected boolean processMarkdown = false;
|
||||
protected String scriptName = "client.sh";
|
||||
protected boolean generateBashCompletion = false;
|
||||
protected boolean generateZshCompletion = false;
|
||||
protected String hostEnvironmentVariable;
|
||||
protected String basicAuthEnvironmentVariable;
|
||||
protected String apiKeyAuthEnvironmentVariable;
|
||||
@Setter protected String curlOptions;
|
||||
@Setter protected boolean processMarkdown = false;
|
||||
@Setter protected String scriptName = "client.sh";
|
||||
@Setter protected boolean generateBashCompletion = false;
|
||||
@Setter protected boolean generateZshCompletion = false;
|
||||
@Setter protected String hostEnvironmentVariable;
|
||||
@Setter protected String basicAuthEnvironmentVariable;
|
||||
@Setter protected String apiKeyAuthEnvironmentVariable;
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
@ -333,40 +333,6 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
"Dockerfile.mustache", "", "Dockerfile"));
|
||||
}
|
||||
|
||||
public void setCurlOptions(String curlOptions) {
|
||||
this.curlOptions = curlOptions;
|
||||
}
|
||||
|
||||
public void setProcessMarkdown(boolean processMarkdown) {
|
||||
this.processMarkdown = processMarkdown;
|
||||
}
|
||||
|
||||
public void setScriptName(String scriptName) {
|
||||
this.scriptName = scriptName;
|
||||
}
|
||||
|
||||
public void setGenerateBashCompletion(boolean generateBashCompletion) {
|
||||
this.generateBashCompletion = generateBashCompletion;
|
||||
}
|
||||
|
||||
public void setGenerateZshCompletion(boolean generateZshCompletion) {
|
||||
this.generateZshCompletion = generateZshCompletion;
|
||||
}
|
||||
|
||||
public void setHostEnvironmentVariable(String hostEnvironmentVariable) {
|
||||
this.hostEnvironmentVariable = hostEnvironmentVariable;
|
||||
}
|
||||
|
||||
public void setBasicAuthEnvironmentVariable(String
|
||||
basicAuthEnvironmentVariable) {
|
||||
this.basicAuthEnvironmentVariable = basicAuthEnvironmentVariable;
|
||||
}
|
||||
|
||||
public void setApiKeyAuthEnvironmentVariable(String
|
||||
apiKeyAuthEnvironmentVariable) {
|
||||
this.apiKeyAuthEnvironmentVariable = apiKeyAuthEnvironmentVariable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escapes a reserved word as defined in the `reservedWords` array. Handle
|
||||
|
@ -21,6 +21,8 @@ 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.servers.Server;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -91,8 +93,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
);
|
||||
private static FrameworkStrategy latestFramework = frameworkStrategies.get(frameworkStrategies.size() - 1);
|
||||
protected final Map<String, String> frameworks;
|
||||
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
protected String clientPackage = "Client";
|
||||
@Setter protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
@Setter protected String clientPackage = "Client";
|
||||
protected String authFolder = "Auth";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
@ -110,16 +112,17 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
protected boolean supportsFileParameters = Boolean.TRUE;
|
||||
protected boolean supportsDateOnly = Boolean.FALSE;
|
||||
|
||||
protected boolean validatable = Boolean.TRUE;
|
||||
protected boolean equatable = Boolean.FALSE;
|
||||
@Setter protected boolean validatable = Boolean.TRUE;
|
||||
@Setter protected boolean equatable = Boolean.FALSE;
|
||||
// By default, generated code is considered public
|
||||
@Getter @Setter
|
||||
protected boolean nonPublicApi = Boolean.FALSE;
|
||||
|
||||
protected boolean caseInsensitiveResponseHeaders = Boolean.FALSE;
|
||||
protected String releaseNote = "Minor update";
|
||||
protected String licenseId;
|
||||
protected String packageTags;
|
||||
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
@Setter protected String licenseId;
|
||||
@Setter protected String packageTags;
|
||||
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
|
||||
protected boolean needsCustomHttpMethod = false;
|
||||
protected boolean needsUriBuilder = false;
|
||||
@ -575,14 +578,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
public boolean isNonPublicApi() {
|
||||
return nonPublicApi;
|
||||
}
|
||||
|
||||
public void setNonPublicApi(final boolean nonPublicApi) {
|
||||
this.nonPublicApi = nonPublicApi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
if (GENERICHOST.equals(getLibrary())) {
|
||||
@ -855,10 +850,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
this.useSourceGeneration = useSourceGeneration;
|
||||
}
|
||||
|
||||
public void setClientPackage(String clientPackage) {
|
||||
this.clientPackage = clientPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
@ -1057,11 +1048,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
public void setOptionalProjectFileFlag(boolean flag) {
|
||||
this.optionalProjectFileFlag = flag;
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
this.packageGuid = packageGuid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the api name. This value must be a valid class name.
|
||||
*
|
||||
@ -1136,35 +1123,15 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
.collect(Collectors.joining(";"));
|
||||
}
|
||||
|
||||
public void setValidatable(boolean validatable) {
|
||||
this.validatable = validatable;
|
||||
}
|
||||
|
||||
public void setEquatable(boolean equatable) {
|
||||
this.equatable = equatable;
|
||||
}
|
||||
|
||||
public void setCaseInsensitiveResponseHeaders(final Boolean caseInsensitiveResponseHeaders) {
|
||||
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
|
||||
}
|
||||
|
||||
public void setLicenseId(String licenseId) {
|
||||
this.licenseId = licenseId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReleaseNote(String releaseNote) {
|
||||
this.releaseNote = releaseNote;
|
||||
}
|
||||
|
||||
public void setPackageTags(String packageTags) {
|
||||
this.packageTags = packageTags;
|
||||
}
|
||||
|
||||
public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) {
|
||||
this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
||||
public boolean getUseOneOfDiscriminatorLookup() {
|
||||
return this.useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -55,7 +56,7 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
|
||||
public static final String NEWTONSOFT_VERSION = "newtonsoftVersion";
|
||||
public static final String NET_60_OR_LATER = "net60OrLater";
|
||||
|
||||
private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
@Setter private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
private String userSecretsGuid = randomUUID().toString();
|
||||
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(AspNetServerCodegen.class);
|
||||
@ -388,10 +389,6 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
|
||||
this.setTypeMapping();
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
this.packageGuid = packageGuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + packageName + File.separator + "Functions";
|
||||
|
@ -18,9 +18,9 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -75,7 +75,7 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
);
|
||||
private static FrameworkStrategy defaultFramework = FrameworkStrategy.NETSTANDARD_2_0;
|
||||
protected final Map<String, String> frameworks;
|
||||
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
@Setter protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
protected String clientPackage = "Org.OpenAPITools.Client";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
@ -91,16 +91,17 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
protected boolean supportsAsync = Boolean.TRUE;
|
||||
protected boolean netStandard = Boolean.FALSE;
|
||||
|
||||
protected boolean validatable = Boolean.TRUE;
|
||||
@Setter protected boolean validatable = Boolean.TRUE;
|
||||
protected Map<Character, String> regexModifiers;
|
||||
// By default, generated code is considered public
|
||||
@Getter @Setter
|
||||
protected boolean nonPublicApi = Boolean.FALSE;
|
||||
|
||||
protected boolean caseInsensitiveResponseHeaders = Boolean.FALSE;
|
||||
protected String releaseNote = "Minor update";
|
||||
protected String licenseId;
|
||||
protected String packageTags;
|
||||
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
@Setter protected String licenseId;
|
||||
@Setter protected String packageTags;
|
||||
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
|
||||
protected boolean needsCustomHttpMethod = false;
|
||||
protected boolean needsUriBuilder = false;
|
||||
@ -484,14 +485,6 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
public boolean isNonPublicApi() {
|
||||
return nonPublicApi;
|
||||
}
|
||||
|
||||
public void setNonPublicApi(final boolean nonPublicApi) {
|
||||
this.nonPublicApi = nonPublicApi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
@ -753,10 +746,6 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
this.optionalProjectFileFlag = flag;
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
this.packageGuid = packageGuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
@ -821,31 +810,15 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
.collect(Collectors.joining(";"));
|
||||
}
|
||||
|
||||
public void setValidatable(boolean validatable) {
|
||||
this.validatable = validatable;
|
||||
}
|
||||
|
||||
public void setCaseInsensitiveResponseHeaders(final Boolean caseInsensitiveResponseHeaders) {
|
||||
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
|
||||
}
|
||||
|
||||
public void setLicenseId(String licenseId) {
|
||||
this.licenseId = licenseId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReleaseNote(String releaseNote) {
|
||||
this.releaseNote = releaseNote;
|
||||
}
|
||||
|
||||
public void setPackageTags(String packageTags) {
|
||||
this.packageTags = packageTags;
|
||||
}
|
||||
|
||||
public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) {
|
||||
this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
||||
public boolean getUseOneOfDiscriminatorLookup() {
|
||||
return this.useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -367,11 +366,6 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
return escapeText(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataTypeString(String dataType) {
|
||||
return "QString".equals(dataType);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
@ -38,7 +39,7 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
protected String packageName = "";
|
||||
// source folder where to write the files
|
||||
protected String sourceFolder = "client";
|
||||
protected boolean optionalProjectFileFlag = true;
|
||||
@Setter protected boolean optionalProjectFileFlag = true;
|
||||
|
||||
public CppQtClientCodegen() {
|
||||
super();
|
||||
@ -224,10 +225,6 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
return modelNamePrefix + sanitizeName(camelize(name)) + "Api";
|
||||
}
|
||||
|
||||
public void setOptionalProjectFileFlag(boolean flag) {
|
||||
this.optionalProjectFileFlag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
|
||||
objs = super.postProcessOperationsWithModels(objs, allModels);
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
@ -52,7 +52,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
// Will be included using the <> syntax, not used in Unreal's coding convention
|
||||
protected Set<String> systemIncludes = new HashSet<>();
|
||||
protected String cppNamespace = unrealModuleName;
|
||||
protected boolean optionalProjectFileFlag = true;
|
||||
@Setter protected boolean optionalProjectFileFlag = true;
|
||||
|
||||
public CppUE4ClientCodegen() {
|
||||
super();
|
||||
@ -246,10 +246,6 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
public void setOptionalProjectFileFlag(boolean flag) {
|
||||
this.optionalProjectFileFlag = flag;
|
||||
}
|
||||
|
||||
// override to post-process any model properties
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
@ -561,17 +557,6 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
return modelNamePrefix + camelize(type) + "Api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
return input.replace("\"", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("*/", "*_/").replace("/*", "/_*");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toBooleanGetter(String name) {
|
||||
return "Is" + getterAndSetterCapitalize(name);
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -50,17 +50,17 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
private static final String NUMERIC_ENUM_PREFIX = "N";
|
||||
protected static int emptyMethodNameCounter = 0;
|
||||
|
||||
protected String shardName = "openapi_client";
|
||||
protected String moduleName = "OpenAPIClient";
|
||||
protected String shardVersion = "1.0.0";
|
||||
@Setter protected String shardName = "openapi_client";
|
||||
@Setter protected String moduleName = "OpenAPIClient";
|
||||
@Setter protected String shardVersion = "1.0.0";
|
||||
protected String specFolder = "spec";
|
||||
protected String srcFolder = "src";
|
||||
protected String shardLicense = "unlicense";
|
||||
protected String shardHomepage = "https://openapitools.org";
|
||||
protected String shardSummary = "A Crystal SDK for the REST API";
|
||||
protected String shardDescription = "This shard maps to a REST API";
|
||||
protected String shardAuthor = "";
|
||||
protected String shardAuthorEmail = "";
|
||||
@Setter protected String shardLicense = "unlicense";
|
||||
@Setter protected String shardHomepage = "https://openapitools.org";
|
||||
@Setter protected String shardSummary = "A Crystal SDK for the REST API";
|
||||
@Setter protected String shardDescription = "This shard maps to a REST API";
|
||||
@Setter protected String shardAuthor = "";
|
||||
@Setter protected String shardAuthorEmail = "";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected List<String> primitiveTypes = new ArrayList<String>();
|
||||
@ -547,42 +547,6 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
return shardName + "/" + apiPackage() + "/" + toApiFilename(name);
|
||||
}
|
||||
|
||||
public void setShardName(String shardName) {
|
||||
this.shardName = shardName;
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
public void setShardVersion(String shardVersion) {
|
||||
this.shardVersion = shardVersion;
|
||||
}
|
||||
|
||||
public void setShardDescription(String shardDescription) {
|
||||
this.shardDescription = shardDescription;
|
||||
}
|
||||
|
||||
public void setShardSummary(String shardSummary) {
|
||||
this.shardSummary = shardSummary;
|
||||
}
|
||||
|
||||
public void setShardLicense(String shardLicense) {
|
||||
this.shardLicense = shardLicense;
|
||||
}
|
||||
|
||||
public void setShardHomepage(String shardHomepage) {
|
||||
this.shardHomepage = shardHomepage;
|
||||
}
|
||||
|
||||
public void setShardAuthor(String shardAuthor) {
|
||||
this.shardAuthor = shardAuthor;
|
||||
}
|
||||
|
||||
public void setShardAuthorEmail(String shardAuthorEmail) {
|
||||
this.shardAuthorEmail = shardAuthorEmail;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
final Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
||||
|
@ -19,9 +19,10 @@ package org.openapitools.codegen.languages;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Discriminator;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -73,9 +74,12 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
private static final String CLIENT_NAME = "clientName";
|
||||
|
||||
@Getter @Setter
|
||||
private String dateLibrary;
|
||||
@Getter @Setter
|
||||
private String equalityCheckMethod;
|
||||
|
||||
@Getter @Setter
|
||||
private String clientName;
|
||||
|
||||
private TemplateManager templateManager;
|
||||
@ -137,30 +141,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
cliOptions.add(finalProperties);
|
||||
}
|
||||
|
||||
public String getDateLibrary() {
|
||||
return dateLibrary;
|
||||
}
|
||||
|
||||
public void setDateLibrary(String library) {
|
||||
this.dateLibrary = library;
|
||||
}
|
||||
|
||||
public String getEqualityCheckMethod() {
|
||||
return equalityCheckMethod;
|
||||
}
|
||||
|
||||
public void setEqualityCheckMethod(String equalityCheckMethod) {
|
||||
this.equalityCheckMethod = equalityCheckMethod;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "dart-dio";
|
||||
@ -790,13 +770,13 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
final boolean isArray;
|
||||
|
||||
final boolean uniqueItems;
|
||||
@Getter final boolean uniqueItems;
|
||||
|
||||
final boolean isMap;
|
||||
|
||||
final boolean isNullable;
|
||||
|
||||
final String dataType;
|
||||
@Getter final String dataType;
|
||||
|
||||
private BuiltValueSerializer(boolean isArray, boolean uniqueItems, boolean isMap, boolean isNullable, String dataType) {
|
||||
this.isArray = isArray;
|
||||
@ -810,10 +790,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
return isArray;
|
||||
}
|
||||
|
||||
public boolean isUniqueItems() {
|
||||
return uniqueItems;
|
||||
}
|
||||
|
||||
public boolean isMap() {
|
||||
return isMap;
|
||||
}
|
||||
@ -822,10 +798,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
return isNullable;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
@ -34,8 +35,8 @@ public class EiffelClientCodegen extends AbstractEiffelCodegen {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(EiffelClientCodegen.class);
|
||||
|
||||
protected String libraryTarget = "openapi_eiffel_client";
|
||||
protected String packageName = "Eiffel";
|
||||
protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageName = "Eiffel";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs";
|
||||
protected String modelDocPath = "docs";
|
||||
protected String modelPath = "domain";
|
||||
@ -170,10 +171,12 @@ public class EiffelClientCodegen extends AbstractEiffelCodegen {
|
||||
return outputFolder + File.separator + "src" + File.separator + "api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator + "src" + File.separator + modelPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return outputFolder + File.separator + "test" + File.separator + "apis";
|
||||
}
|
||||
@ -188,14 +191,6 @@ public class EiffelClientCodegen extends AbstractEiffelCodegen {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
|
@ -21,9 +21,10 @@ import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
@ -50,7 +51,7 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_@\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-)\\z");
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected String moduleName;
|
||||
@Setter protected String moduleName;
|
||||
protected static final String defaultModuleName = "OpenAPI.Client";
|
||||
|
||||
// This is the name of elixir project name;
|
||||
@ -699,7 +700,7 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
|
||||
}
|
||||
|
||||
class ExtendedCodegenOperation extends CodegenOperation {
|
||||
@Getter @Setter class ExtendedCodegenOperation extends CodegenOperation {
|
||||
private List<String> pathTemplateNames = new ArrayList<>();
|
||||
private String replacedPathName;
|
||||
|
||||
@ -762,22 +763,6 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
this.operationIdCamelCase = o.operationIdCamelCase;
|
||||
}
|
||||
|
||||
public List<String> getPathTemplateNames() {
|
||||
return pathTemplateNames;
|
||||
}
|
||||
|
||||
public void setPathTemplateNames(List<String> pathTemplateNames) {
|
||||
this.pathTemplateNames = pathTemplateNames;
|
||||
}
|
||||
|
||||
public String getReplacedPathName() {
|
||||
return replacedPathName;
|
||||
}
|
||||
|
||||
public void setReplacedPathName(String replacedPathName) {
|
||||
this.replacedPathName = replacedPathName;
|
||||
}
|
||||
|
||||
private void translateBaseType(StringBuilder returnEntry, String baseType) {
|
||||
switch (baseType) {
|
||||
case "AnyType":
|
||||
@ -996,10 +981,6 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
return input;
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.ELIXIR; }
|
||||
|
||||
|
@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Mustache.Lambda;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -52,6 +51,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String packageName = "openapi";
|
||||
protected String packageVersion = "1.0.0";
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
@ -61,6 +61,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return "elm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates an Elm client library.";
|
||||
}
|
||||
@ -273,6 +274,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"static-method", "unchecked"})
|
||||
public Map<String, ModelsMap> postProcessAllModels(final Map<String, ModelsMap> orgObjs) {
|
||||
final Map<String, ModelsMap> objs = super.postProcessAllModels(orgObjs);
|
||||
@ -403,6 +405,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
static class ParameterSorter implements Comparator<CodegenParameter> {
|
||||
@Override
|
||||
public int compare(final CodegenParameter p1, final CodegenParameter p2) {
|
||||
return index(p1) - index(p2);
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ package org.openapitools.codegen.languages;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -42,18 +44,21 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(ErlangClientCodegen.class);
|
||||
|
||||
protected String packageName = "openapi";
|
||||
protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageName = "openapi";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String sourceFolder = "src";
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "erlang-client";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates an Erlang client library (beta).";
|
||||
}
|
||||
@ -347,14 +352,6 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return objs;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of required parameters plus 1.
|
||||
*
|
||||
@ -397,7 +394,9 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
|
||||
class ExtendedCodegenOperation extends CodegenOperation {
|
||||
@Getter @Setter
|
||||
private List<String> pathTemplateNames = new ArrayList<String>();
|
||||
@Getter @Setter
|
||||
private String replacedPathName;
|
||||
String arityRequired;
|
||||
String arityOptional;
|
||||
@ -463,21 +462,6 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
this.operationIdCamelCase = o.operationIdCamelCase;
|
||||
}
|
||||
|
||||
public List<String> getPathTemplateNames() {
|
||||
return pathTemplateNames;
|
||||
}
|
||||
|
||||
public void setPathTemplateNames(List<String> pathTemplateNames) {
|
||||
this.pathTemplateNames = pathTemplateNames;
|
||||
}
|
||||
|
||||
public String getReplacedPathName() {
|
||||
return replacedPathName;
|
||||
}
|
||||
|
||||
public void setReplacedPathName(String replacedPathName) {
|
||||
this.replacedPathName = replacedPathName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,8 +18,9 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -43,19 +44,22 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
public class ErlangProperCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(ErlangProperCodegen.class);
|
||||
|
||||
protected String packageName = "openapi";
|
||||
protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageName = "openapi";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String sourceFolder = "src";
|
||||
protected String modelFolder = "model";
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "erlang-proper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates an Erlang library with PropEr generators (beta).";
|
||||
}
|
||||
@ -399,14 +403,6 @@ public class ErlangProperCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return objs;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
String length(Object os) {
|
||||
int l = 1;
|
||||
for (CodegenParameter o : ((ExtendedCodegenOperation) os).allParams) {
|
||||
@ -499,6 +495,7 @@ public class ErlangProperCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
|
||||
class ExtendedCodegenOperation extends CodegenOperation {
|
||||
@Getter @Setter
|
||||
private String replacedPathName;
|
||||
String arity;
|
||||
|
||||
@ -560,13 +557,6 @@ public class ErlangProperCodegen extends DefaultCodegen implements CodegenConfig
|
||||
this.operationIdCamelCase = o.operationIdCamelCase;
|
||||
}
|
||||
|
||||
public String getReplacedPathName() {
|
||||
return replacedPathName;
|
||||
}
|
||||
|
||||
public void setReplacedPathName(String replacedPathName) {
|
||||
this.replacedPathName = replacedPathName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
@ -40,8 +41,8 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected String apiPath = "src";
|
||||
protected String packageName = "openapi";
|
||||
protected String openApiSpecName = "openapi";
|
||||
@Setter protected String packageName = "openapi";
|
||||
@Setter protected String openApiSpecName = "openapi";
|
||||
|
||||
public ErlangServerCodegen() {
|
||||
super();
|
||||
@ -289,14 +290,6 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return super.postProcessSupportingFileData(objs);
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setOpenApiSpecName(String openApiSpecName) {
|
||||
this.openApiSpecName = openApiSpecName;
|
||||
}
|
||||
|
||||
protected String toHandlerName(String name) {
|
||||
return toModuleName(name) + "_handler";
|
||||
}
|
||||
|
@ -31,14 +31,17 @@ public class FsharpFunctionsServerCodegen extends AbstractFSharpCodegen {
|
||||
|
||||
final Logger LOGGER = LoggerFactory.getLogger(FsharpFunctionsServerCodegen.class);
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "fsharp-functions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a fsharp-functions server (beta).";
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.openapitools.codegen.languages;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
@ -47,7 +48,7 @@ public class FsharpGiraffeServerCodegen extends AbstractFSharpCodegen {
|
||||
public static final String SDK_WEB = "Microsoft.NET.Sdk.Web";
|
||||
public static final String SDK_LIB = "Microsoft.NET.Sdk";
|
||||
|
||||
private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
@Setter private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(FsharpGiraffeServerCodegen.class);
|
||||
@ -211,10 +212,6 @@ public class FsharpGiraffeServerCodegen extends AbstractFSharpCodegen {
|
||||
LOGGER.warn("Swashbuckle flag not currently supported, this will be ignored.");
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
this.packageGuid = packageGuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return super.modelFileFolder().replace("Model", "model");
|
||||
|
@ -19,9 +19,9 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
@ -37,8 +37,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
@ -47,7 +45,7 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
public class GoClientCodegen extends AbstractGoCodegen {
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(GoClientCodegen.class);
|
||||
protected String packageVersion = "1.0.0";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected String modelFileFolder = null;
|
||||
@ -57,9 +55,9 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
public static final String GENERATE_INTERFACES = "generateInterfaces";
|
||||
public static final String MODEL_FILE_FOLDER = "modelFileFolder";
|
||||
public static final String WITH_GO_MOD = "withGoMod";
|
||||
protected String goImportAlias = "openapiclient";
|
||||
@Setter protected String goImportAlias = "openapiclient";
|
||||
protected boolean isGoSubmodule = false;
|
||||
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
|
||||
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
|
||||
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
@ -169,7 +167,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
* Configures the type of generator.
|
||||
*
|
||||
* @return the CodegenType for this generator
|
||||
* @see org.openapitools.codegen.CodegenType
|
||||
* @see CodegenType
|
||||
*/
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
@ -312,22 +310,10 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
supportingFiles.add(new SupportingFile("utils.mustache", "", "utils.go"));
|
||||
}
|
||||
|
||||
public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) {
|
||||
this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
||||
public boolean getUseOneOfDiscriminatorLookup() {
|
||||
return this.useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
||||
public void setGoImportAlias(String goImportAlias) {
|
||||
this.goImportAlias = goImportAlias;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
public void setIsGoSubmodule(boolean isGoSubmodule) {
|
||||
this.isGoSubmodule = isGoSubmodule;
|
||||
}
|
||||
@ -374,12 +360,6 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toModelName(String name) {
|
||||
if (schemaKeyToModelNameCache.containsKey(name)) {
|
||||
@ -392,6 +372,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
return camelizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
if (this.reservedWordsMappings().containsKey(name)) {
|
||||
return this.reservedWordsMappings().get(name);
|
||||
@ -424,7 +405,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
/**
|
||||
* Determines if at least one of the allOf pieces of a schema are of type string
|
||||
*
|
||||
* @param p
|
||||
* @param schema
|
||||
* @return
|
||||
*/
|
||||
private boolean isAllOfStringSchema(Schema schema) {
|
||||
|
@ -28,7 +28,6 @@ import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GoEchoServerCodegen extends AbstractGoCodegen {
|
||||
protected String apiVersion = "1.0.0";
|
||||
@ -40,14 +39,17 @@ public class GoEchoServerCodegen extends AbstractGoCodegen {
|
||||
private static final String API_PACKAGE_NAME = "handlers";
|
||||
private static final String OUTPUT_PATH = "generated-code" + File.separator + "go-echo-server";
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "go-echo-server";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a go-echo server. (Beta)";
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
@ -32,7 +33,6 @@ import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GoGinServerCodegen extends AbstractGoCodegen {
|
||||
|
||||
@ -40,7 +40,7 @@ public class GoGinServerCodegen extends AbstractGoCodegen {
|
||||
|
||||
public static final String INTERFACE_ONLY = "interfaceOnly";
|
||||
|
||||
protected boolean interfaceOnly = false;
|
||||
@Setter protected boolean interfaceOnly = false;
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected int serverPort = 8080;
|
||||
@ -209,10 +209,6 @@ public class GoGinServerCodegen extends AbstractGoCodegen {
|
||||
supportingFiles.add(new SupportingFile("go.mod.mustache", "go.mod"));
|
||||
}
|
||||
|
||||
public void setInterfaceOnly(boolean interfaceOnly) {
|
||||
this.interfaceOnly = interfaceOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiPackage() {
|
||||
return apiPath;
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
@ -52,14 +53,14 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(GoServerCodegen.class);
|
||||
|
||||
protected String packageVersion = "1.0.0";
|
||||
protected int serverPort = 8080;
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
@Setter protected int serverPort = 8080;
|
||||
protected String projectName = "openapi-server";
|
||||
protected String sourceFolder = "go";
|
||||
@Setter protected String sourceFolder = "go";
|
||||
protected Boolean corsFeatureEnabled = false;
|
||||
protected Boolean addResponseHeaders = false;
|
||||
protected Boolean outputAsLibrary = false;
|
||||
protected Boolean onlyInterfaces = false;
|
||||
@Setter protected Boolean addResponseHeaders = false;
|
||||
@Setter protected Boolean outputAsLibrary = false;
|
||||
@Setter protected Boolean onlyInterfaces = false;
|
||||
|
||||
|
||||
public GoServerCodegen() {
|
||||
@ -474,32 +475,8 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
||||
return outputFolder + File.separator + apiPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public void setPackageVersion(String packageVersion) {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
public void setServerPort(int serverPort) {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
public void setFeatureCORS(Boolean featureCORS) {
|
||||
this.corsFeatureEnabled = featureCORS;
|
||||
}
|
||||
|
||||
public void setAddResponseHeaders(Boolean addResponseHeaders) {
|
||||
this.addResponseHeaders = addResponseHeaders;
|
||||
}
|
||||
|
||||
public void setOnlyInterfaces(Boolean onlyInterfaces) {
|
||||
this.onlyInterfaces = onlyInterfaces;
|
||||
}
|
||||
|
||||
public void setOutputAsLibrary(Boolean outputAsLibrary) {
|
||||
this.outputAsLibrary = outputAsLibrary;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -32,10 +32,12 @@ public class GraphQLSchemaCodegen extends AbstractGraphQLCodegen implements Code
|
||||
return CodegenType.SCHEMA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "graphql-schema";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates GraphQL schema files (beta)";
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.ClientModificationFeature;
|
||||
@ -154,11 +153,6 @@ public class GroovyClientCodegen extends AbstractJavaCodegen {
|
||||
return input.replace("'", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("*/", "*_/").replace("/*", "/_*");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.GROOVY; }
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
@ -147,14 +146,17 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
|
||||
final private static Pattern CONTAINS_JSON_MIME_PATTERN = Pattern.compile("(?i)application/.*json(;.*)?");
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "haskell-http-client";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a Haskell http-client library.";
|
||||
}
|
||||
@ -1214,6 +1216,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
return toTypeName("Model", name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiName(String name) {
|
||||
if (name.length() == 0) {
|
||||
return "Default";
|
||||
@ -1434,6 +1437,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
}
|
||||
|
||||
// override with any special text escaping logic
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String escapeText(String input) {
|
||||
if (input == null) {
|
||||
|
@ -19,7 +19,6 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
@ -59,6 +58,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
*
|
||||
* @return the CodegenType for this generator
|
||||
*/
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
@ -69,6 +69,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
*
|
||||
* @return the friendly name for the generator
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "haskell";
|
||||
}
|
||||
@ -79,6 +80,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
*
|
||||
* @return A string value for the help message
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a Haskell server and client library.";
|
||||
}
|
||||
|
@ -19,9 +19,10 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -49,37 +50,26 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(HaskellYesodServerCodegen.class);
|
||||
|
||||
@Getter @Setter
|
||||
protected String projectName;
|
||||
@Getter @Setter
|
||||
protected String apiModuleName;
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "haskell-yesod";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a haskell-yesod server.";
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getApiModuleName() {
|
||||
return apiModuleName;
|
||||
}
|
||||
|
||||
public void setApiModuleName(String apiModuleName) {
|
||||
this.apiModuleName = apiModuleName;
|
||||
}
|
||||
|
||||
public HaskellYesodServerCodegen() {
|
||||
super();
|
||||
|
||||
|
@ -20,7 +20,6 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
|
@ -18,6 +18,8 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
||||
@ -45,17 +47,17 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
|
||||
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
|
||||
|
||||
protected boolean useBeanValidation = false;
|
||||
@Getter protected boolean useBeanValidation = false;
|
||||
|
||||
protected boolean useGenericResponse = false;
|
||||
@Getter protected boolean useGenericResponse = false;
|
||||
|
||||
protected boolean useGzipFeatureForTests = false;
|
||||
@Getter protected boolean useGzipFeatureForTests = false;
|
||||
|
||||
protected boolean useLoggingFeatureForTests = false;
|
||||
@Getter protected boolean useLoggingFeatureForTests = false;
|
||||
|
||||
private boolean useJackson = false;
|
||||
@Getter private boolean useJackson = false;
|
||||
|
||||
protected boolean useAbstractionForFiles = false;
|
||||
@Setter protected boolean useAbstractionForFiles = false;
|
||||
|
||||
public JavaCXFClientCodegen() {
|
||||
super();
|
||||
@ -193,42 +195,19 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
public boolean isUseBeanValidation() {
|
||||
return useBeanValidation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests) {
|
||||
this.useGzipFeatureForTests = useGzipFeatureForTests;
|
||||
}
|
||||
|
||||
public boolean isUseGzipFeatureForTests() {
|
||||
return useGzipFeatureForTests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests) {
|
||||
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
|
||||
}
|
||||
|
||||
public boolean isUseLoggingFeatureForTests() {
|
||||
return useLoggingFeatureForTests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseGenericResponse(boolean useGenericResponse) {
|
||||
this.useGenericResponse = useGenericResponse;
|
||||
}
|
||||
|
||||
public boolean isUseGenericResponse() {
|
||||
return useGenericResponse;
|
||||
}
|
||||
|
||||
public boolean isUseJackson() {
|
||||
return useJackson;
|
||||
}
|
||||
|
||||
public void setUseAbstractionForFiles(boolean useAbstractionForFiles) {
|
||||
this.useAbstractionForFiles = useAbstractionForFiles;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
@ -312,19 +313,19 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
|
||||
|
||||
private final Map<String, Generex> REGEX_GENERATORS = new HashMap<>();
|
||||
|
||||
protected boolean generateOperationBody = false;
|
||||
@Setter protected boolean generateOperationBody = false;
|
||||
|
||||
protected boolean loadTestDataFromFile = false;
|
||||
@Setter protected boolean loadTestDataFromFile = false;
|
||||
|
||||
protected boolean supportMultipleSpringServices = false;
|
||||
@Setter protected boolean supportMultipleSpringServices = false;
|
||||
|
||||
protected JsonCache testDataCache = null;
|
||||
|
||||
protected JsonCache testDataControlCache = null;
|
||||
|
||||
protected File testDataFile = null;
|
||||
@Setter protected File testDataFile = null;
|
||||
|
||||
protected File testDataControlFile = null;
|
||||
@Setter protected File testDataControlFile = null;
|
||||
|
||||
public JavaCXFExtServerCodegen() {
|
||||
super();
|
||||
@ -1403,26 +1404,6 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
|
||||
}
|
||||
}
|
||||
|
||||
public void setGenerateOperationBody(boolean generateOperationBody) {
|
||||
this.generateOperationBody = generateOperationBody;
|
||||
}
|
||||
|
||||
public void setLoadTestDataFromFile(boolean loadTestDataFromFile) {
|
||||
this.loadTestDataFromFile = loadTestDataFromFile;
|
||||
}
|
||||
|
||||
public void setSupportMultipleSpringServices(boolean supportMultipleSpringServices) {
|
||||
this.supportMultipleSpringServices = supportMultipleSpringServices;
|
||||
}
|
||||
|
||||
public void setTestDataControlFile(File testDataControlFile) {
|
||||
this.testDataControlFile = testDataControlFile;
|
||||
}
|
||||
|
||||
public void setTestDataFile(File testDataFile) {
|
||||
this.testDataFile = testDataFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema p) {
|
||||
if (ModelUtils.isGenerateAliasAsModel(p) && StringUtils.isNotEmpty(p.get$ref())) {
|
||||
|
@ -17,8 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.Setter;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.CXFServerFeatures;
|
||||
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
||||
@ -26,7 +25,6 @@ import org.openapitools.codegen.languages.features.LoggingTestFeatures;
|
||||
import org.openapitools.codegen.languages.features.UseGenericResponseFeatures;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
import org.openapitools.codegen.model.OperationsMap;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -39,41 +37,41 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
|
||||
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
|
||||
|
||||
protected boolean addConsumesProducesJson = true;
|
||||
@Setter protected boolean addConsumesProducesJson = true;
|
||||
|
||||
protected boolean generateSpringApplication = false;
|
||||
@Setter protected boolean generateSpringApplication = false;
|
||||
|
||||
protected boolean useSpringAnnotationConfig = false;
|
||||
@Setter protected boolean useSpringAnnotationConfig = false;
|
||||
|
||||
protected boolean useSwaggerFeature = false;
|
||||
@Setter protected boolean useSwaggerFeature = false;
|
||||
|
||||
protected boolean useSwaggerUI = false;
|
||||
@Setter protected boolean useSwaggerUI = false;
|
||||
|
||||
protected boolean useWadlFeature = false;
|
||||
@Setter protected boolean useWadlFeature = false;
|
||||
|
||||
protected boolean useMultipartFeature = false;
|
||||
@Setter protected boolean useMultipartFeature = false;
|
||||
|
||||
protected boolean useBeanValidationFeature = false;
|
||||
@Setter protected boolean useBeanValidationFeature = false;
|
||||
|
||||
protected boolean generateSpringBootApplication = false;
|
||||
@Setter protected boolean generateSpringBootApplication = false;
|
||||
|
||||
protected boolean generateJbossDeploymentDescriptor = false;
|
||||
@Setter protected boolean generateJbossDeploymentDescriptor = false;
|
||||
|
||||
protected boolean useGzipFeature = false;
|
||||
@Setter protected boolean useGzipFeature = false;
|
||||
|
||||
protected boolean useGzipFeatureForTests = false;
|
||||
@Setter protected boolean useGzipFeatureForTests = false;
|
||||
|
||||
protected boolean useLoggingFeature = false;
|
||||
@Setter protected boolean useLoggingFeature = false;
|
||||
|
||||
protected boolean useLoggingFeatureForTests = false;
|
||||
@Setter protected boolean useLoggingFeatureForTests = false;
|
||||
|
||||
protected boolean useAnnotatedBasePath = false;
|
||||
@Setter protected boolean useAnnotatedBasePath = false;
|
||||
|
||||
protected boolean generateNonSpringApplication = false;
|
||||
@Setter protected boolean generateNonSpringApplication = false;
|
||||
|
||||
protected boolean useGenericResponse = false;
|
||||
@Setter protected boolean useGenericResponse = false;
|
||||
|
||||
protected boolean useAbstractionForFiles = false;
|
||||
@Setter protected boolean useAbstractionForFiles = false;
|
||||
|
||||
public JavaCXFServerCodegen() {
|
||||
super();
|
||||
@ -276,81 +274,5 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
return "Generates a Java JAXRS Server application based on Apache CXF framework.";
|
||||
}
|
||||
|
||||
public void setGenerateSpringApplication(boolean generateSpringApplication) {
|
||||
this.generateSpringApplication = generateSpringApplication;
|
||||
}
|
||||
|
||||
public void setUseSpringAnnotationConfig(boolean useSpringAnnotationConfig) {
|
||||
this.useSpringAnnotationConfig = useSpringAnnotationConfig;
|
||||
}
|
||||
|
||||
public void setUseSwaggerFeature(boolean useSwaggerFeature) {
|
||||
this.useSwaggerFeature = useSwaggerFeature;
|
||||
}
|
||||
|
||||
|
||||
public void setUseWadlFeature(boolean useWadlFeature) {
|
||||
this.useWadlFeature = useWadlFeature;
|
||||
}
|
||||
|
||||
|
||||
public void setUseMultipartFeature(boolean useMultipartFeature) {
|
||||
this.useMultipartFeature = useMultipartFeature;
|
||||
}
|
||||
|
||||
|
||||
public void setUseGzipFeature(boolean useGzipFeature) {
|
||||
this.useGzipFeature = useGzipFeature;
|
||||
}
|
||||
|
||||
|
||||
public void setUseLoggingFeature(boolean useLoggingFeature) {
|
||||
this.useLoggingFeature = useLoggingFeature;
|
||||
}
|
||||
|
||||
|
||||
public void setUseBeanValidationFeature(boolean useBeanValidationFeature) {
|
||||
this.useBeanValidationFeature = useBeanValidationFeature;
|
||||
}
|
||||
|
||||
public void setGenerateSpringBootApplication(boolean generateSpringBootApplication) {
|
||||
this.generateSpringBootApplication = generateSpringBootApplication;
|
||||
}
|
||||
|
||||
public void setGenerateJbossDeploymentDescriptor(boolean generateJbossDeploymentDescriptor) {
|
||||
this.generateJbossDeploymentDescriptor = generateJbossDeploymentDescriptor;
|
||||
}
|
||||
|
||||
public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests) {
|
||||
this.useGzipFeatureForTests = useGzipFeatureForTests;
|
||||
}
|
||||
|
||||
public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests) {
|
||||
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
|
||||
}
|
||||
|
||||
public void setUseSwaggerUI(boolean useSwaggerUI) {
|
||||
this.useSwaggerUI = useSwaggerUI;
|
||||
}
|
||||
|
||||
public void setAddConsumesProducesJson(boolean addConsumesProducesJson) {
|
||||
this.addConsumesProducesJson = addConsumesProducesJson;
|
||||
}
|
||||
|
||||
public void setUseAnnotatedBasePath(boolean useAnnotatedBasePath) {
|
||||
this.useAnnotatedBasePath = useAnnotatedBasePath;
|
||||
}
|
||||
|
||||
public void setGenerateNonSpringApplication(boolean generateNonSpringApplication) {
|
||||
this.generateNonSpringApplication = generateNonSpringApplication;
|
||||
}
|
||||
|
||||
public void setUseGenericResponse(boolean useGenericResponse) {
|
||||
this.useGenericResponse = useGenericResponse;
|
||||
}
|
||||
|
||||
public void setUseAbstractionForFiles(boolean useAbstractionForFiles) {
|
||||
this.useAbstractionForFiles = useAbstractionForFiles;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.OptionalFeatures;
|
||||
@ -58,14 +57,12 @@ public class JavaCamelServerCodegen extends SpringCodegen implements BeanValidat
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(JavaCamelServerCodegen.class);
|
||||
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "java-camel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a Java Camel server (beta).";
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
@ -110,39 +113,45 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
protected boolean useRxJava3 = false;
|
||||
// backwards compatibility for openapi configs that specify neither rx1 nor rx2
|
||||
// (mustache does not allow for boolean operators so we need this extra field)
|
||||
protected boolean doNotUseRx = true;
|
||||
protected boolean usePlayWS = false;
|
||||
protected String microprofileFramework = MICROPROFILE_DEFAULT;
|
||||
protected boolean microprofileMutiny = false;
|
||||
protected String configKey = null;
|
||||
protected boolean configKeyFromClassName = false;
|
||||
@Setter protected boolean doNotUseRx = true;
|
||||
@Setter protected boolean usePlayWS = false;
|
||||
@Setter protected String microprofileFramework = MICROPROFILE_DEFAULT;
|
||||
@Setter protected boolean microprofileMutiny = false;
|
||||
@Setter protected String configKey = null;
|
||||
@Setter(AccessLevel.PRIVATE) protected boolean configKeyFromClassName = false;
|
||||
|
||||
protected boolean asyncNative = false;
|
||||
protected boolean parcelableModel = false;
|
||||
protected boolean useBeanValidation = false;
|
||||
protected boolean performBeanValidation = false;
|
||||
protected boolean useGzipFeature = false;
|
||||
protected boolean useRuntimeException = false;
|
||||
protected boolean useReflectionEqualsHashCode = false;
|
||||
@Setter protected boolean asyncNative = false;
|
||||
@Setter protected boolean parcelableModel = false;
|
||||
@Setter protected boolean useBeanValidation = false;
|
||||
@Setter protected boolean performBeanValidation = false;
|
||||
@Setter protected boolean useGzipFeature = false;
|
||||
@Setter protected boolean useRuntimeException = false;
|
||||
@Setter protected boolean useReflectionEqualsHashCode = false;
|
||||
protected boolean caseInsensitiveResponseHeaders = false;
|
||||
protected boolean useAbstractionForFiles = false;
|
||||
protected boolean dynamicOperations = false;
|
||||
protected boolean supportStreaming = false;
|
||||
protected boolean withAWSV4Signature = false;
|
||||
protected String gradleProperties;
|
||||
protected String errorObjectType;
|
||||
@Setter protected boolean useAbstractionForFiles = false;
|
||||
@Setter protected boolean dynamicOperations = false;
|
||||
@Setter protected boolean supportStreaming = false;
|
||||
@Setter protected boolean withAWSV4Signature = false;
|
||||
@Setter protected String gradleProperties;
|
||||
@Setter protected String errorObjectType;
|
||||
protected String authFolder;
|
||||
protected String serializationLibrary = null;
|
||||
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Serialization library.
|
||||
*
|
||||
* @return 'gson' or 'jackson'
|
||||
*/
|
||||
@Getter protected String serializationLibrary = null;
|
||||
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
protected String rootJavaEEPackage;
|
||||
protected Map<String, MpRestClientVersion> mpRestClientVersions = new LinkedHashMap<>();
|
||||
protected boolean useSingleRequestParameter = false;
|
||||
@Setter(AccessLevel.PRIVATE) protected boolean useSingleRequestParameter = false;
|
||||
protected boolean webclientBlockingOperations = false;
|
||||
protected boolean generateClientAsBean = false;
|
||||
protected boolean useEnumCaseInsensitive = false;
|
||||
@Setter protected boolean generateClientAsBean = false;
|
||||
@Setter protected boolean useEnumCaseInsensitive = false;
|
||||
|
||||
protected int maxAttemptsForRetry = 1;
|
||||
protected long waitTimeMillis = 10l;
|
||||
@Setter protected int maxAttemptsForRetry = 1;
|
||||
@Setter protected long waitTimeMillis = 10l;
|
||||
|
||||
private static class MpRestClientVersion {
|
||||
public final String rootPackage;
|
||||
@ -1172,10 +1181,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) {
|
||||
this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
||||
public boolean getUseOneOfDiscriminatorLookup() {
|
||||
return this.useOneOfDiscriminatorLookup;
|
||||
}
|
||||
@ -1184,10 +1189,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
return useSingleRequestParameter;
|
||||
}
|
||||
|
||||
private void setUseSingleRequestParameter(boolean useSingleRequestParameter) {
|
||||
this.useSingleRequestParameter = useSingleRequestParameter;
|
||||
}
|
||||
|
||||
public void setUseRxJava(boolean useRxJava) {
|
||||
this.useRxJava = useRxJava;
|
||||
doNotUseRx = false;
|
||||
@ -1203,107 +1204,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
doNotUseRx = false;
|
||||
}
|
||||
|
||||
public void setDoNotUseRx(boolean doNotUseRx) {
|
||||
this.doNotUseRx = doNotUseRx;
|
||||
}
|
||||
|
||||
public void setUsePlayWS(boolean usePlayWS) {
|
||||
this.usePlayWS = usePlayWS;
|
||||
}
|
||||
|
||||
public void setAsyncNative(boolean asyncNative) {
|
||||
this.asyncNative = asyncNative;
|
||||
}
|
||||
|
||||
public void setMicroprofileFramework(String microprofileFramework) {
|
||||
this.microprofileFramework = microprofileFramework;
|
||||
}
|
||||
|
||||
public void setMicroprofileMutiny(boolean microprofileMutiny) {
|
||||
this.microprofileMutiny = microprofileMutiny;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public void setParcelableModel(boolean parcelableModel) {
|
||||
this.parcelableModel = parcelableModel;
|
||||
}
|
||||
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
public void setPerformBeanValidation(boolean performBeanValidation) {
|
||||
this.performBeanValidation = performBeanValidation;
|
||||
}
|
||||
|
||||
public void setUseGzipFeature(boolean useGzipFeature) {
|
||||
this.useGzipFeature = useGzipFeature;
|
||||
}
|
||||
|
||||
public void setUseRuntimeException(boolean useRuntimeException) {
|
||||
this.useRuntimeException = useRuntimeException;
|
||||
}
|
||||
|
||||
public void setUseReflectionEqualsHashCode(boolean useReflectionEqualsHashCode) {
|
||||
this.useReflectionEqualsHashCode = useReflectionEqualsHashCode;
|
||||
}
|
||||
|
||||
public void setCaseInsensitiveResponseHeaders(final Boolean caseInsensitiveResponseHeaders) {
|
||||
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
|
||||
}
|
||||
|
||||
public void setUseAbstractionForFiles(boolean useAbstractionForFiles) {
|
||||
this.useAbstractionForFiles = useAbstractionForFiles;
|
||||
}
|
||||
|
||||
public void setDynamicOperations(final boolean dynamicOperations) {
|
||||
this.dynamicOperations = dynamicOperations;
|
||||
}
|
||||
|
||||
public void setSupportStreaming(final boolean supportStreaming) {
|
||||
this.supportStreaming = supportStreaming;
|
||||
}
|
||||
|
||||
public void setWithAWSV4Signature(boolean withAWSV4Signature) {
|
||||
this.withAWSV4Signature = withAWSV4Signature;
|
||||
}
|
||||
|
||||
public void setGradleProperties(final String gradleProperties) {
|
||||
this.gradleProperties = gradleProperties;
|
||||
}
|
||||
|
||||
public void setErrorObjectType(final String errorObjectType) {
|
||||
this.errorObjectType = errorObjectType;
|
||||
}
|
||||
|
||||
public void setGenerateClientAsBean(boolean generateClientAsBean) {
|
||||
this.generateClientAsBean = generateClientAsBean;
|
||||
}
|
||||
|
||||
public void setUseEnumCaseInsensitive(boolean useEnumCaseInsensitive) {
|
||||
this.useEnumCaseInsensitive = useEnumCaseInsensitive;
|
||||
}
|
||||
|
||||
public void setMaxAttemptsForRetry(int maxAttemptsForRetry) {
|
||||
this.maxAttemptsForRetry = maxAttemptsForRetry;
|
||||
}
|
||||
|
||||
public void setWaitTimeMillis(long waitTimeMillis) {
|
||||
this.waitTimeMillis = waitTimeMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialization library.
|
||||
*
|
||||
* @return 'gson' or 'jackson'
|
||||
*/
|
||||
public String getSerializationLibrary() {
|
||||
return serializationLibrary;
|
||||
}
|
||||
|
||||
public void setSerializationLibrary(String serializationLibrary) {
|
||||
if (SERIALIZATION_LIBRARY_JACKSON.equalsIgnoreCase(serializationLibrary)) {
|
||||
this.serializationLibrary = SERIALIZATION_LIBRARY_JACKSON;
|
||||
@ -1331,10 +1235,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
return super.postProcessSupportingFileData(objs);
|
||||
}
|
||||
|
||||
private void setConfigKeyFromClassName(boolean configKeyFromClassName) {
|
||||
this.configKeyFromClassName = configKeyFromClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiVarName(String name) {
|
||||
String apiVarName = super.toApiVarName(name);
|
||||
|
@ -33,6 +33,8 @@ import java.util.TreeSet;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
@ -65,14 +67,14 @@ public class JavaHelidonClientCodegen extends JavaHelidonCommonCodegen {
|
||||
private static final String X_HELIDON_IMPL_IMPORTS = "x-helidon-implImports";
|
||||
public static final String CONFIG_KEY = "configKey";
|
||||
|
||||
protected String configKey = null;
|
||||
protected boolean useBeanValidation = false;
|
||||
protected boolean performBeanValidation = false;
|
||||
protected boolean useGzipFeature = false;
|
||||
@Setter protected String configKey = null;
|
||||
@Setter protected boolean useBeanValidation = false;
|
||||
@Setter protected boolean performBeanValidation = false;
|
||||
@Setter protected boolean useGzipFeature = false;
|
||||
protected boolean caseInsensitiveResponseHeaders = false;
|
||||
protected Path invokerFolder;
|
||||
protected Path apiFolder;
|
||||
protected String serializationLibrary = null;
|
||||
@Getter protected String serializationLibrary = null;
|
||||
|
||||
/**
|
||||
* Constructor for this generator. Uses the embedded template dir to find common templates
|
||||
@ -460,30 +462,10 @@ public class JavaHelidonClientCodegen extends JavaHelidonCommonCodegen {
|
||||
return objs;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
public void setPerformBeanValidation(boolean performBeanValidation) {
|
||||
this.performBeanValidation = performBeanValidation;
|
||||
}
|
||||
|
||||
public void setUseGzipFeature(boolean useGzipFeature) {
|
||||
this.useGzipFeature = useGzipFeature;
|
||||
}
|
||||
|
||||
public void setCaseInsensitiveResponseHeaders(final Boolean caseInsensitiveResponseHeaders) {
|
||||
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
|
||||
}
|
||||
|
||||
public String getSerializationLibrary() {
|
||||
return serializationLibrary;
|
||||
}
|
||||
|
||||
public void setSerializationLibrary(String serializationLibrary) {
|
||||
if (SERIALIZATION_LIBRARY_JACKSON.equalsIgnoreCase(serializationLibrary)) {
|
||||
this.serializationLibrary = SERIALIZATION_LIBRARY_JACKSON;
|
||||
|
@ -29,6 +29,7 @@ import java.util.Map;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.Getter;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
@ -56,7 +57,7 @@ public class JavaHelidonServerCodegen extends JavaHelidonCommonCodegen {
|
||||
|
||||
protected boolean useBeanValidation = true;
|
||||
protected String implFolder = "src/main/java";
|
||||
protected String serializationLibrary = null;
|
||||
@Getter protected String serializationLibrary = null;
|
||||
|
||||
private boolean useAbstractClass = false;
|
||||
private boolean gradleProject = false;
|
||||
@ -385,10 +386,6 @@ public class JavaHelidonServerCodegen extends JavaHelidonCommonCodegen {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
public String getSerializationLibrary() {
|
||||
return serializationLibrary;
|
||||
}
|
||||
|
||||
public void setSerializationLibrary(String serializationLibrary) {
|
||||
if (SERIALIZATION_LIBRARY_JACKSON.equalsIgnoreCase(serializationLibrary)) {
|
||||
this.serializationLibrary = SERIALIZATION_LIBRARY_JACKSON;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user