mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 02:25:20 +00:00
[core] cleanup: remove OpenAPI parameter from CodegenConfig methods (#1953)
* Add OpenAPI parameter to DefaultCodegen#toDefaultValue(..) * Remove CodegenConfig#fromOperation() * Remove allDefinitions parameter from fromModel(..) * Remove definitions parameter from CodegenConfig#fromOperation(..) * remove schemas parameter from DefaultCodegen#fromRequestBody(..) * remove schemas parameter from DefaultCodegen#fromCallback(..) * Remove openAPI parameter from CodegenConfig#fromModel(..) * Remove openAPI parameter from CodegenConfig#fromOperation(..) * Remove openAPI parameter from DefaultCodegen#fromProperty(..) * Remove openAPI parameter from DefaultCodegen#fromParameter(..) * Remove OpenAPI parameter from several methods * Use ModelUtils.getReferencedParameter(..) * Remove unused variable * Remove openAPI parameter from DefaultCodegen#fromResponse(..) * Remove openAPI parameter from DefaultCodegen#addHeaders(..) * Remove from addConsumesInfo(..)/addProducesInfo(..) * Improve test: add property to prevent Pet from being a free-form object * remove globalSchemas Map<String, Schema> * remove deprecated method: postProcessOperations() * Remove 'Map<String, Schema> allSchemas' from addProperties(..) * Remove 'Map<String, Schema> allDefinitions' from createDiscriminator(..) * Remove 'Map<String, Schema> allSchemas' from unaliasPropertySchema(..) * Rename globalOpenAPI to openAPI * Update documentation * Run “Optimize import” in IntelliJ IDEA
This commit is contained in:
parent
6f16b45976
commit
046db19a85
@ -22,6 +22,24 @@ The option is replaced with `-g` (`--generator-name`).
|
||||
* `-g` allows the same values as `-l`
|
||||
* See `list` command for the list of generator name
|
||||
|
||||
==== Access OpenAPI instance as member and not as parameter
|
||||
|
||||
If you are creating or extending a generator (programmatically), you might have use one of the following parameters: `OpenAPI openAPI` or `Map<String, Schema> allDefinitions` or `Map<String, Schema> allSchemas`. Example methods:
|
||||
|
||||
* `CodegenConfig#fromOperation(String, String, Operation, Map<String, Schema>, OpenAPI)`
|
||||
* `CodegenConfig#fromModel(String, Schema, Map<String, Schema>)`
|
||||
* `DefaultCodegen#fromResponse(OpenAPI, String, ApiResponse)`
|
||||
* `DefaultCodegen#DefaultCodegen.fromRequestBody(RequestBody, Map<String, Schema>, Set<String>, String)`
|
||||
* `DefaultCodegen#createDiscriminator(String, Schema, Map<String, Schema>)`
|
||||
* ...
|
||||
|
||||
The parameters (`openAPI`, `allDefinitions`, `allSchemas` ...) are now removed from the methods.
|
||||
|
||||
To access the current OpenAPI instance, if you are extending `DefaultCodegen` you can use the protected `openAPI` member.
|
||||
|
||||
If you are creating your own generator by implementing `CodegenConfig`, then the setter `CodegenConfig.setOpenAPI(OpenAPI)` will be called.
|
||||
You can keep a reference on the `OpenAPI` instance.
|
||||
|
||||
=== From 3.1.x to 3.2.0
|
||||
|
||||
Version `3.2.0` is a minor version of OpenAPI-Generator, in comparison to `3.1.x` it contains some breaking changes, but with the possibility to fallback to the old behavior.
|
||||
|
@ -19,14 +19,13 @@ package config;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConfigParser {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigParser.class);
|
||||
|
@ -17,24 +17,15 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Scanner;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Scanner;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public abstract class AbstractGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGenerator.class);
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -19,9 +19,10 @@ package org.openapitools.codegen;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||
import java.util.List;
|
||||
import org.openapitools.codegen.auth.AuthParser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ClientOptInput {
|
||||
private CodegenConfig config;
|
||||
private ClientOpts opts;
|
||||
|
@ -17,11 +17,11 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import org.openapitools.codegen.auth.AuthMethod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.openapitools.codegen.auth.AuthMethod;
|
||||
|
||||
public class ClientOpts {
|
||||
protected String uri;
|
||||
protected String target;
|
||||
|
@ -18,7 +18,6 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import com.samskivert.mustache.Mustache.Compiler;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
@ -27,7 +26,6 @@ import io.swagger.v3.oas.models.servers.Server;
|
||||
import io.swagger.v3.oas.models.servers.ServerVariable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -111,11 +109,9 @@ public interface CodegenConfig {
|
||||
|
||||
void setOutputDir(String dir);
|
||||
|
||||
CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions);
|
||||
CodegenModel fromModel(String name, Schema schema);
|
||||
|
||||
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Schema> definitions, OpenAPI openAPI);
|
||||
|
||||
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Schema> definitions);
|
||||
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation);
|
||||
|
||||
List<CodegenSecurity> fromSecurity(Map<String, SecurityScheme> schemas);
|
||||
|
||||
@ -179,14 +175,6 @@ public interface CodegenConfig {
|
||||
|
||||
Map<String, Object> postProcessModels(Map<String, Object> objs);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #postProcessOperationsWithModels(Map, List)} instead. This method will be removed
|
||||
* @param objs the objects map that will be passed to the templating engine
|
||||
* @return the the objects map instance.
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Object> postProcessOperations(Map<String, Object> objs);
|
||||
|
||||
Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels);
|
||||
|
||||
Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs);
|
||||
@ -266,9 +254,10 @@ public interface CodegenConfig {
|
||||
|
||||
void setEnablePostProcessFile(boolean isEnablePostProcessFile);
|
||||
|
||||
// set OpenAPI and schemas
|
||||
void setGlobalOpenAPI(OpenAPI openAPI);
|
||||
|
||||
void setGlobalSchemas(OpenAPI openAPI);
|
||||
/**
|
||||
* Set the OpenAPI instance. This method needs to be called right after the instantiation of the Codegen class.
|
||||
* @param openAPI specification being generated
|
||||
*/
|
||||
void setOpenAPI(OpenAPI openAPI);
|
||||
|
||||
}
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import static java.util.ServiceLoader.load;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import static java.util.ServiceLoader.load;
|
||||
|
||||
public class CodegenConfigLoader {
|
||||
/**
|
||||
* Tries to load config class with SPI first, then with class name directly from classpath
|
||||
|
@ -2,7 +2,10 @@ package org.openapitools.codegen;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class CodegenDiscriminator {
|
||||
private String propertyName;
|
||||
|
@ -17,13 +17,12 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
@JsonIgnoreProperties({"parentModel", "interfaceModels"})
|
||||
public class CodegenModel {
|
||||
public String parent, parentSchema;
|
||||
|
@ -20,14 +20,7 @@ package org.openapitools.codegen;
|
||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.models.tags.Tag;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class CodegenOperation {
|
||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import io.swagger.v3.oas.models.security.Scopes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -20,25 +20,14 @@ package org.openapitools.codegen;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.samskivert.mustache.Mustache.Compiler;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.callbacks.Callback;
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.headers.Header;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Content;
|
||||
import io.swagger.v3.oas.models.media.MediaType;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.parameters.CookieParameter;
|
||||
import io.swagger.v3.oas.models.parameters.HeaderParameter;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.PathParameter;
|
||||
import io.swagger.v3.oas.models.parameters.QueryParameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.parameters.*;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.models.security.OAuthFlow;
|
||||
@ -47,7 +36,6 @@ 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 org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -61,29 +49,14 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.escape;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
|
||||
@ -139,9 +112,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// flag to indicate whether to use environment variable to post process file
|
||||
protected boolean enablePostProcessFile = false;
|
||||
|
||||
// make openapi and schemas available to all methods
|
||||
protected OpenAPI globalOpenAPI;
|
||||
protected Map<String, Schema> globalSchemas;
|
||||
// make openapi available to all methods
|
||||
protected OpenAPI openAPI;
|
||||
|
||||
public List<CliOption> cliOptions() {
|
||||
return cliOptions;
|
||||
@ -445,36 +417,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set global OpenAPI based on OpenAPI object
|
||||
*
|
||||
* @param openAPI OpenAPI object
|
||||
*/
|
||||
public void setGlobalOpenAPI(OpenAPI openAPI) {
|
||||
this.globalOpenAPI = openAPI;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set global schema based on OpenAPI object
|
||||
*
|
||||
* @param openAPI OpenAPI object
|
||||
*/
|
||||
public void setGlobalSchemas(OpenAPI openAPI) {
|
||||
if (openAPI != null && openAPI.getComponents() != null) {
|
||||
this.globalSchemas = openAPI.getComponents().getSchemas();
|
||||
}
|
||||
|
||||
if (this.globalSchemas == null) { // initalize with empty map if it's null
|
||||
this.globalSchemas = new HashMap<String, Schema>();
|
||||
}
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@SuppressWarnings("static-method")
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
return objs;
|
||||
@Override
|
||||
public void setOpenAPI(OpenAPI openAPI) {
|
||||
this.openAPI = openAPI;
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@ -1415,7 +1360,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private String getSingleSchemaType(Schema schema) {
|
||||
Schema unaliasSchema = ModelUtils.unaliasSchema(globalSchemas, schema);
|
||||
Schema unaliasSchema = ModelUtils.unaliasSchema(this.openAPI, schema);
|
||||
|
||||
if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema
|
||||
// get the schema/model name from $ref
|
||||
@ -1616,17 +1561,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param name the name of the model
|
||||
* @param schema OAS Model object
|
||||
* @param allDefinitions a map of all OAS models from the spec
|
||||
* @return Codegen Model object
|
||||
*/
|
||||
public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions) {
|
||||
public CodegenModel fromModel(String name, Schema schema) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
if (typeAliases == null) {
|
||||
// Only do this once during first call
|
||||
typeAliases = getAllAliases(allDefinitions);
|
||||
}
|
||||
|
||||
// unalias schema
|
||||
schema = ModelUtils.unaliasSchema(allDefinitions, schema);
|
||||
schema = ModelUtils.unaliasSchema(this.openAPI, schema);
|
||||
if (schema == null) {
|
||||
LOGGER.warn("Schema {} not found", name);
|
||||
return null;
|
||||
@ -1651,7 +1596,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.getVendorExtensions().putAll(schema.getExtensions());
|
||||
}
|
||||
m.isAlias = typeAliases.containsKey(name);
|
||||
m.discriminator = createDiscriminator(name, schema, allDefinitions);
|
||||
m.discriminator = createDiscriminator(name, schema);
|
||||
|
||||
if (schema.getXml() != null) {
|
||||
m.xmlPrefix = schema.getXml().getPrefix();
|
||||
@ -1684,7 +1629,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
for (Schema innerSchema : composed.getAllOf()) { // TOOD need to work with anyOf, oneOf as well
|
||||
if (m.discriminator == null) {
|
||||
LOGGER.debug("discriminator is set to null (not correctly set earlier): {}", name);
|
||||
m.discriminator = createDiscriminator(name, schema, allDefinitions);
|
||||
m.discriminator = createDiscriminator(name, schema);
|
||||
}
|
||||
|
||||
if (innerSchema.getXml() != null) {
|
||||
@ -1723,13 +1668,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (allDefinitions != null && refSchema != null) {
|
||||
if (allParents.contains(modelName) && supportsMultipleInheritance) {
|
||||
// multiple inheritance
|
||||
addProperties(allProperties, allRequired, refSchema, allDefinitions);
|
||||
addProperties(allProperties, allRequired, refSchema);
|
||||
} else if (parentName != null && parentName.equals(modelName) && supportsInheritance) {
|
||||
// single inheritance
|
||||
addProperties(allProperties, allRequired, refSchema, allDefinitions);
|
||||
addProperties(allProperties, allRequired, refSchema);
|
||||
} else {
|
||||
// composition
|
||||
addProperties(properties, required, refSchema, allDefinitions);
|
||||
addProperties(properties, required, refSchema);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1766,16 +1711,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (component.get$ref() == null) {
|
||||
if (component != null) {
|
||||
// component is the child schema
|
||||
addProperties(properties, required, component, allDefinitions);
|
||||
addProperties(properties, required, component);
|
||||
|
||||
// includes child's properties (all, required) in allProperties, allRequired
|
||||
addProperties(allProperties, allRequired, component, allDefinitions);
|
||||
addProperties(allProperties, allRequired, component);
|
||||
}
|
||||
break; // at most one child only
|
||||
}
|
||||
}
|
||||
|
||||
addVars(m, unaliasPropertySchema(allDefinitions, properties), required, unaliasPropertySchema(allDefinitions, allProperties), allRequired);
|
||||
addVars(m, unaliasPropertySchema(properties), required, unaliasPropertySchema(allProperties), allRequired);
|
||||
|
||||
// end of code block for composed schema
|
||||
} else {
|
||||
@ -1800,7 +1745,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// passing null to allProperties and allRequired as there's no parent
|
||||
addVars(m, unaliasPropertySchema(allDefinitions, schema.getProperties()), schema.getRequired(), null, null);
|
||||
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
||||
}
|
||||
|
||||
// remove duplicated properties
|
||||
@ -1816,8 +1761,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return m;
|
||||
}
|
||||
|
||||
private CodegenDiscriminator createDiscriminator(String schemaName, Schema
|
||||
schema, Map<String, Schema> allDefinitions) {
|
||||
private CodegenDiscriminator createDiscriminator(String schemaName, Schema schema) {
|
||||
if (schema.getDiscriminator() == null) {
|
||||
return null;
|
||||
}
|
||||
@ -1827,12 +1771,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (schema.getDiscriminator().getMapping() != null && !schema.getDiscriminator().getMapping().isEmpty()) {
|
||||
for (Entry<String, String> e : schema.getDiscriminator().getMapping().entrySet()) {
|
||||
String name = toModelName(ModelUtils.getSimpleRef(e.getValue())); // e.g e.getValue => #/components/schemas/Dog
|
||||
if (allDefinitions.get(name) == null) {
|
||||
LOGGER.warn("Discriminator's mapping: model {} (mapped to {}) couldn't be found", name, e.getKey());
|
||||
}
|
||||
discriminator.getMappedModels().add(new MappedModel(e.getKey(), name));
|
||||
}
|
||||
} else {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
allDefinitions.forEach((childName, child) -> {
|
||||
if (child instanceof ComposedSchema && ((ComposedSchema) child).getAllOf() != null) {
|
||||
Set<String> parentSchemas = ((ComposedSchema) child).getAllOf().stream()
|
||||
@ -1858,15 +1800,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param properties all properties
|
||||
* @param required required property only
|
||||
* @param schema schema in which the properties will be added to the lists
|
||||
* @param allSchemas all schemas
|
||||
*/
|
||||
protected void addProperties(Map<String, Schema> properties, List<String> required, Schema
|
||||
schema, Map<String, Schema> allSchemas) {
|
||||
protected void addProperties(Map<String, Schema> properties, List<String> required, Schema schema) {
|
||||
if (schema instanceof ComposedSchema) {
|
||||
ComposedSchema composedSchema = (ComposedSchema) schema;
|
||||
|
||||
for (Schema component : composedSchema.getAllOf()) {
|
||||
addProperties(properties, required, component, allSchemas);
|
||||
addProperties(properties, required, component);
|
||||
}
|
||||
|
||||
if (composedSchema.getOneOf() != null) {
|
||||
@ -1880,11 +1820,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema unaliasSchema = ModelUtils.unaliasSchema(globalSchemas, schema);
|
||||
|
||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||
Schema interfaceSchema = allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()));
|
||||
addProperties(properties, required, interfaceSchema, allSchemas);
|
||||
Schema interfaceSchema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
addProperties(properties, required, interfaceSchema);
|
||||
return;
|
||||
}
|
||||
if (schema.getProperties() != null) {
|
||||
@ -1924,7 +1862,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("debugging fromProperty for " + name + " : " + p);
|
||||
|
||||
// unalias schema
|
||||
p = ModelUtils.unaliasSchema(globalSchemas, p);
|
||||
p = ModelUtils.unaliasSchema(this.openAPI, p);
|
||||
|
||||
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
|
||||
property.name = toVarName(name);
|
||||
@ -2156,7 +2094,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (itemName == null) {
|
||||
itemName = property.name;
|
||||
}
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(globalSchemas, ((ArraySchema) p).getItems());
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, ((ArraySchema) p).getItems());
|
||||
CodegenProperty cp = fromProperty(itemName, innerSchema);
|
||||
updatePropertyForArray(property, cp);
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
@ -2168,7 +2106,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.maxItems = p.getMaxProperties();
|
||||
|
||||
// handle inner property
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(globalSchemas, ModelUtils.getAdditionalProperties(p));
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getAdditionalProperties(p));
|
||||
CodegenProperty cp = fromProperty("inner", innerSchema);
|
||||
updatePropertyForMap(property, cp);
|
||||
} else if (ModelUtils.isFreeFormObject(p)) {
|
||||
@ -2369,39 +2307,21 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return responses.get(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OAS Operation object to Codegen Operation object (without providing a OAS object)
|
||||
*
|
||||
* @param path the path of the operation
|
||||
* @param httpMethod HTTP method
|
||||
* @param operation OAS operation object
|
||||
* @param schemas a map of OAS models
|
||||
* @return Codegen Operation object
|
||||
*/
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation
|
||||
operation, Map<String, Schema> schemas) {
|
||||
return fromOperation(path, httpMethod, operation, schemas, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OAS Operation object to Codegen Operation object
|
||||
*
|
||||
* @param path the path of the operation
|
||||
* @param httpMethod HTTP method
|
||||
* @param operation OAS operation object
|
||||
* @param schemas a map of OAS models
|
||||
* @param openAPI a OAS object representing the spec
|
||||
* @param path the path of the operation
|
||||
* @return Codegen Operation object
|
||||
*/
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
Operation operation,
|
||||
Map<String, Schema> schemas,
|
||||
OpenAPI openAPI) {
|
||||
Operation operation) {
|
||||
LOGGER.debug("fromOperation => operation: " + operation);
|
||||
if (operation == null)
|
||||
throw new RuntimeException("operation cannot be null in fromOperation");
|
||||
|
||||
Map<String, Schema> schemas = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
||||
Set<String> imports = new HashSet<String>();
|
||||
if (operation.getExtensions() != null && !operation.getExtensions().isEmpty()) {
|
||||
@ -2439,14 +2359,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
op.isDeprecated = operation.getDeprecated();
|
||||
}
|
||||
|
||||
addConsumesInfo(openAPI, operation, op);
|
||||
addConsumesInfo(operation, op);
|
||||
|
||||
if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
|
||||
ApiResponse methodResponse = findMethodResponse(operation.getResponses());
|
||||
for (String key : operation.getResponses().keySet()) {
|
||||
ApiResponse response = operation.getResponses().get(key);
|
||||
addProducesInfo(openAPI, response, op);
|
||||
CodegenResponse r = fromResponse(openAPI, key, response);
|
||||
addProducesInfo(response, op);
|
||||
CodegenResponse r = fromResponse(key, response);
|
||||
r.hasMore = true;
|
||||
if (r.baseType != null &&
|
||||
!defaultIncludes.contains(r.baseType) &&
|
||||
@ -2465,7 +2385,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
op.responses.get(op.responses.size() - 1).hasMore = false;
|
||||
|
||||
if (methodResponse != null) {
|
||||
Schema responseSchema = ModelUtils.unaliasSchema(globalSchemas, ModelUtils.getSchemaFromResponse(methodResponse));
|
||||
Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse));
|
||||
|
||||
if (responseSchema != null) {
|
||||
CodegenProperty cm = fromProperty("response", responseSchema);
|
||||
@ -2492,18 +2412,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
exampleStatusCode = key;
|
||||
}
|
||||
}
|
||||
op.examples = new ExampleGenerator(schemas, openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(openAPI, operation));
|
||||
op.examples = new ExampleGenerator(schemas, this.openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(this.openAPI, operation));
|
||||
op.defaultResponse = toDefaultValue(responseSchema);
|
||||
op.returnType = cm.dataType;
|
||||
op.hasReference = schemas != null && schemas.containsKey(op.returnBaseType);
|
||||
op.hasReference = schemas.containsKey(op.returnBaseType);
|
||||
|
||||
// lookup discriminator
|
||||
if (schemas != null) {
|
||||
Schema schema = schemas.get(op.returnBaseType);
|
||||
if (schema != null) {
|
||||
CodegenModel cmod = fromModel(op.returnBaseType, schema, schemas);
|
||||
op.discriminator = cmod.discriminator;
|
||||
}
|
||||
Schema schema = schemas.get(op.returnBaseType);
|
||||
if (schema != null) {
|
||||
CodegenModel cmod = fromModel(op.returnBaseType, schema);
|
||||
op.discriminator = cmod.discriminator;
|
||||
}
|
||||
|
||||
if (cm.isContainer) {
|
||||
@ -2522,13 +2440,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
op.returnTypeIsPrimitive = true;
|
||||
}
|
||||
}
|
||||
addHeaders(openAPI, methodResponse, op.responseHeaders);
|
||||
addHeaders(methodResponse, op.responseHeaders);
|
||||
}
|
||||
}
|
||||
|
||||
if (operation.getCallbacks() != null && !operation.getCallbacks().isEmpty()) {
|
||||
operation.getCallbacks().forEach((name, callback) -> {
|
||||
CodegenCallback c = fromCallback(name, callback, schemas, openAPI);
|
||||
CodegenCallback c = fromCallback(name, callback);
|
||||
c.hasMore = true;
|
||||
op.callbacks.add(c);
|
||||
});
|
||||
@ -2552,7 +2470,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if ("application/x-www-form-urlencoded".equalsIgnoreCase(getContentType(requestBody)) ||
|
||||
"multipart/form-data".equalsIgnoreCase(getContentType(requestBody))) {
|
||||
// process form parameters
|
||||
formParams = fromRequestBodyToFormParameters(requestBody, schemas, imports);
|
||||
formParams = fromRequestBodyToFormParameters(requestBody, imports);
|
||||
for (CodegenParameter cp : formParams) {
|
||||
postProcessParameter(cp);
|
||||
}
|
||||
@ -2564,13 +2482,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
} else {
|
||||
// process body parameter
|
||||
requestBody = ModelUtils.getReferencedRequestBody(openAPI, requestBody);
|
||||
requestBody = ModelUtils.getReferencedRequestBody(this.openAPI, requestBody);
|
||||
|
||||
String bodyParameterName = "";
|
||||
if (op.vendorExtensions != null && op.vendorExtensions.containsKey("x-codegen-request-body-name")) {
|
||||
bodyParameterName = (String) op.vendorExtensions.get("x-codegen-request-body-name");
|
||||
}
|
||||
bodyParam = fromRequestBody(requestBody, schemas, imports, bodyParameterName);
|
||||
bodyParam = fromRequestBody(requestBody, imports, bodyParameterName);
|
||||
bodyParam.description = escapeText(requestBody.getDescription());
|
||||
postProcessParameter(bodyParam);
|
||||
|
||||
@ -2582,16 +2500,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// add example
|
||||
if (schemas != null) {
|
||||
op.requestBodyExamples = new ExampleGenerator(schemas, openAPI).generate(null, new ArrayList<String>(getConsumesInfo(openAPI, operation)), bodyParam.baseType);
|
||||
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<String>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters != null) {
|
||||
for (Parameter param : parameters) {
|
||||
if (StringUtils.isNotBlank(param.get$ref())) {
|
||||
param = getParameterFromRef(param.get$ref(), openAPI);
|
||||
}
|
||||
param = ModelUtils.getReferencedParameter(this.openAPI, param);
|
||||
|
||||
CodegenParameter p = fromParameter(param, imports);
|
||||
|
||||
@ -2707,13 +2623,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
/**
|
||||
* Convert OAS Response object to Codegen Response object
|
||||
*
|
||||
* @param openAPI a OAS object representing the spec
|
||||
* @param responseCode HTTP response code
|
||||
* @param response OAS Response object
|
||||
*
|
||||
* @return Codegen Response object
|
||||
*/
|
||||
public CodegenResponse fromResponse(OpenAPI openAPI, String responseCode, ApiResponse response) {
|
||||
public CodegenResponse fromResponse(String responseCode, ApiResponse response) {
|
||||
CodegenResponse r = CodegenModelFactory.newInstance(CodegenModelType.RESPONSE);
|
||||
if ("default".equals(responseCode)) {
|
||||
r.code = "0";
|
||||
@ -2721,8 +2636,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
r.code = responseCode;
|
||||
}
|
||||
Schema responseSchema;
|
||||
if (openAPI != null && openAPI.getComponents() != null) {
|
||||
responseSchema = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), ModelUtils.getSchemaFromResponse(response));
|
||||
if (this.openAPI != null && this.openAPI.getComponents() != null) {
|
||||
responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(response));
|
||||
} else { // no model/alias defined
|
||||
responseSchema = ModelUtils.getSchemaFromResponse(response);
|
||||
}
|
||||
@ -2735,7 +2650,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (response.getExtensions() != null && !response.getExtensions().isEmpty()) {
|
||||
r.vendorExtensions.putAll(response.getExtensions());
|
||||
}
|
||||
addHeaders(openAPI, response, r.headers);
|
||||
addHeaders(response, r.headers);
|
||||
r.hasHeaders = !r.headers.isEmpty();
|
||||
|
||||
if (r.schema != null) {
|
||||
@ -2827,12 +2742,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param name callback name
|
||||
* @param callback OAS Callback object
|
||||
* @param schemas a map of OAS models
|
||||
* @param openAPI a OAS object representing the spec
|
||||
* @return Codegen Response object
|
||||
*/
|
||||
public CodegenCallback fromCallback(String name, Callback callback, Map<String, Schema> schemas, OpenAPI
|
||||
openAPI) {
|
||||
public CodegenCallback fromCallback(String name, Callback callback) {
|
||||
CodegenCallback c = new CodegenCallback();
|
||||
c.name = name;
|
||||
|
||||
@ -2874,7 +2786,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// distinguish between normal operations and callback requests
|
||||
op.getExtensions().put("x-callback-request", true);
|
||||
|
||||
CodegenOperation co = fromOperation(expression, method, op, schemas, openAPI);
|
||||
CodegenOperation co = fromOperation(expression, method, op);
|
||||
if (genId) {
|
||||
co.operationIdOriginal = null;
|
||||
// legacy (see `fromOperation()`)
|
||||
@ -2923,7 +2835,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
if (parameter.getSchema() != null) {
|
||||
Schema parameterSchema = ModelUtils.unaliasSchema(globalSchemas, parameter.getSchema());
|
||||
Schema parameterSchema = ModelUtils.unaliasSchema(this.openAPI, parameter.getSchema());
|
||||
if (parameterSchema == null) {
|
||||
LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String");
|
||||
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
|
||||
@ -3373,16 +3285,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
/**
|
||||
* Add headers to codegen property
|
||||
*
|
||||
* @param response API response
|
||||
* @param properties list of codegen property
|
||||
*/
|
||||
private void addHeaders(OpenAPI openAPI, ApiResponse response, List<CodegenProperty> properties) {
|
||||
private void addHeaders(ApiResponse response, List<CodegenProperty> properties) {
|
||||
if (response.getHeaders() != null) {
|
||||
for (Map.Entry<String, Header> headers : response.getHeaders().entrySet()) {
|
||||
String description = headers.getValue().getDescription();
|
||||
// follow the $ref
|
||||
Header header = ModelUtils.getReferencedHeader(openAPI, headers.getValue());
|
||||
Header header = ModelUtils.getReferencedHeader(this.openAPI, headers.getValue());
|
||||
|
||||
CodegenProperty cp = fromProperty(headers.getKey(), header.getSchema());
|
||||
cp.setDescription(escapeText(description));
|
||||
@ -3490,16 +3401,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
/**
|
||||
* Loop through propertiies and unalias the reference if $ref (reference) is defined
|
||||
*
|
||||
* @param allSchemas all schemas defined in the spec
|
||||
* @param properties model properties (schemas)
|
||||
*
|
||||
* @return model properties with direct reference to schemas
|
||||
*/
|
||||
private Map<String, Schema> unaliasPropertySchema
|
||||
(Map<String, Schema> allSchemas, Map<String, Schema> properties) {
|
||||
private Map<String, Schema> unaliasPropertySchema(Map<String, Schema> properties) {
|
||||
if (properties != null) {
|
||||
for (String key : properties.keySet()) {
|
||||
properties.put(key, ModelUtils.unaliasSchema(allSchemas, properties.get(key)));
|
||||
properties.put(key, ModelUtils.unaliasSchema(this.openAPI, properties.get(key)));
|
||||
|
||||
}
|
||||
}
|
||||
@ -4207,15 +4116,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return new ArrayList<>(requestBody.getContent().keySet()).get(0);
|
||||
}
|
||||
|
||||
protected Parameter getParameterFromRef(String ref, OpenAPI openAPI) {
|
||||
String parameterName = ref.substring(ref.lastIndexOf('/') + 1);
|
||||
Map<String, Parameter> parameterMap = openAPI.getComponents().getParameters();
|
||||
if (parameterMap == null ) { // can't find the ref
|
||||
throw new RuntimeException(ref + " not defined in the spec.");
|
||||
}
|
||||
return parameterMap.get(parameterName);
|
||||
}
|
||||
|
||||
private void setOauth2Info(CodegenSecurity codegenSecurity, OAuthFlow flow) {
|
||||
codegenSecurity.authorizationUrl = flow.getAuthorizationUrl();
|
||||
codegenSecurity.tokenUrl = flow.getTokenUrl();
|
||||
@ -4241,8 +4141,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private void addConsumesInfo(OpenAPI openAPI, Operation operation, CodegenOperation codegenOperation) {
|
||||
RequestBody requestBody = ModelUtils.getReferencedRequestBody(openAPI, operation.getRequestBody());
|
||||
private void addConsumesInfo(Operation operation, CodegenOperation codegenOperation) {
|
||||
RequestBody requestBody = ModelUtils.getReferencedRequestBody(this.openAPI, operation.getRequestBody());
|
||||
if (requestBody == null || requestBody.getContent() == null || requestBody.getContent().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -4310,8 +4210,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return ModelUtils.getReferencedSchema(openAPI, schema) != null;
|
||||
}
|
||||
|
||||
private void addProducesInfo(OpenAPI openAPI, ApiResponse inputResponse, CodegenOperation codegenOperation) {
|
||||
ApiResponse response = ModelUtils.getReferencedApiResponse(openAPI, inputResponse);
|
||||
private void addProducesInfo(ApiResponse inputResponse, CodegenOperation codegenOperation) {
|
||||
ApiResponse response = ModelUtils.getReferencedApiResponse(this.openAPI, inputResponse);
|
||||
if (response == null || response.getContent() == null || response.getContent().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -4408,14 +4308,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<CodegenParameter> fromRequestBodyToFormParameters(RequestBody
|
||||
body, Map<String, Schema> schemas, Set<String> imports) {
|
||||
public List<CodegenParameter> fromRequestBodyToFormParameters(RequestBody body, Set<String> imports) {
|
||||
List<CodegenParameter> parameters = new ArrayList<CodegenParameter>();
|
||||
LOGGER.debug("debugging fromRequestBodyToFormParameters= " + body);
|
||||
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||
schema = schemas.get(ModelUtils.getSimpleRef(schema.get$ref()));
|
||||
}
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
Map<String, Schema> properties = schema.getProperties();
|
||||
for (Map.Entry<String, Schema> entry : properties.entrySet()) {
|
||||
@ -4565,8 +4462,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return codegenParameter;
|
||||
}
|
||||
|
||||
public CodegenParameter fromRequestBody(RequestBody
|
||||
body, Map<String, Schema> schemas, Set<String> imports, String bodyParameterName) {
|
||||
public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, String bodyParameterName) {
|
||||
if (body == null) {
|
||||
LOGGER.error("body in fromRequestBody cannot be null!");
|
||||
}
|
||||
@ -4586,8 +4482,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||
name = ModelUtils.getSimpleRef(schema.get$ref());
|
||||
schema = schemas.get(name);
|
||||
}
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
|
||||
if (ModelUtils.isMapSchema(schema)) {
|
||||
Schema inner = ModelUtils.getAdditionalProperties(schema);
|
||||
@ -4686,7 +4582,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
CodegenModel codegenModel = null;
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
schema.setName(name);
|
||||
codegenModel = fromModel(name, schema, schemas);
|
||||
codegenModel = fromModel(name, schema);
|
||||
}
|
||||
if (codegenModel != null) {
|
||||
codegenParameter.isModel = true;
|
||||
|
@ -19,7 +19,6 @@ package org.openapitools.codegen;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
@ -33,7 +32,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.tags.Tag;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -46,9 +44,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
import java.net.URL;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
|
||||
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
|
||||
@ -182,9 +180,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
config.processOpts();
|
||||
config.preprocessOpenAPI(openAPI);
|
||||
|
||||
// set OpenAPI and schemas to make these available to all methods
|
||||
config.setGlobalOpenAPI(openAPI);
|
||||
config.setGlobalSchemas(openAPI);
|
||||
// set OpenAPI to make these available to all methods
|
||||
config.setOpenAPI(openAPI);
|
||||
|
||||
config.additionalProperties().put("generatorVersion", ImplementationVersion.read());
|
||||
config.additionalProperties().put("generatedDate", ZonedDateTime.now().toString());
|
||||
@ -449,7 +446,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
Map<String, Schema> schemaMap = new HashMap<>();
|
||||
schemaMap.put(name, schema);
|
||||
Map<String, Object> models = processModels(config, schemaMap, schemas);
|
||||
Map<String, Object> models = processModels(config, schemaMap);
|
||||
models.put("classname", config.toModelName(name));
|
||||
models.putAll(config.additionalProperties());
|
||||
allProcessedModels.put(name, models);
|
||||
@ -1016,7 +1013,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
final List<SecurityRequirement> globalSecurities = openAPI.getSecurity();
|
||||
for (Tag tag : tags) {
|
||||
try {
|
||||
CodegenOperation codegenOperation = config.fromOperation(resourcePath, httpMethod, operation, schemas, openAPI);
|
||||
CodegenOperation codegenOperation = config.fromOperation(resourcePath, httpMethod, operation);
|
||||
codegenOperation.tags = new ArrayList<>(tags);
|
||||
config.addOperationToGroup(config.sanitizeTag(tag.getName()), resourcePath, operation, codegenOperation, operations);
|
||||
|
||||
@ -1112,7 +1109,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
operations.put("hasImport", true);
|
||||
}
|
||||
|
||||
config.postProcessOperations(operations);
|
||||
config.postProcessOperationsWithModels(operations, allModels);
|
||||
if (objs.size() > 0) {
|
||||
List<CodegenOperation> os = (List<CodegenOperation>) objs.get("operation");
|
||||
@ -1126,7 +1122,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions, Map<String, Schema> allDefinitions) {
|
||||
private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) {
|
||||
Map<String, Object> objs = new HashMap<String, Object>();
|
||||
objs.put("package", config.modelPackage());
|
||||
List<Object> models = new ArrayList<Object>();
|
||||
@ -1135,7 +1131,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
Schema schema = definitions.get(key);
|
||||
if (schema == null)
|
||||
throw new RuntimeException("schema cannot be null in processMoels");
|
||||
CodegenModel cm = config.fromModel(key, schema, allDefinitions);
|
||||
CodegenModel cm = config.fromModel(key, schema);
|
||||
Map<String, Object> mo = new HashMap<String, Object>();
|
||||
mo.put("model", cm);
|
||||
mo.put("importPath", config.toModelImport(cm.classname));
|
||||
|
@ -17,27 +17,19 @@
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ObjectSchema;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Content;
|
||||
import io.swagger.v3.oas.models.media.MediaType;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.models.media.XML;
|
||||
|
||||
public class InlineModelResolver {
|
||||
private OpenAPI openapi;
|
||||
private Map<String, Schema> addedModels = new HashMap<String, Schema>();
|
||||
|
@ -26,26 +26,9 @@ import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
import io.swagger.v3.parser.core.models.SwaggerParseResult;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.ClientOptInput;
|
||||
import org.openapitools.codegen.ClientOpts;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConfigLoader;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.SpecValidationException;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.auth.AuthParser;
|
||||
import org.openapitools.codegen.languages.CSharpNancyFXServerCodegen;
|
||||
import org.openapitools.codegen.languages.CppQt5ClientCodegen;
|
||||
import org.openapitools.codegen.languages.CppRestSdkClientCodegen;
|
||||
import org.openapitools.codegen.languages.CppTizenClientCodegen;
|
||||
import org.openapitools.codegen.languages.JavaJerseyServerCodegen;
|
||||
import org.openapitools.codegen.languages.PhpLumenServerCodegen;
|
||||
import org.openapitools.codegen.languages.PhpSlimServerCodegen;
|
||||
import org.openapitools.codegen.languages.PhpZendExpressivePathHandlerServerCodegen;
|
||||
import org.openapitools.codegen.languages.RubySinatraServerCodegen;
|
||||
import org.openapitools.codegen.languages.ScalaAkkaClientCodegen;
|
||||
import org.openapitools.codegen.languages.ScalaHttpClientCodegen;
|
||||
import org.openapitools.codegen.languages.SwiftClientCodegen;
|
||||
import org.openapitools.codegen.languages.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -54,12 +37,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
package org.openapitools.codegen.config;
|
||||
|
||||
import org.openapitools.codegen.utils.OptionUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.openapitools.codegen.utils.OptionUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -18,30 +18,14 @@
|
||||
package org.openapitools.codegen.examples;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.BooleanSchema;
|
||||
import io.swagger.v3.oas.models.media.DateSchema;
|
||||
import io.swagger.v3.oas.models.media.DateTimeSchema;
|
||||
import io.swagger.v3.oas.models.media.IntegerSchema;
|
||||
import io.swagger.v3.oas.models.media.NumberSchema;
|
||||
import io.swagger.v3.oas.models.media.PasswordSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.media.UUIDSchema;
|
||||
import io.swagger.v3.oas.models.media.XML;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class XmlExampleGenerator {
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(XmlExampleGenerator.class);
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
package org.openapitools.codegen.ignore.rules;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.PathMatcher;
|
||||
import java.util.List;
|
||||
|
||||
public class DirectoryRule extends FileRule {
|
||||
|
@ -19,32 +19,18 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.samskivert.mustache.Escapers;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
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.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenSecurity;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
@ -403,9 +389,8 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
|
||||
Map<String, Schema> definitions, OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, openAPI);
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation);
|
||||
|
||||
if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
|
||||
ApiResponse methodResponse = findMethodResponse(operation.getResponses());
|
||||
@ -424,8 +409,8 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
// the scopes required by the operation.
|
||||
final List<SecurityRequirement> securities = operation.getSecurity();
|
||||
if (securities != null && securities.size() > 0) {
|
||||
final Map<String, SecurityScheme> securitySchemes = openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null;
|
||||
final List<SecurityRequirement> globalSecurities = openAPI.getSecurity();
|
||||
final Map<String, SecurityScheme> securitySchemes = this.openAPI.getComponents() != null ? this.openAPI.getComponents().getSecuritySchemes() : null;
|
||||
final List<SecurityRequirement> globalSecurities = this.openAPI.getSecurity();
|
||||
|
||||
Map<String, List<String>> scopes = getAuthScopes(securities, securitySchemes);
|
||||
if (scopes.isEmpty() && globalSecurities != null) {
|
||||
|
@ -17,25 +17,20 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
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.MapSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@ -437,8 +432,8 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel cm = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel cm = super.fromModel(name, model);
|
||||
|
||||
// TODO Check enum model handling
|
||||
if (cm.interfaces == null) {
|
||||
@ -566,10 +561,10 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Schema> definitions, OpenAPI openAPI) {
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation) {
|
||||
|
||||
CodegenOperation op = super.fromOperation(
|
||||
path, httpMethod, operation, definitions, openAPI);
|
||||
path, httpMethod, operation);
|
||||
|
||||
if (op.getHasExamples()) {
|
||||
// prepare examples for Apex test classes
|
||||
|
@ -20,20 +20,13 @@ package org.openapitools.codegen.languages;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
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.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.mustache.*;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.parameters.*;
|
||||
import io.swagger.v3.core.util.Yaml;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -759,7 +752,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
*
|
||||
* @param p OpenAPI property object
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
|
@ -17,12 +17,11 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
|
@ -17,36 +17,18 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
|
||||
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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -475,11 +457,12 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
if (allDefinitions != null && codegenModel.parentSchema != null && codegenModel.hasEnums) {
|
||||
final Schema parentModel = allDefinitions.get(codegenModel.parentSchema);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
codegenModel = AbstractEiffelCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
return codegenModel;
|
||||
|
@ -19,15 +19,14 @@ 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.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
@ -417,7 +417,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> operations) {
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> operations, List<Object> allModels) {
|
||||
Map<String, Object> objs = (Map<String, Object>) operations.get("operations");
|
||||
|
||||
for (CodegenOperation op : (List<CodegenOperation>) objs.get("operation")) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
@ -26,18 +25,10 @@ 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 io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -46,9 +37,7 @@ import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.escape;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@ -944,8 +933,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
if (codegenModel.description != null) {
|
||||
codegenModel.imports.add("ApiModel");
|
||||
}
|
||||
@ -955,7 +945,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
if (allDefinitions != null && codegenModel.parentSchema != null && codegenModel.hasEnums) {
|
||||
final Schema parentModel = allDefinitions.get(codegenModel.parentSchema);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
codegenModel = AbstractJavaCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
return codegenModel;
|
||||
@ -1139,8 +1129,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Schema> definitions, OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, openAPI);
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation);
|
||||
op.path = sanitizePath(op.path);
|
||||
return op;
|
||||
}
|
||||
|
@ -20,13 +20,7 @@ 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 org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenResponse;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -34,11 +28,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
@ -32,9 +32,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.escape;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
|
||||
|
@ -21,31 +21,15 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@ -568,7 +552,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
*
|
||||
* @param p Swagger property object
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
|
@ -17,10 +17,10 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
@ -19,15 +19,8 @@ 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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -17,25 +17,12 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
|
||||
public class Apache2ConfigCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String USER_INFO_PATH = "userInfoPath";
|
||||
|
@ -17,18 +17,22 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
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 org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.info.*;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
@ -28,7 +28,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.IllegalArgumentException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
@ -20,31 +20,19 @@ package org.openapitools.codegen.languages;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.parameters.*;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BashClientCodegen.class);
|
||||
@ -419,9 +407,9 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
/**
|
||||
* Convert OpenAPI Parameter object to Codegen Parameter object
|
||||
*
|
||||
* @param param OpenAPI parameter object
|
||||
* @param imports set of imports for library/package/module
|
||||
* @param param OpenAPI parameter object
|
||||
*
|
||||
* @return Codegen Parameter object
|
||||
*/
|
||||
@Override
|
||||
@ -578,12 +566,9 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod,
|
||||
Operation operation,
|
||||
Map<String, Schema> definitions,
|
||||
OpenAPI openAPI) {
|
||||
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation,
|
||||
definitions, openAPI);
|
||||
Operation operation) {
|
||||
Map<String, Schema> definitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation);
|
||||
|
||||
/**
|
||||
* Check if the operation has a Bash codegen specific description
|
||||
@ -626,8 +611,8 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
* If the operation produces Json and has nonempty example
|
||||
* try to reformat it.
|
||||
*/
|
||||
if (getConsumesInfo(openAPI, operation) != null
|
||||
&& getConsumesInfo(openAPI, operation).contains("application/json")
|
||||
if (getConsumesInfo(this.openAPI, operation) != null
|
||||
&& getConsumesInfo(this.openAPI, operation).contains("application/json")
|
||||
&& definitions.get(p.dataType).getExample() != null) {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
@ -16,24 +16,18 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
@ -17,29 +17,16 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -537,12 +524,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null) {
|
||||
final Schema parentModel = allDefinitions.get(toModelName(codegenModel.parent));
|
||||
if (parentModel != null) {
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
if (codegenModel.hasEnums) {
|
||||
codegenModel = this.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
|
@ -17,7 +17,10 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -18,19 +18,10 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.*;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -38,38 +29,14 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.UUID.randomUUID;
|
||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||
import static org.openapitools.codegen.CodegenConstants.INTERFACE_PREFIX;
|
||||
import static org.openapitools.codegen.CodegenConstants.INTERFACE_PREFIX_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.OPTIONAL_PROJECT_FILE;
|
||||
import static org.openapitools.codegen.CodegenConstants.OPTIONAL_PROJECT_FILE_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.OPTIONAL_PROJECT_GUID;
|
||||
import static org.openapitools.codegen.CodegenConstants.OPTIONAL_PROJECT_GUID_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.PACKAGE_NAME;
|
||||
import static org.openapitools.codegen.CodegenConstants.PACKAGE_VERSION;
|
||||
import static org.openapitools.codegen.CodegenConstants.RETURN_ICOLLECTION;
|
||||
import static org.openapitools.codegen.CodegenConstants.RETURN_ICOLLECTION_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG;
|
||||
import static org.openapitools.codegen.CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.SOURCE_FOLDER;
|
||||
import static org.openapitools.codegen.CodegenConstants.SOURCE_FOLDER_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.USE_COLLECTION;
|
||||
import static org.openapitools.codegen.CodegenConstants.USE_COLLECTION_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.USE_DATETIME_OFFSET;
|
||||
import static org.openapitools.codegen.CodegenConstants.USE_DATETIME_OFFSET_DESC;
|
||||
import static org.openapitools.codegen.CodegenConstants.*;
|
||||
import static org.openapitools.codegen.CodegenType.SERVER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
@ -17,34 +17,18 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
|
||||
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 org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@ -563,12 +547,13 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null) {
|
||||
final Schema parentModel = allDefinitions.get(toModelName(codegenModel.parent));
|
||||
if (parentModel != null) {
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
if (codegenModel.hasEnums) {
|
||||
codegenModel = this.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
|
@ -17,12 +17,14 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.info.*;
|
||||
|
||||
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.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.io.File;
|
||||
@ -171,8 +173,8 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema mod, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel model = super.fromModel(name, mod, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema mod) {
|
||||
CodegenModel model = super.fromModel(name, mod);
|
||||
|
||||
// If a var is a base spec we won't need to import it
|
||||
for (CodegenProperty var : model.vars) {
|
||||
|
@ -19,20 +19,10 @@ 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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final String ALL_OPERATIONS = "";
|
||||
|
@ -17,29 +17,16 @@
|
||||
|
||||
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.responses.ApiResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@ -169,8 +156,8 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
|
||||
Set<String> oldImports = codegenModel.imports;
|
||||
codegenModel.imports = new HashSet<>();
|
||||
@ -185,9 +172,8 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
|
||||
Map<String, Schema> definitions, OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, openAPI);
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation);
|
||||
|
||||
if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
|
||||
ApiResponse apiResponse = findMethodResponse(operation.getResponses());
|
||||
|
@ -1,24 +1,16 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
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;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class CppQt5AbstractCodegen extends AbstractCppCodegen implements CodegenConfig {
|
||||
|
||||
@ -283,7 +275,7 @@ public class CppQt5AbstractCodegen extends AbstractCppCodegen implements Codegen
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
Map<String, Object> objectMap = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operations = (List<CodegenOperation>) objectMap.get("operation");
|
||||
|
||||
|
@ -21,17 +21,9 @@ import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class CppQt5ClientCodegen extends CppQt5AbstractCodegen implements CodegenConfig {
|
||||
public static final String OPTIONAL_PROJECT_FILE_DESC = "Generate client.pri.";
|
||||
// source folder where to write the files
|
||||
|
@ -20,19 +20,9 @@ package org.openapitools.codegen.languages;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class CppQt5QHttpEngineServerCodegen extends CppQt5AbstractCodegen implements CodegenConfig {
|
||||
|
||||
protected final String SRC_DIR = "/src";
|
||||
|
@ -19,29 +19,15 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
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.responses.ApiResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
|
||||
@ -225,8 +211,8 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
|
||||
Set<String> oldImports = codegenModel.imports;
|
||||
codegenModel.imports = new HashSet<String>();
|
||||
@ -241,16 +227,15 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
|
||||
Map<String, Schema> schema, OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, schema, openAPI);
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation);
|
||||
|
||||
if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
|
||||
ApiResponse methodResponse = findMethodResponse(operation.getResponses());
|
||||
|
||||
if (methodResponse != null) {
|
||||
Schema response = ModelUtils.getSchemaFromResponse(methodResponse);
|
||||
response = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), response);
|
||||
response = ModelUtils.unaliasSchema(this.openAPI, response);
|
||||
if (response != null) {
|
||||
CodegenProperty cm = fromProperty("response", response);
|
||||
op.vendorExtensions.put("x-codegen-response", cm);
|
||||
|
@ -17,22 +17,15 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
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.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
|
||||
@ -180,8 +173,8 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
|
||||
Set<String> oldImports = codegenModel.imports;
|
||||
codegenModel.imports = new HashSet<String>();
|
||||
|
@ -17,16 +17,14 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -17,30 +17,17 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
@ -16,23 +16,13 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@ -159,8 +149,8 @@ public class DartJaguarClientCodegen extends DartClientCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
objs = super.postProcessOperations(objs);
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
objs = super.postProcessOperationsWithModels(objs, allModels);
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
|
||||
|
@ -19,14 +19,13 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
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.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -37,8 +36,8 @@ import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ElixirClientCodegen.class);
|
||||
@ -306,8 +305,8 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel cm = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel cm = super.fromModel(name, model);
|
||||
return new ExtendedCodegenModel(cm);
|
||||
}
|
||||
|
||||
|
@ -17,41 +17,19 @@
|
||||
|
||||
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 io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenResponse;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -323,8 +301,8 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel m = super.fromModel(name, schema, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema schema) {
|
||||
CodegenModel m = super.fromModel(name, schema);
|
||||
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
ArraySchema am = (ArraySchema) schema;
|
||||
@ -660,8 +638,8 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenResponse fromResponse(OpenAPI openAPI, String responseCode, ApiResponse resp) {
|
||||
final CodegenResponse response = super.fromResponse(openAPI, responseCode, resp);
|
||||
public CodegenResponse fromResponse(String responseCode, ApiResponse resp) {
|
||||
final CodegenResponse response = super.fromResponse(responseCode, resp);
|
||||
if (response.dataType != null) {
|
||||
final boolean isPrimitiveType = response.isMapContainer ? isPrimitiveDataType(response.dataType) : response.primitiveType;
|
||||
addEncoderAndDecoder(response.vendorExtensions, response.dataType, isPrimitiveType ? DataTypeExposure.PRIMITIVE : DataTypeExposure.EXTERNAL);
|
||||
|
@ -19,20 +19,19 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.mustache.JoinWithCommaLambda;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.io.Writer;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
|
@ -108,8 +108,8 @@ public class ErlangProperCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel cm = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel cm = super.fromModel(name, model);
|
||||
if(ModelUtils.isArraySchema(model)) {
|
||||
return new CodegenArrayModel(cm, (ArraySchema) model);
|
||||
} else {
|
||||
|
@ -17,13 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
@ -26,7 +25,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GoClientCodegen extends AbstractGoCodegen {
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
@ -15,12 +15,6 @@
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
|
@ -17,9 +17,12 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
||||
|
@ -22,9 +22,9 @@ 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;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
@ -755,8 +755,8 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema mod, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel model = super.fromModel(name, mod, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema mod) {
|
||||
CodegenModel model = super.fromModel(name, mod);
|
||||
|
||||
// while (typeNames.contains(model.classname)) {
|
||||
// model.classname = generateNextName(model.classname);
|
||||
|
@ -23,28 +23,13 @@ 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;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -473,8 +458,8 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Schema> definitions, OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(resourcePath, httpMethod, operation, definitions, openAPI);
|
||||
public CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation) {
|
||||
CodegenOperation op = super.fromOperation(resourcePath, httpMethod, operation);
|
||||
|
||||
List<String> path = pathToServantRoute(op.path, op.pathParams);
|
||||
List<String> type = pathToClientType(op.path, op.pathParams);
|
||||
@ -599,8 +584,8 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
// Override fromModel to create the appropriate model namings
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema mod, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel model = super.fromModel(name, mod, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema mod) {
|
||||
CodegenModel model = super.fromModel(name, mod);
|
||||
|
||||
setGenerateToSchema(model);
|
||||
|
||||
|
@ -17,13 +17,19 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.*;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
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;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class JMeterClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
|
@ -18,13 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
||||
import org.openapitools.codegen.languages.features.LoggingTestFeatures;
|
||||
|
@ -18,12 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.CXFServerFeatures;
|
||||
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
||||
import org.openapitools.codegen.languages.features.LoggingTestFeatures;
|
||||
|
@ -19,14 +19,7 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.GzipFeatures;
|
||||
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
|
||||
@ -36,12 +29,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
|
||||
|
@ -20,20 +20,13 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.config.GeneratorProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
||||
|
@ -17,7 +17,10 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -19,13 +19,8 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -190,8 +185,8 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
if (!useSwaggerAnnotations) {
|
||||
codegenModel.imports.remove("ApiModelProperty");
|
||||
codegenModel.imports.remove("ApiModel");
|
||||
|
@ -17,18 +17,15 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JavaMSF4JServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
|
||||
|
@ -21,25 +21,12 @@ 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.tags.Tag;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenResponse;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
@ -18,14 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
|
||||
import java.io.File;
|
||||
@ -228,8 +221,8 @@ public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements Bea
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
if (codegenModel.description != null) {
|
||||
codegenModel.imports.remove("ApiModel");
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
|
@ -17,14 +17,17 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen implements JbossFeature {
|
||||
|
||||
|
@ -18,11 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.config.GeneratorProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -30,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
|
||||
|
@ -22,12 +22,7 @@ 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.Schema;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
|
||||
import java.io.File;
|
||||
@ -198,17 +193,16 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
|
||||
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
|
||||
Map<String, Schema> definitions, OpenAPI openAPI) {
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation) {
|
||||
CodegenOperation codegenOperation =
|
||||
super.fromOperation(path, httpMethod, operation, definitions, openAPI);
|
||||
super.fromOperation(path, httpMethod, operation);
|
||||
codegenOperation.imports.add("MainApiException");
|
||||
return codegenOperation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
codegenModel.imports.remove("ApiModel");
|
||||
codegenModel.imports.remove("ApiModelProperty");
|
||||
return codegenModel;
|
||||
|
@ -23,34 +23,17 @@ 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.apache.commons.io.FilenameUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class JavascriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@SuppressWarnings("hiding")
|
||||
@ -864,12 +847,13 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema model) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
|
||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) {
|
||||
final Schema parentModel = allDefinitions.get(codegenModel.parentSchema);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
if (ModelUtils.isArraySchema(model)) {
|
||||
|
@ -17,30 +17,18 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
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.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.PathItem.HttpMethod;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.parameters.*;
|
||||
import io.swagger.v3.oas.models.info.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
@ -18,12 +18,12 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
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.info.Info;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -19,17 +19,12 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.mustache.CamelCaseLambda;
|
||||
import org.openapitools.codegen.mustache.IndentedLambda;
|
||||
import org.openapitools.codegen.mustache.LowercaseLambda;
|
||||
import org.openapitools.codegen.mustache.TitlecaseLambda;
|
||||
import org.openapitools.codegen.mustache.UppercaseLambda;
|
||||
import org.openapitools.codegen.mustache.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -554,8 +554,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
// Can't figure out the logic in DefaultCodegen but optional vars are getting duplicated when there's
|
||||
// inheritance involved. Also, isInherited doesn't seem to be getting set properly ¯\_(ツ)_/¯
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions) {
|
||||
CodegenModel m = super.fromModel(name, schema, allDefinitions);
|
||||
public CodegenModel fromModel(String name, Schema schema) {
|
||||
CodegenModel m = super.fromModel(name, schema);
|
||||
|
||||
m.optionalVars = m.optionalVars.stream().distinct().collect(Collectors.toList());
|
||||
m.allVars.stream().filter(p -> !m.vars.contains(p)).forEach(p -> p.isInherited = true);
|
||||
|
@ -20,28 +20,13 @@ 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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
@ -16,29 +16,13 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Locale;
|
||||
|
||||
public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MysqlSchemaCodegen.class);
|
||||
|
@ -26,14 +26,7 @@ import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.PathItem.HttpMethod;
|
||||
import io.swagger.v3.oas.models.Paths;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenResponse;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.config.GeneratorProperties;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -41,14 +34,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -20,30 +20,14 @@ 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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@ -662,7 +646,6 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
/**
|
||||
* Return the default value of the schema
|
||||
*
|
||||
* @param p OpenAPI schema object
|
||||
* @return string presentation of the default value of the schema
|
||||
*/
|
||||
|
@ -17,15 +17,17 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import java.io.File;
|
||||
|
||||
public class OpenAPIGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
|
@ -22,7 +22,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.io.File;
|
||||
|
||||
public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String OUTPUT_NAME = "outputFile";
|
||||
|
@ -17,23 +17,19 @@
|
||||
|
||||
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;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
|
@ -17,21 +17,19 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PhpClientCodegen extends AbstractPhpCodegen {
|
||||
@SuppressWarnings("hiding")
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PhpClientCodegen.class);
|
||||
|
@ -17,7 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@ -199,7 +201,7 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
|
||||
|
||||
// override with any special post-processing
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> objectMap = (Map<String, Object>) objs.get("operations");
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -17,24 +17,14 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
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.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
@ -17,29 +17,17 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.CodegenSecurity;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.net.URLEncoder;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
public class PhpSlimServerCodegen extends AbstractPhpCodegen {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PhpSlimServerCodegen.class);
|
||||
@ -254,10 +242,8 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen {
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
Operation operation,
|
||||
Map<String, Schema> schemas,
|
||||
OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, schemas, openAPI);
|
||||
Operation operation) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation);
|
||||
op.path = encodePath(path);
|
||||
return op;
|
||||
}
|
||||
|
@ -20,26 +20,14 @@ 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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.ProcessUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.UUID.randomUUID;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
@ -29,12 +29,13 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
@ -580,7 +581,6 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
*
|
||||
* @param p OpenAPI property object
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
|
@ -15,11 +15,9 @@
|
||||
*/
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class PythonAiohttpConnexionServerCodegen extends PythonAbstractConnexionServerCodegen {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PythonAiohttpConnexionServerCodegen.class);
|
||||
|
@ -21,26 +21,13 @@ 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;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@ -611,7 +598,6 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
*
|
||||
* @param p OpenAPI property object
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
|
@ -16,14 +16,11 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import java.io.File;
|
||||
|
||||
public class PythonFlaskConnexionServerCodegen extends PythonAbstractConnexionServerCodegen {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PythonFlaskConnexionServerCodegen.class);
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user