diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 2234b713844e..f2d5b050d32d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -628,7 +628,7 @@ public Map postProcessModelsEnum(Map objs) { List values = (List) allowableValues.get("values"); List> enumVars = buildEnumVars(values, cm.dataType); // if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames - updateEnumVarsWithExtensions(enumVars, cm.getVendorExtensions()); + updateEnumVarsWithExtensions(enumVars, cm.getVendorExtensions(), cm.dataType); cm.allowableValues.put("enumVars", enumVars); } @@ -1313,7 +1313,7 @@ public String toOperationId(String operationId) { public String toVarName(final String name) { if (reservedWords.contains(name)) { return escapeReservedWord(name); - } else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) { + } else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { return escape(name, specialCharReplacements, null, null); } return name; @@ -1330,7 +1330,7 @@ public String toParamName(String name) { name = removeNonNameElementToCamelCase(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. if (reservedWords.contains(name)) { return escapeReservedWord(name); - } else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) { + } else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { return escape(name, specialCharReplacements, null, null); } return name; @@ -1506,7 +1506,7 @@ public DefaultCodegen() { this.setDisallowAdditionalPropertiesIfNotPresent(true); // initialize special character mapping - initalizeSpecialCharacterMapping(); + initializeSpecialCharacterMapping(); // Register common Mustache lambdas. registerMustacheLambdas(); @@ -1515,7 +1515,7 @@ public DefaultCodegen() { /** * Initialize special character mapping */ - protected void initalizeSpecialCharacterMapping() { + protected void initializeSpecialCharacterMapping() { // Initialize special characters specialCharReplacements.put("$", "Dollar"); specialCharReplacements.put("^", "Caret"); @@ -5441,7 +5441,7 @@ public void updateCodegenPropertyEnum(CodegenProperty var) { if (referencedSchema.isPresent()) { extensions = referencedSchema.get().getExtensions(); } - updateEnumVarsWithExtensions(enumVars, extensions); + updateEnumVarsWithExtensions(enumVars, extensions, dataType); allowableValues.put("enumVars", enumVars); // handle default value for enum, e.g. available => StatusEnum.AVAILABLE @@ -5494,7 +5494,7 @@ protected List> buildEnumVars(List values, String da return enumVars; } - protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions) { + protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions, String dataType) { if (vendorExtensions != null) { updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-varnames", "name"); updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-descriptions", "enumDescription"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 8bddc1feaf5d..5eb54b986f84 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -1091,7 +1091,7 @@ public String toOperationId(String operationId) { // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true); operationId = camelize("call_" + operationId, true); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 31cc6311c60d..b5a9e61b448d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -17,9 +17,6 @@ package org.openapitools.codegen.languages; -import static org.openapitools.codegen.utils.StringUtils.camelize; -import static org.openapitools.codegen.utils.StringUtils.underscore; - import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; @@ -31,14 +28,13 @@ import java.util.Map; import java.util.Set; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.apache.commons.io.FilenameUtils; 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.CodegenProperty; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.DefaultCodegen; import org.openapitools.codegen.SupportingFile; @@ -55,6 +51,8 @@ import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import static org.openapitools.codegen.utils.StringUtils.*; + public class DartClientCodegen extends DefaultCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(DartClientCodegen.class); @@ -150,6 +148,7 @@ public DartClientCodegen() { typeMapping = new HashMap<>(); typeMapping.put("Array", "List"); typeMapping.put("array", "List"); + typeMapping.put("map", "Map"); typeMapping.put("List", "List"); typeMapping.put("boolean", "bool"); typeMapping.put("string", "String"); @@ -164,6 +163,7 @@ public DartClientCodegen() { typeMapping.put("integer", "int"); typeMapping.put("Date", "DateTime"); typeMapping.put("date", "DateTime"); + typeMapping.put("DateTime", "DateTime"); typeMapping.put("File", "MultipartFile"); typeMapping.put("binary", "MultipartFile"); typeMapping.put("UUID", "String"); @@ -352,23 +352,38 @@ public String modelDocFileFolder() { @Override public String toVarName(String name) { + return toVarName(name, "n"); + } + + private String toVarName(String name, String numberPrefix) { // replace - with _ e.g. created-at => created_at - name = name.replaceAll("-", "_"); + name = name.replace("-", "_"); + + // always need to replace leading underscores first + name = name.replaceAll("^_", ""); // if it's all upper case, do nothing if (name.matches("^[A-Z_]*$")) { return name; } + // replace all characters that have a mapping but ignore underscores + // append an underscore to each replacement so that it can be camelized + if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { + name = escape(name, specialCharReplacements, Lists.newArrayList("_"), "_"); + } + // remove the rest + name = sanitizeName(name); + // camelize (lower first character) the variable name // pet_id => petId name = camelize(name, true); if (name.matches("^\\d.*")) { - name = "n" + name; + name = numberPrefix + name; } - if (isReservedWord(name)) { + if (isReservedWord(name) || importMapping().containsKey(name)) { name = escapeReservedWord(name); } @@ -382,24 +397,41 @@ public String toParamName(String name) { } @Override - public String toModelName(String name) { - // model name cannot use reserved keyword, e.g. return - if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + camelize("model_" + name)); - name = "model_" + name; // e.g. return => ModelReturn (after camelize) + public String toModelName(final String name) { + if (importMapping().containsKey(name)) { + return name; } - if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); - name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) + String nameWithPrefixSuffix = sanitizeName(name); + if (!StringUtils.isEmpty(modelNamePrefix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix; } - if (typeMapping.containsValue(name)) { - return camelize(name); - } else { - // camelize the model name - return camelize(modelNamePrefix + "_" + name + "_" + modelNameSuffix); + if (!StringUtils.isEmpty(modelNameSuffix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix; + } + + // camelize the model name + // phone_number => PhoneNumber + final String camelizedName = camelize(nameWithPrefixSuffix); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + final String modelName = "Model" + camelizedName; + LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName); + return modelName; + } + + // model name starts with number + if (camelizedName.matches("^\\d.*")) { + final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); + return modelName; } + + return camelizedName; } @Override @@ -408,7 +440,7 @@ public String toModelFilename(String name) { } @Override public String toModelDocFilename(String name) { - return super.toModelDocFilename(toModelName(name)); + return toModelName(name); } @Override @@ -436,7 +468,7 @@ public String toDefaultValue(Schema schema) { if (schema.getDefault() != null) { if (ModelUtils.isStringSchema(schema)) { - return "'" + schema.getDefault().toString().replaceAll("'", "\\'") + "'"; + return "'" + schema.getDefault().toString().replace("'", "\\'") + "'"; } return schema.getDefault().toString(); } else { @@ -449,26 +481,22 @@ public String getTypeDeclaration(Schema p) { if (ModelUtils.isArraySchema(p)) { ArraySchema ap = (ArraySchema) p; Schema inner = ap.getItems(); - return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">"; + return instantiationTypes().get("array") + "<" + getTypeDeclaration(inner) + ">"; } else if (ModelUtils.isMapSchema(p)) { Schema inner = getAdditionalProperties(p); - - return getSchemaType(p) + ""; + return instantiationTypes().get("map") + ""; } return super.getTypeDeclaration(p); } @Override public String getSchemaType(Schema p) { - String openAPIType = super.getSchemaType(p); - String type; - if (typeMapping.containsKey(openAPIType)) { - type = typeMapping.get(openAPIType); - if (languageSpecificPrimitives.contains(type)) { - return type; - } - } else { - type = openAPIType; + String type = super.getSchemaType(p); + if (typeMapping.containsKey(type)) { + return typeMapping.get(type); + } + if (languageSpecificPrimitives.contains(type)) { + return type; } return toModelName(type); } @@ -479,65 +507,27 @@ public Map postProcessModels(Map objs) { } @Override - public Map postProcessModelsEnum(Map objs) { - List models = (List) objs.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - boolean succes = buildEnumFromVendorExtension(cm) || - buildEnumFromValues(cm); - for (CodegenProperty var : cm.vars) { - updateCodegenPropertyEnum(var); - } - } - return objs; - } - - /** - * Builds the set of enum members from their declared value. - * - * @return {@code true} if the enum was built - */ - private boolean buildEnumFromValues(CodegenModel cm) { - if (!cm.isEnum || cm.allowableValues == null) { - return false; - } - Map allowableValues = cm.allowableValues; - List values = (List) allowableValues.get("values"); - List> enumVars = buildEnumVars(values, cm.dataType); - cm.allowableValues.put("enumVars", enumVars); - return true; - } - - /** - * Builds the set of enum members from a vendor extension. - * - * @return {@code true} if the enum was built - */ - private boolean buildEnumFromVendorExtension(CodegenModel cm) { - if (!cm.isEnum || cm.allowableValues == null || - !useEnumExtension || - !cm.vendorExtensions.containsKey("x-enum-values")) { - return false; - } - Object extension = cm.vendorExtensions.get("x-enum-values"); - List> values = (List>) extension; - List> enumVars = new ArrayList<>(); - for (Map value : values) { - Map enumVar = new HashMap<>(); - String name = camelize((String) value.get("identifier"), true); - if (isReservedWord(name)) { - name = escapeReservedWord(name); - } - enumVar.put("name", name); - enumVar.put("value", toEnumValue(value.get("numericValue").toString(), cm.dataType)); - if (value.containsKey("description")) { - enumVar.put("description", value.get("description").toString()); + protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions, String dataType) { + if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) { + // Use the x-enum-values extension for this enum + // Existing enumVars added by the default handling need to be removed first + enumVars.clear(); + + Object extension = vendorExtensions.get("x-enum-values"); + List> values = (List>) extension; + for (Map value : values) { + Map enumVar = new HashMap<>(); + enumVar.put("name", toEnumVarName((String) value.get("identifier"), dataType)); + enumVar.put("value", toEnumValue(value.get("numericValue").toString(), dataType)); + enumVar.put("isString", isDataTypeString(dataType)); + if (value.containsKey("description")) { + enumVar.put("description", value.get("description").toString()); + } + enumVars.add(enumVar); } - enumVars.add(enumVar); + } else { + super.updateEnumVarsWithExtensions(enumVars, vendorExtensions, dataType); } - cm.allowableValues.put("enumVars", enumVars); - return true; } @Override @@ -545,12 +535,7 @@ public String toEnumVarName(String value, String datatype) { if (value.length() == 0) { return "empty"; } - String var = value.replaceAll("\\W+", "_"); - if ("number".equalsIgnoreCase(datatype) || - "int".equalsIgnoreCase(datatype)) { - var = "Number" + var; - } - return escapeReservedWord(camelize(var, true)); + return toVarName(value, "number"); } @Override @@ -565,6 +550,10 @@ public String toEnumValue(String value, String datatype) { @Override public String toOperationId(String operationId) { + operationId = super.toOperationId(operationId); + + operationId = camelize(sanitizeName(operationId), true); + // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { String newOperationId = camelize("call_" + operationId, true); @@ -572,7 +561,13 @@ public String toOperationId(String operationId) { return newOperationId; } - return camelize(operationId, true); + // operationId starts with a number + if (operationId.matches("^\\d.*")) { + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true); + operationId = camelize("call_" + operationId, true); + } + + return operationId; } public void setPubLibrary(String pubLibrary) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 34dfd1c9cd88..9c2b13abf1bb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -132,22 +132,6 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc addImport(codegenModel, codegenModel.additionalPropertiesType); } - @Override - public String toEnumVarName(String name, String datatype) { - if (name.length() == 0) { - return "empty"; - } - if ("number".equalsIgnoreCase(datatype) || "int".equalsIgnoreCase(datatype)) { - name = "Number" + name; - } - name = camelize(name, true); - // for reserved word or word starting with number, append _ - if (isReservedWord(name) || name.matches("^\\d.*")) { - name = escapeReservedWord(name); - } - return name; - } - @Override public void processOpts() { defaultProcessOpts(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MarkdownDocumentationCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MarkdownDocumentationCodegen.java index 23795ff4bef0..463bdb147b28 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MarkdownDocumentationCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MarkdownDocumentationCodegen.java @@ -48,7 +48,7 @@ public MarkdownDocumentationCodegen() { } @Override - protected void initalizeSpecialCharacterMapping() { + protected void initializeSpecialCharacterMapping() { // escape only those symbols that can mess up markdown specialCharReplacements.put("\\", "\\\\"); specialCharReplacements.put("/", "\\/"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index cf7a01d188ce..afc29d252789 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -450,7 +450,7 @@ public void updateCodegenPropertyEnum(CodegenProperty var) { if (referencedSchema != null) { extensions = referencedSchema.getExtensions(); } - updateEnumVarsWithExtensions(enumVars, extensions); + updateEnumVarsWithExtensions(enumVars, extensions, dataType); allowableValues.put("enumVars", enumVars); // overwriting defaultValue omitted from here } diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache index 9d6dd3022fa5..efc0aca0a1bb 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -26,7 +26,7 @@ class {{{classname}}} { {{#allowableValues}} {{#enumVars}} - static const {{#lambda.lowercase}}{{{name}}}{{/lambda.lowercase}} = {{{classname}}}._({{{value}}}); + static const {{{name}}} = {{{classname}}}._({{{value}}}); {{/enumVars}} {{/allowableValues}} @@ -34,7 +34,7 @@ class {{{classname}}} { static const values = <{{{classname}}}>[ {{#allowableValues}} {{#enumVars}} - {{#lambda.lowercase}}{{{name}}}{{/lambda.lowercase}}, + {{{name}}}, {{/enumVars}} {{/allowableValues}} ]; @@ -71,7 +71,7 @@ class {{{classname}}}TypeTransformer { switch (data) { {{#allowableValues}} {{#enumVars}} - case {{{value}}}: return {{{classname}}}.{{#lambda.lowercase}}{{{name}}}{{/lambda.lowercase}}; + case {{{value}}}: return {{{classname}}}.{{{name}}}; {{/enumVars}} {{/allowableValues}} default: diff --git a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache index f77a0a371037..9a307abb5489 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache @@ -26,7 +26,7 @@ class {{{classname}}}{{{enumName}}} { {{#allowableValues}} {{#enumVars}} - static const {{#lambda.lowercase}}{{{name}}}{{/lambda.lowercase}} = {{{classname}}}{{{enumName}}}._({{{value}}}); + static const {{{name}}} = {{{classname}}}{{{enumName}}}._({{{value}}}); {{/enumVars}} {{/allowableValues}} @@ -34,7 +34,7 @@ class {{{classname}}}{{{enumName}}} { static const values = <{{{classname}}}{{{enumName}}}>[ {{#allowableValues}} {{#enumVars}} - {{#lambda.lowercase}}{{{name}}}{{/lambda.lowercase}}, + {{{name}}}, {{/enumVars}} {{/allowableValues}} ]; @@ -71,7 +71,7 @@ class {{{classname}}}{{{enumName}}}TypeTransformer { switch (data) { {{#allowableValues}} {{#enumVars}} - case {{{value}}}: return {{{classname}}}{{{enumName}}}.{{#lambda.lowercase}}{{{name}}}{{/lambda.lowercase}}; + case {{{value}}}: return {{{classname}}}{{{enumName}}}.{{{name}}}; {{/enumVars}} {{/allowableValues}} default: diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index cef1d10be352..9233174859a1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -516,7 +516,7 @@ public void updateCodegenPropertyEnum() { } @Test - public void updateCodegenPropertyEnumWithExtention() { + public void updateCodegenPropertyEnumWithExtension() { { CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("dog", "cat"), Arrays.asList("DOGVAR", "CATVAR")); (new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java index 557d3a315f84..375c7c00cd06 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java @@ -26,6 +26,8 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.util.*; + @SuppressWarnings("static-method") public class DartModelTest { @@ -280,13 +282,10 @@ public void mapModelTest() { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "a map model"); Assert.assertEquals(cm.vars.size(), 0); - // {{imports}} is not used in template - //Assert.assertEquals(cm.imports.size(), 2); - //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); } @DataProvider(name = "modelNames") - public static Object[][] primeNumbers() { + public static Object[][] modelNames() { return new Object[][] { {"sample", "Sample"}, {"sample_name", "SampleName"}, @@ -295,6 +294,7 @@ public static Object[][] primeNumbers() { {"\\sample", "\\Sample"}, {"sample.name", "SampleName"}, {"_sample", "Sample"}, + {"sample name", "SampleName"}, }; } @@ -310,14 +310,176 @@ public void modelNameTest(String name, String expectedName) { Assert.assertEquals(cm.classname, codegen.toModelName(expectedName)); } - @Test(description = "test enum variable names for reserved words") - public void testReservedWord() throws Exception { + @DataProvider(name = "varNames") + public static Object[][] varNames() { + return new Object[][] { + {"Double", "double_"}, + {"double", "double_"}, + {"dynamic", "dynamic_"}, + {"String", "string"}, + {"string", "string"}, + {"hello", "hello"}, + {"FOO", "FOO"}, + {"FOO_BAR", "FOO_BAR"}, + {"FOO_BAR_BAZ_", "FOO_BAR_BAZ_"}, + {"123hello", "n123hello"}, + {"_hello", "hello"}, + {"_double", "double_"}, + {"_123hello", "n123hello"}, + {"_5FOO", "n5fOO"}, + {"_FOO", "FOO"}, + {"_$foo", "dollarFoo"}, + {"_$_foo_", "dollarFoo"}, + {"$special[property.name]", "dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket"}, + {"foo bar", "fooBar"}, + }; + } + + @Test(dataProvider = "varNames", description = "test variable names are correctly escaped") + public void convertVarName(String name, String expectedName) { + final DefaultCodegen codegen = new DartClientCodegen(); + Assert.assertEquals(codegen.toVarName(name), expectedName); + } + + @DataProvider(name = "enumVarNames") + public static Object[][] enumVarNames() { + return new Object[][] { + {"", "empty"}, + {"Double", "double_"}, + {"double", "double_"}, + {"dynamic", "dynamic_"}, + {"String", "string"}, + {"string", "string"}, + {"hello", "hello"}, + {"FOO", "FOO"}, + {"FOO_BAR", "FOO_BAR"}, + {"FOO_BAR_BAZ_", "FOO_BAR_BAZ_"}, + {"123hello", "number123hello"}, + {"_hello", "hello"}, + {"_double", "double_"}, + {"_123hello", "number123hello"}, + {"_5FOO", "number5fOO"}, + {"_FOO", "FOO"}, + {"_$foo", "dollarFoo"}, + {"_$_foo_", "dollarFoo"}, + {"$special[property.name]", "dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket"}, + {"$", "dollar"}, + {">=", "greaterThanEqual"}, + {"foo bar", "fooBar"}, + }; + } + + @Test(dataProvider = "enumVarNames", description = "test enum names are correctly escaped") + public void convertEnumVarNames(String name, String expectedName) { + final DefaultCodegen codegen = new DartClientCodegen(); + Assert.assertEquals(codegen.toEnumVarName(name, null), expectedName); + } + + @Test(description = "model names support `--model-name-prefix` and `--model-name-suffix`") + public void modelPrefixSuffixTest() { + final DefaultCodegen codegen = new DartClientCodegen(); + codegen.setModelNamePrefix("model"); + codegen.setModelNameSuffix("type"); + + Assert.assertEquals(codegen.toModelName("hello_test"), "ModelHelloTestType"); + } + + @Test(description = "support normal enum values") + public void testEnumValues() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("testStringEnum", new StringSchema()._enum(Arrays.asList("foo", "bar"))) + .addProperties("testIntEnum", new IntegerSchema().addEnumItem(1).addEnumItem(2)); final DefaultCodegen codegen = new DartClientCodegen(); - Assert.assertEquals(codegen.toEnumVarName("public", null), "public_"); - Assert.assertEquals(codegen.toEnumVarName("Private", null), "private_"); - Assert.assertEquals(codegen.toEnumVarName("IF", null), "iF_"); - // should not escape non-reserved - Assert.assertEquals(codegen.toEnumVarName("hello", null), "hello_"); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + codegen.postProcessModels(Collections.singletonMap("models", Collections.singletonList(Collections.singletonMap("model", cm)))); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "testStringEnum"); + Assert.assertEquals(property1.dataType, "String"); + Assert.assertEquals(property1.baseType, "String"); + Assert.assertEquals(property1.datatypeWithEnum, "TestStringEnumEnum"); + Assert.assertEquals(property1.name, "testStringEnum"); + Assert.assertTrue(property1.isEnum); + Assert.assertEquals(property1.allowableValues.size(), 2); + Assert.assertEquals(((List) property1.allowableValues.get("values")).size(), 2); + List> enumVars1 = (List>) property1.allowableValues.get("enumVars"); + Assert.assertEquals(enumVars1.size(), 2); + + Assert.assertEquals(enumVars1.get(0).get("name"), "foo"); + Assert.assertEquals(enumVars1.get(0).get("value"), "'foo'"); + Assert.assertEquals(enumVars1.get(0).get("isString"), true); + + Assert.assertEquals(enumVars1.get(1).get("name"), "bar"); + Assert.assertEquals(enumVars1.get(1).get("value"), "'bar'"); + Assert.assertEquals(enumVars1.get(1).get("isString"), true); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "testIntEnum"); + Assert.assertEquals(property2.dataType, "int"); + Assert.assertEquals(property2.baseType, "int"); + Assert.assertEquals(property2.datatypeWithEnum, "TestIntEnumEnum"); + Assert.assertEquals(property2.name, "testIntEnum"); + Assert.assertTrue(property2.isEnum); + Assert.assertEquals(property2.allowableValues.size(), 2); + Assert.assertEquals(((List) property2.allowableValues.get("values")).size(), 2); + List> enumVars2 = (List>) property2.allowableValues.get("enumVars"); + Assert.assertEquals(enumVars2.size(), 2); + + Assert.assertEquals(enumVars2.get(0).get("name"), "number1"); + Assert.assertEquals(enumVars2.get(0).get("value"), "1"); + Assert.assertEquals(enumVars2.get(0).get("isString"), false); + + Assert.assertEquals(enumVars2.get(1).get("name"), "number2"); + Assert.assertEquals(enumVars2.get(1).get("value"), "2"); + Assert.assertEquals(enumVars2.get(1).get("isString"), false); + } + + @Test(description = "support for x-enum-values extension") + public void testXEnumValuesExtension() { + final Map enumValue1 = new HashMap<>(); + enumValue1.put("identifier", "foo"); + enumValue1.put("numericValue", 1); + enumValue1.put("description", "the foo"); + final Map enumValue2 = new HashMap<>(); + enumValue2.put("identifier", "bar"); + enumValue2.put("numericValue", 2); + enumValue2.put("description", "the bar"); + + final Schema model = new Schema() + .description("a sample model") + .addProperties("testIntEnum", new IntegerSchema().addEnumItem(1).addEnumItem(2) + .extensions(Collections.singletonMap("x-enum-values", Arrays.asList(enumValue1, enumValue2)))); + final DartClientCodegen codegen = new DartClientCodegen(); + codegen.setUseEnumExtension(true); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + codegen.postProcessModels(Collections.singletonMap("models", Collections.singletonList(Collections.singletonMap("model", cm)))); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "testIntEnum"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertEquals(property1.datatypeWithEnum, "TestIntEnumEnum"); + Assert.assertEquals(property1.name, "testIntEnum"); + Assert.assertTrue(property1.isEnum); + Assert.assertEquals(property1.allowableValues.size(), 2); + Assert.assertEquals(((List) property1.allowableValues.get("values")).size(), 2); + List> enumVars = (List>) property1.allowableValues.get("enumVars"); + Assert.assertEquals(enumVars.size(), 2); + + Assert.assertEquals(enumVars.get(0).get("name"), "foo"); + Assert.assertEquals(enumVars.get(0).get("value"), "1"); + Assert.assertEquals(enumVars.get(0).get("isString"), false); + Assert.assertEquals(enumVars.get(0).get("description"), "the foo"); + + Assert.assertEquals(enumVars.get(1).get("name"), "bar"); + Assert.assertEquals(enumVars.get(1).get("value"), "2"); + Assert.assertEquals(enumVars.get(1).get("isString"), false); + Assert.assertEquals(enumVars.get(1).get("description"), "the bar"); } // datetime (or primitive type) not yet supported in HTTP request body diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java index e7ec5c5687b6..44bf10b3a92a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java @@ -328,7 +328,6 @@ public void arrayModelTest() { Assert.assertTrue(cm.isArray); Assert.assertEquals(cm.description, "an array model"); Assert.assertEquals(cm.vars.size(), 0); - // skip import test as import is not used by PHP codegen } @Test(description = "convert a map model") @@ -345,21 +344,12 @@ public void mapModelTest() { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "a map model"); Assert.assertEquals(cm.vars.size(), 0); - // {{imports}} is not used in template - //Assert.assertEquals(cm.imports.size(), 2); - //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); } @DataProvider(name = "modelNames") - public static Object[][] primeNumbers() { + public static Object[][] modelNames() { return new Object[][] { - {"sample", "Sample"}, - {"sample_name", "SampleName"}, - {"sample__name", "SampleName"}, - {"/sample", "Sample"}, - {"\\sample", "Sample"}, - {"sample.name", "SampleName"}, - {"_sample", "Sample"}, + {"EnumClass", "ModelEnumClass"}, }; } @@ -374,30 +364,4 @@ public void modelNameTest(String name, String expectedName) { Assert.assertEquals(cm.name, name); Assert.assertEquals(cm.classname, expectedName); } - - @Test(description = "test enum variable names for reserved words") - public void testReservedWord() throws Exception { - final DefaultCodegen codegen = new DartDioClientCodegen(); - Assert.assertEquals(codegen.toEnumVarName("assert", null), "assert_"); - Assert.assertEquals(codegen.toEnumVarName("default", null), "default_"); - Assert.assertEquals(codegen.toEnumVarName("IF", null), "iF_"); - // should not escape non-reserved - Assert.assertEquals(codegen.toEnumVarName("hello", null), "hello"); - } - - // datetime (or primitive type) not yet supported in HTTP request body - @Test(description = "returns DateTime when using `--model-name-prefix`") - public void dateTest() { - final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/datePropertyTest.json"); - final DefaultCodegen codegen = new DartDioClientCodegen(); - codegen.setModelNamePrefix("foo"); - codegen.setOpenAPI(openAPI); - - final String path = "/tests/dateResponse"; - final Operation p = openAPI.getPaths().get(path).getPost(); - final CodegenOperation op = codegen.fromOperation(path, "post", p, null); - - Assert.assertEquals(op.returnType, "DateTime"); - Assert.assertEquals(op.bodyParam.dataType, "DateTime"); - } } diff --git a/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart index ada6c5fd444a..0b80d597c6c8 100644 --- a/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart +++ b/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:math'; import 'package:http/http.dart'; import 'package:openapi/api.dart'; @@ -39,11 +38,10 @@ void main() { /// Setup the fake client then call [petApi.addPet] Future addPet(Pet pet) { petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(pet), - postResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(pet), + postResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); return petApi.addPet(pet); } @@ -54,11 +52,10 @@ void main() { // use the pet api to add a pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); // retrieve the same pet by id @@ -88,19 +85,16 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); // delete the pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - expectedHeaders: { - 'api_key': 'special-key' - }, + expectedHeaders: {'api_key': 'special-key'}, deleteResponseBody: '', ); await petApi.deletePet(id, apiKey: 'special-key'); @@ -120,11 +114,10 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); final multipartRequest = MultipartRequest(null, null); @@ -160,20 +153,18 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); // update the same pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPutRequestBody: petApi.apiClient.serialize(updatePet), - putResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPutRequestBody: petApi.apiClient.serialize(updatePet), + putResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.updatePet(updatePet); // check update worked @@ -189,10 +180,10 @@ void main() { final id1 = newId(); final id2 = newId(); final id3 = newId(); - final status = PetStatusEnum.available_.value; + final status = PetStatusEnum.available.value; final pet1 = makePet(id: id1, status: status); final pet2 = makePet(id: id2, status: status); - final pet3 = makePet(id: id3, status: PetStatusEnum.sold_.value); + final pet3 = makePet(id: id3, status: PetStatusEnum.sold.value); return Future.wait([addPet(pet1), addPet(pet2), addPet(pet3)]) .then((_) async { @@ -205,7 +196,8 @@ void main() { final pets = await petApi.findPetsByStatus([status]); // tests serialisation and deserialisation of enum - final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available_); + final petsByStatus = + pets.where((p) => p.status == PetStatusEnum.available); expect(petsByStatus.length, equals(2)); final petIds = pets.map((pet) => pet.id).toList(); expect(petIds, contains(id1)); @@ -223,11 +215,10 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: '', - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: '', + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); petApi.apiClient.client = FakeClient( diff --git a/samples/client/petstore/dart2/petstore/test/pet_test.dart b/samples/client/petstore/dart2/petstore/test/pet_test.dart index 10a71acd9a09..e480ec7baa08 100644 --- a/samples/client/petstore/dart2/petstore/test/pet_test.dart +++ b/samples/client/petstore/dart2/petstore/test/pet_test.dart @@ -27,12 +27,12 @@ void main() { ]; return Pet( - id : id, + id: id, category: category, name: name, //required field tags: tags, photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field - ) + ) ..status = PetStatusEnum.fromJson(status) ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; } @@ -81,12 +81,12 @@ void main() { var id1 = newId(); var id2 = newId(); var id3 = newId(); - var status = PetStatusEnum.available_.value; + var status = PetStatusEnum.available.value; return Future.wait([ petApi.addPet(makePet(id: id1, status: status)), petApi.addPet(makePet(id: id2, status: status)), - petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold_.value)) + petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold.value)) ]).then((_) async { var pets = await petApi.findPetsByStatus([status]); var petIds = pets.map((pet) => pet.id).toList(); diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 4ba9c2ea96d9..e6660d5a08a5 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -143,15 +143,15 @@ class OrderStatusEnum { String toJson() => value; - static const placed_ = OrderStatusEnum._('placed'); - static const approved_ = OrderStatusEnum._('approved'); - static const delivered_ = OrderStatusEnum._('delivered'); + static const placed = OrderStatusEnum._('placed'); + static const approved = OrderStatusEnum._('approved'); + static const delivered = OrderStatusEnum._('delivered'); /// List of all possible values in this [enum][OrderStatusEnum]. static const values = [ - placed_, - approved_, - delivered_, + placed, + approved, + delivered, ]; static OrderStatusEnum fromJson(dynamic value) => @@ -184,9 +184,9 @@ class OrderStatusEnumTypeTransformer { /// and users are still using an old app with the old code. OrderStatusEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'placed': return OrderStatusEnum.placed_; - case 'approved': return OrderStatusEnum.approved_; - case 'delivered': return OrderStatusEnum.delivered_; + case 'placed': return OrderStatusEnum.placed; + case 'approved': return OrderStatusEnum.approved; + case 'delivered': return OrderStatusEnum.delivered; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index 1fb0d7b04057..76ca801b9f4d 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -143,15 +143,15 @@ class PetStatusEnum { String toJson() => value; - static const available_ = PetStatusEnum._('available'); - static const pending_ = PetStatusEnum._('pending'); - static const sold_ = PetStatusEnum._('sold'); + static const available = PetStatusEnum._('available'); + static const pending = PetStatusEnum._('pending'); + static const sold = PetStatusEnum._('sold'); /// List of all possible values in this [enum][PetStatusEnum]. static const values = [ - available_, - pending_, - sold_, + available, + pending, + sold, ]; static PetStatusEnum fromJson(dynamic value) => @@ -184,9 +184,9 @@ class PetStatusEnumTypeTransformer { /// and users are still using an old app with the old code. PetStatusEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'available': return PetStatusEnum.available_; - case 'pending': return PetStatusEnum.pending_; - case 'sold': return PetStatusEnum.sold_; + case 'available': return PetStatusEnum.available; + case 'pending': return PetStatusEnum.pending; + case 'sold': return PetStatusEnum.sold; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index 138e830c1b93..67baa9a055f8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -44,10 +44,10 @@ var api_instance = new AnotherFakeApi(); var client = new Client(); // Client | client model try { - var result = api_instance.123test@$%SpecialTags(client); + var result = api_instance.call123testSpecialTags(client); print(result); } catch (e) { - print("Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n"); + print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); } ``` @@ -58,7 +58,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**123test@$%SpecialTags**](doc//AnotherFakeApi.md#123test@$%specialtags) | **patch** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **patch** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **get** /foo | *FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md index ecefd25af6e1..2d116c6f3674 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -9,11 +9,11 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**123test@$%SpecialTags**](AnotherFakeApi.md#123test@$%SpecialTags) | **patch** /another-fake/dummy | To test special tags +[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **patch** /another-fake/dummy | To test special tags -# **123test@$%SpecialTags** -> Client 123test@$%SpecialTags(client) +# **call123testSpecialTags** +> Client call123testSpecialTags(client) To test special tags @@ -27,10 +27,10 @@ var api_instance = new AnotherFakeApi(); var client = new Client(); // Client | client model try { - var result = api_instance.123test@$%SpecialTags(client); + var result = api_instance.call123testSpecialTags(client); print(result); } catch (e) { - print("Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n"); + print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); } ``` diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md index 6126109bdd88..20c8e7ecf2f0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md @@ -410,7 +410,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **testEndpointParameters** -> testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -425,7 +425,7 @@ import 'package:openapi/api.dart'; var api_instance = new FakeApi(); var number = 8.14; // num | None -var double = 1.2; // double | None +var double_ = 1.2; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None var byte = BYTE_ARRAY_DATA_HERE; // String | None var integer = 56; // int | None @@ -440,7 +440,7 @@ var password = password_example; // String | None var callback = callback_example; // String | None try { - api_instance.testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); } catch (e) { print("Exception when calling FakeApi->testEndpointParameters: $e\n"); } @@ -451,7 +451,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **number** | **num**| None | [default to null] - **double** | **double**| None | [default to null] + **double_** | **double**| None | [default to null] **patternWithoutDelimiter** | **String**| None | [default to null] **byte** | **String**| None | [default to null] **integer** | **int**| None | [optional] [default to null] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md index 02c899028282..ec72d8f3abee 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FormatTest.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **int64** | **int** | | [optional] [default to null] **number** | **num** | | [default to null] **float** | **double** | | [optional] [default to null] -**double** | **double** | | [optional] [default to null] +**double_** | **double** | | [optional] [default to null] **decimal** | **double** | | [optional] [default to null] **string** | **String** | | [optional] [default to null] **byte** | **String** | | [default to null] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md index ec71d5f41f44..9339321662b6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineObject3.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **int64** | **int** | None | [optional] [default to null] **number** | **num** | None | [default to null] **float** | **double** | None | [optional] [default to null] -**double** | **double** | None | [default to null] +**double_** | **double** | None | [default to null] **string** | **String** | None | [optional] [default to null] **patternWithoutDelimiter** | **String** | None | [default to null] **byte** | **String** | None | [default to null] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md index 69251c785b50..780f12a1aaed 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/SpecialModelName.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**$special[propertyName]** | **int** | | [optional] [default to null] +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart index 795cbc91c98d..f18394e15c8d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -16,7 +16,7 @@ class AnotherFakeApi { /// To test special tags /// /// To test special tags and operation ID starting with number - Future>123test@$%SpecialTags(Client client,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + Future>call123testSpecialTags(Client client,{ CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/another-fake/dummy"; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index 34456593f10a..3ec6259b83f8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -446,7 +446,7 @@ class FakeApi { /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - FuturetestEndpointParameters(num number,double double,String patternWithoutDelimiter,String byte,{ int integer,int int32,int int64,double float,String string,Uint8List binary,DateTime date,DateTime dateTime,String password,String callback,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { + FuturetestEndpointParameters(num number,double double_,String patternWithoutDelimiter,String byte,{ int integer,int int32,int int64,double float,String string,Uint8List binary,DateTime date,DateTime dateTime,String password,String callback,CancelToken cancelToken, Map headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async { String _path = "/fake"; @@ -465,7 +465,7 @@ class FakeApi { formData[r'int64'] = parameterToString(_serializers, int64); formData[r'number'] = parameterToString(_serializers, number); formData[r'float'] = parameterToString(_serializers, float); - formData[r'double'] = parameterToString(_serializers, double); + formData[r'double'] = parameterToString(_serializers, double_); formData[r'string'] = parameterToString(_serializers, string); formData[r'pattern_without_delimiter'] = parameterToString(_serializers, patternWithoutDelimiter); formData[r'byte'] = parameterToString(_serializers, byte); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart index 48064167ea82..7c1007142a1f 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -27,9 +27,9 @@ abstract class EnumArrays implements Built { class EnumArraysJustSymbol extends EnumClass { @BuiltValueEnumConst(wireName: '>=') - static const EnumArraysJustSymbol >= = _$enumArraysJustSymbol_>=; + static const EnumArraysJustSymbol greaterThanEqual = _$enumArraysJustSymbol_greaterThanEqual; @BuiltValueEnumConst(wireName: '$') - static const EnumArraysJustSymbol $ = _$enumArraysJustSymbol_$; + static const EnumArraysJustSymbol dollar = _$enumArraysJustSymbol_dollar; static Serializer get serializer => _$enumArraysJustSymbolSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart index 0788d1778b6e..a9ce7fc6c602 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/enum_test.dart @@ -61,7 +61,7 @@ abstract class EnumTest implements Built { class EnumTestEnumString extends EnumClass { @BuiltValueEnumConst(wireName: 'UPPER') - static const EnumTestEnumString uPPER = _$enumTestEnumString_uPPER; + static const EnumTestEnumString UPPER = _$enumTestEnumString_UPPER; @BuiltValueEnumConst(wireName: 'lower') static const EnumTestEnumString lower = _$enumTestEnumString_lower; @BuiltValueEnumConst(wireName: '') @@ -79,7 +79,7 @@ class EnumTestEnumString extends EnumClass { class EnumTestEnumStringRequired extends EnumClass { @BuiltValueEnumConst(wireName: 'UPPER') - static const EnumTestEnumStringRequired uPPER = _$enumTestEnumStringRequired_uPPER; + static const EnumTestEnumStringRequired UPPER = _$enumTestEnumStringRequired_UPPER; @BuiltValueEnumConst(wireName: 'lower') static const EnumTestEnumStringRequired lower = _$enumTestEnumStringRequired_lower; @BuiltValueEnumConst(wireName: '') @@ -113,9 +113,9 @@ class EnumTestEnumInteger extends EnumClass { class EnumTestEnumNumber extends EnumClass { @BuiltValueEnumConst(wireName: '1.1') - static const EnumTestEnumNumber 11_ = _$enumTestEnumNumber_11_; + static const EnumTestEnumNumber number1period1 = _$enumTestEnumNumber_number1period1; @BuiltValueEnumConst(wireName: '-1.2') - static const EnumTestEnumNumber 12_ = _$enumTestEnumNumber_12_; + static const EnumTestEnumNumber number1period2 = _$enumTestEnumNumber_number1period2; static Serializer get serializer => _$enumTestEnumNumberSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart index a7747a35e16c..de4c8bb51db5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/format_test.dart @@ -29,7 +29,7 @@ abstract class FormatTest implements Built { @nullable @BuiltValueField(wireName: r'double') - double get double; + double get double_; @nullable @BuiltValueField(wireName: r'decimal') diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart index 936eed83abd4..37b93d3c3e68 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object2.dart @@ -28,10 +28,10 @@ class InlineObject2EnumFormStringArray extends EnumClass { /// Form parameter enum test (string array) @BuiltValueEnumConst(wireName: '>') - static const InlineObject2EnumFormStringArray > = _$inlineObject2EnumFormStringArray_>; + static const InlineObject2EnumFormStringArray greaterThan = _$inlineObject2EnumFormStringArray_greaterThan; /// Form parameter enum test (string array) @BuiltValueEnumConst(wireName: '$') - static const InlineObject2EnumFormStringArray $ = _$inlineObject2EnumFormStringArray_$; + static const InlineObject2EnumFormStringArray dollar = _$inlineObject2EnumFormStringArray_dollar; static Serializer get serializer => _$inlineObject2EnumFormStringArraySerializer; @@ -52,7 +52,7 @@ class InlineObject2EnumFormString extends EnumClass { static const InlineObject2EnumFormString efg = _$inlineObject2EnumFormString_efg; /// Form parameter enum test (string) @BuiltValueEnumConst(wireName: '(xyz)') - static const InlineObject2EnumFormString (xyz) = _$inlineObject2EnumFormString_(xyz); + static const InlineObject2EnumFormString leftParenthesisXyzRightParenthesis = _$inlineObject2EnumFormString_leftParenthesisXyzRightParenthesis; static Serializer get serializer => _$inlineObject2EnumFormStringSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart index 19e26a0e069b..960cb97aa6e3 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/inline_object3.dart @@ -29,7 +29,7 @@ abstract class InlineObject3 implements Built { class MapTestMapOfEnumString extends EnumClass { @BuiltValueEnumConst(wireName: 'UPPER') - static const MapTestMapOfEnumString uPPER = _$mapTestMapOfEnumString_uPPER; + static const MapTestMapOfEnumString UPPER = _$mapTestMapOfEnumString_UPPER; @BuiltValueEnumConst(wireName: 'lower') static const MapTestMapOfEnumString lower = _$mapTestMapOfEnumString_lower; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_enum_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_enum_class.dart index a43af990446d..3b7c5386a1dc 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_enum_class.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/model_enum_class.dart @@ -11,7 +11,7 @@ class ModelEnumClass extends EnumClass { @BuiltValueEnumConst(wireName: '-efg') static const ModelEnumClass efg = _$efg; @BuiltValueEnumConst(wireName: '(xyz)') - static const ModelEnumClass (xyz) = _$(xyz); + static const ModelEnumClass leftParenthesisXyzRightParenthesis = _$leftParenthesisXyzRightParenthesis; static Serializer get serializer => _$modelEnumClassSerializer; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart index 9d3dd4d7be7e..583d07d9b1b2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -8,7 +8,7 @@ abstract class SpecialModelName implements Built 123test@$%SpecialTags(Client client) async - test('test 123test@$%SpecialTags', () async { + //Future call123testSpecialTags(Client client) async + test('test call123testSpecialTags', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart index 1450145c2ab8..3fc5ab60ada3 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart @@ -75,7 +75,7 @@ void main() { // // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 // - //Future testEndpointParameters(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, Uint8List binary, DateTime date, DateTime dateTime, String password, String callback }) async + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, Uint8List binary, DateTime date, DateTime dateTime, String password, String callback }) async test('test testEndpointParameters', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart index 4850f7618fcf..5630c432b686 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/format_test_test.dart @@ -31,12 +31,12 @@ void main() { // TODO }); - // double double (default value: null) - test('to test the property `double`', () async { + // double double_ (default value: null) + test('to test the property `double_`', () async { // TODO }); - // Decimal decimal (default value: null) + // double decimal (default value: null) test('to test the property `decimal`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart index 43c7490c444d..d913891721cf 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_object3_test.dart @@ -37,8 +37,8 @@ void main() { }); // None - // double double (default value: null) - test('to test the property `double`', () async { + // double double_ (default value: null) + test('to test the property `double_`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart index 5747c9d1b678..f23c11a347bc 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/special_model_name_test.dart @@ -6,8 +6,8 @@ void main() { final instance = SpecialModelName(); group(SpecialModelName, () { - // int $special[propertyName] (default value: null) - test('to test the property `$special[propertyName]`', () async { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket (default value: null) + test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart index 41f66951484d..70f1b0d6bebe 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:math'; import 'package:http/http.dart'; import 'package:openapi/api.dart'; @@ -39,11 +38,10 @@ void main() { /// Setup the fake client then call [petApi.addPet] Future addPet(Pet pet) { petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(pet), - postResponseBody: petApi.apiClient.serialize(pet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(pet), + postResponseBody: petApi.apiClient.serialize(pet), + expectedHeaders: {'Content-Type': 'application/json'}); return petApi.addPet(pet); } @@ -54,11 +52,10 @@ void main() { // use the pet api to add a pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: petApi.apiClient.serialize(newPet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); // retrieve the same pet by id @@ -88,19 +85,16 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: petApi.apiClient.serialize(newPet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); // delete the pet petApi.apiClient.client = FakeClient( expectedUrl: 'http://petstore.swagger.io/v2/pet/$id', - expectedHeaders: { - 'api_key': 'special-key' - }, + expectedHeaders: {'api_key': 'special-key'}, deleteResponseBody: '', ); await petApi.deletePet(id, apiKey: 'special-key'); @@ -120,11 +114,10 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: petApi.apiClient.serialize(newPet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); final multipartRequest = MultipartRequest(null, null); @@ -160,20 +153,18 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: petApi.apiClient.serialize(newPet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); // update the same pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPutRequestBody: petApi.apiClient.serialize(updatePet), - putResponseBody: petApi.apiClient.serialize(updatePet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPutRequestBody: petApi.apiClient.serialize(updatePet), + putResponseBody: petApi.apiClient.serialize(updatePet), + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.updatePet(updatePet); // check update worked @@ -189,10 +180,10 @@ void main() { final id1 = newId(); final id2 = newId(); final id3 = newId(); - final status = PetStatusEnum.available_.value; + final status = PetStatusEnum.available.value; final pet1 = makePet(id: id1, status: status); final pet2 = makePet(id: id2, status: status); - final pet3 = makePet(id: id3, status: PetStatusEnum.sold_.value); + final pet3 = makePet(id: id3, status: PetStatusEnum.sold.value); return Future.wait([addPet(pet1), addPet(pet2), addPet(pet3)]) .then((_) async { @@ -205,7 +196,8 @@ void main() { final pets = await petApi.findPetsByStatus([status]); // tests serialisation and deserialisation of enum - final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available_); + final petsByStatus = + pets.where((p) => p.status == PetStatusEnum.available); expect(petsByStatus.length, equals(2)); final petIds = pets.map((pet) => pet.id).toList(); expect(petIds, contains(id1)); @@ -223,11 +215,10 @@ void main() { // add a new pet petApi.apiClient.client = FakeClient( - expectedUrl: 'http://petstore.swagger.io/v2/pet', - expectedPostRequestBody: petApi.apiClient.serialize(newPet), - postResponseBody: petApi.apiClient.serialize(newPet), - expectedHeaders: { 'Content-Type': 'application/json' } - ); + expectedUrl: 'http://petstore.swagger.io/v2/pet', + expectedPostRequestBody: petApi.apiClient.serialize(newPet), + postResponseBody: petApi.apiClient.serialize(newPet), + expectedHeaders: {'Content-Type': 'application/json'}); await petApi.addPet(newPet); petApi.apiClient.client = FakeClient( diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart index 10a71acd9a09..e480ec7baa08 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart @@ -27,12 +27,12 @@ void main() { ]; return Pet( - id : id, + id: id, category: category, name: name, //required field tags: tags, photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field - ) + ) ..status = PetStatusEnum.fromJson(status) ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; } @@ -81,12 +81,12 @@ void main() { var id1 = newId(); var id2 = newId(); var id3 = newId(); - var status = PetStatusEnum.available_.value; + var status = PetStatusEnum.available.value; return Future.wait([ petApi.addPet(makePet(id: id1, status: status)), petApi.addPet(makePet(id: id2, status: status)), - petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold_.value)) + petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold.value)) ]).then((_) async { var pets = await petApi.findPetsByStatus([status]); var petIds = pets.map((pet) => pet.id).toList(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 4ba9c2ea96d9..e6660d5a08a5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -143,15 +143,15 @@ class OrderStatusEnum { String toJson() => value; - static const placed_ = OrderStatusEnum._('placed'); - static const approved_ = OrderStatusEnum._('approved'); - static const delivered_ = OrderStatusEnum._('delivered'); + static const placed = OrderStatusEnum._('placed'); + static const approved = OrderStatusEnum._('approved'); + static const delivered = OrderStatusEnum._('delivered'); /// List of all possible values in this [enum][OrderStatusEnum]. static const values = [ - placed_, - approved_, - delivered_, + placed, + approved, + delivered, ]; static OrderStatusEnum fromJson(dynamic value) => @@ -184,9 +184,9 @@ class OrderStatusEnumTypeTransformer { /// and users are still using an old app with the old code. OrderStatusEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'placed': return OrderStatusEnum.placed_; - case 'approved': return OrderStatusEnum.approved_; - case 'delivered': return OrderStatusEnum.delivered_; + case 'placed': return OrderStatusEnum.placed; + case 'approved': return OrderStatusEnum.approved; + case 'delivered': return OrderStatusEnum.delivered; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index 1fb0d7b04057..76ca801b9f4d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -143,15 +143,15 @@ class PetStatusEnum { String toJson() => value; - static const available_ = PetStatusEnum._('available'); - static const pending_ = PetStatusEnum._('pending'); - static const sold_ = PetStatusEnum._('sold'); + static const available = PetStatusEnum._('available'); + static const pending = PetStatusEnum._('pending'); + static const sold = PetStatusEnum._('sold'); /// List of all possible values in this [enum][PetStatusEnum]. static const values = [ - available_, - pending_, - sold_, + available, + pending, + sold, ]; static PetStatusEnum fromJson(dynamic value) => @@ -184,9 +184,9 @@ class PetStatusEnumTypeTransformer { /// and users are still using an old app with the old code. PetStatusEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'available': return PetStatusEnum.available_; - case 'pending': return PetStatusEnum.pending_; - case 'sold': return PetStatusEnum.sold_; + case 'available': return PetStatusEnum.available; + case 'pending': return PetStatusEnum.pending; + case 'sold': return PetStatusEnum.sold; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index 3a976f261538..95cd1f3db47d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -44,10 +44,10 @@ final api_instance = AnotherFakeApi(); final client = Client(); // Client | client model try { - final result = api_instance.123test@$%SpecialTags(client); + final result = api_instance.call123testSpecialTags(client); print(result); } catch (e) { - print('Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n'); + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); } ``` @@ -58,7 +58,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**123test@$%SpecialTags**](doc//AnotherFakeApi.md#123test@$%specialtags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | *FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md index 4a6ad365bdca..a0291cd18507 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -9,11 +9,11 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**123test@$%SpecialTags**](AnotherFakeApi.md#123test@$%SpecialTags) | **PATCH** /another-fake/dummy | To test special tags +[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags -# **123test@$%SpecialTags** -> Client 123test@$%SpecialTags(client) +# **call123testSpecialTags** +> Client call123testSpecialTags(client) To test special tags @@ -27,10 +27,10 @@ final api_instance = AnotherFakeApi(); final client = Client(); // Client | client model try { - final result = api_instance.123test@$%SpecialTags(client); + final result = api_instance.call123testSpecialTags(client); print(result); } catch (e) { - print('Exception when calling AnotherFakeApi->123test@$%SpecialTags: $e\n'); + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); } ``` diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md index 8602c25ca806..c1b0cf767e0f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md @@ -407,7 +407,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **testEndpointParameters** -> testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -422,7 +422,7 @@ import 'package:openapi/api.dart'; final api_instance = FakeApi(); final number = 8.14; // num | None -final double = 1.2; // double | None +final double_ = 1.2; // double | None final patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None final byte = BYTE_ARRAY_DATA_HERE; // String | None final integer = 56; // int | None @@ -437,7 +437,7 @@ final password = password_example; // String | None final callback = callback_example; // String | None try { - api_instance.testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); } catch (e) { print('Exception when calling FakeApi->testEndpointParameters: $e\n'); } @@ -448,7 +448,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **number** | **num**| None | - **double** | **double**| None | + **double_** | **double**| None | **patternWithoutDelimiter** | **String**| None | **byte** | **String**| None | **integer** | **int**| None | [optional] diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md index 9209af6f6138..a2915ebfc5a6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FormatTest.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **int64** | **int** | | [optional] **number** | **num** | | **float** | **double** | | [optional] -**double** | **double** | | [optional] +**double_** | **double** | | [optional] **decimal** | **double** | | [optional] **string** | **String** | | [optional] **byte** | **String** | | diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md index 1d8524d35c7a..4ea5db6bc728 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/InlineObject3.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **int64** | **int** | None | [optional] **number** | **num** | None | **float** | **double** | None | [optional] -**double** | **double** | None | +**double_** | **double** | None | **string** | **String** | None | [optional] **patternWithoutDelimiter** | **String** | None | **byte** | **String** | None | diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md index cbac888c3dcd..5fcfa98e0b36 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/SpecialModelName.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**$special[propertyName]** | **int** | | [optional] +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart index 87782fe54f64..b55bea6d5205 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -25,7 +25,7 @@ class AnotherFakeApi { /// /// * [Client] client (required): /// client model - Future 123test@$%SpecialTagsWithHttpInfo(Client client) async { + Future call123testSpecialTagsWithHttpInfo(Client client) async { // Verify required params are set. if (client == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); @@ -75,8 +75,8 @@ class AnotherFakeApi { /// /// * [Client] client (required): /// client model - Future 123test@$%SpecialTags(Client client) async { - final response = await 123test@$%SpecialTagsWithHttpInfo(client); + Future call123testSpecialTags(Client client) async { + final response = await call123testSpecialTagsWithHttpInfo(client); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index fbccc0f03887..ea2e928400ac 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -632,7 +632,7 @@ class FakeApi { /// * [num] number (required): /// None /// - /// * [double] double (required): + /// * [double] double_ (required): /// None /// /// * [String] patternWithoutDelimiter (required): @@ -670,13 +670,13 @@ class FakeApi { /// /// * [String] callback: /// None - Future testEndpointParametersWithHttpInfo(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { + Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { // Verify required params are set. if (number == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: number'); } - if (double == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: double'); + if (double_ == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: double_'); } if (patternWithoutDelimiter == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: patternWithoutDelimiter'); @@ -723,9 +723,9 @@ class FakeApi { hasFields = true; mp.fields[r'float'] = parameterToString(float); } - if (double != null) { + if (double_ != null) { hasFields = true; - mp.fields[r'double'] = parameterToString(double); + mp.fields[r'double'] = parameterToString(double_); } if (string != null) { hasFields = true; @@ -779,8 +779,8 @@ class FakeApi { if (float != null) { formParams[r'float'] = parameterToString(float); } - if (double != null) { - formParams[r'double'] = parameterToString(double); + if (double_ != null) { + formParams[r'double'] = parameterToString(double_); } if (string != null) { formParams[r'string'] = parameterToString(string); @@ -826,7 +826,7 @@ class FakeApi { /// * [num] number (required): /// None /// - /// * [double] double (required): + /// * [double] double_ (required): /// None /// /// * [String] patternWithoutDelimiter (required): @@ -864,8 +864,8 @@ class FakeApi { /// /// * [String] callback: /// None - Future testEndpointParameters(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { - final response = await testEndpointParametersWithHttpInfo(number, double, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback ); + Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { + final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index 2e902906c4a1..e8a3626b6797 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -101,13 +101,13 @@ class EnumArraysJustSymbolEnum { String toJson() => value; - static const _ = EnumArraysJustSymbolEnum._('>='); - static const _ = EnumArraysJustSymbolEnum._('$'); + static const greaterThanEqual = EnumArraysJustSymbolEnum._('>='); + static const dollar = EnumArraysJustSymbolEnum._('$'); /// List of all possible values in this [enum][EnumArraysJustSymbolEnum]. static const values = [ - _, - _, + greaterThanEqual, + dollar, ]; static EnumArraysJustSymbolEnum fromJson(dynamic value) => @@ -140,8 +140,8 @@ class EnumArraysJustSymbolEnumTypeTransformer { /// and users are still using an old app with the old code. EnumArraysJustSymbolEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case '>=': return EnumArraysJustSymbolEnum._; - case '$': return EnumArraysJustSymbolEnum._; + case '>=': return EnumArraysJustSymbolEnum.greaterThanEqual; + case '$': return EnumArraysJustSymbolEnum.dollar; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -175,13 +175,13 @@ class EnumArraysArrayEnumEnum { String toJson() => value; - static const fish_ = EnumArraysArrayEnumEnum._('fish'); - static const crab_ = EnumArraysArrayEnumEnum._('crab'); + static const fish = EnumArraysArrayEnumEnum._('fish'); + static const crab = EnumArraysArrayEnumEnum._('crab'); /// List of all possible values in this [enum][EnumArraysArrayEnumEnum]. static const values = [ - fish_, - crab_, + fish, + crab, ]; static EnumArraysArrayEnumEnum fromJson(dynamic value) => @@ -214,8 +214,8 @@ class EnumArraysArrayEnumEnumTypeTransformer { /// and users are still using an old app with the old code. EnumArraysArrayEnumEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'fish': return EnumArraysArrayEnumEnum.fish_; - case 'crab': return EnumArraysArrayEnumEnum.crab_; + case 'fish': return EnumArraysArrayEnumEnum.fish; + case 'crab': return EnumArraysArrayEnumEnum.crab; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart index 3959cdf31aeb..d8bc602471e6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart @@ -30,15 +30,15 @@ class EnumClass { String toJson() => value; - static const abc_ = EnumClass._('_abc'); - static const efg_ = EnumClass._('-efg'); - static const xyz_ = EnumClass._('(xyz)'); + static const abc = EnumClass._('_abc'); + static const efg = EnumClass._('-efg'); + static const leftParenthesisXyzRightParenthesis = EnumClass._('(xyz)'); /// List of all possible values in this [enum][EnumClass]. static const values = [ - abc_, - efg_, - xyz_, + abc, + efg, + leftParenthesisXyzRightParenthesis, ]; static EnumClass fromJson(dynamic value) => @@ -71,9 +71,9 @@ class EnumClassTypeTransformer { /// and users are still using an old app with the old code. EnumClass decode(dynamic data, {bool allowNull}) { switch (data) { - case '_abc': return EnumClass.abc_; - case '-efg': return EnumClass.efg_; - case '(xyz)': return EnumClass.xyz_; + case '_abc': return EnumClass.abc; + case '-efg': return EnumClass.efg; + case '(xyz)': return EnumClass.leftParenthesisXyzRightParenthesis; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index b6e9ef26bf88..957c02778717 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -161,14 +161,14 @@ class EnumTestEnumStringEnum { String toJson() => value; - static const upper_ = EnumTestEnumStringEnum._('UPPER'); - static const lower_ = EnumTestEnumStringEnum._('lower'); + static const UPPER = EnumTestEnumStringEnum._('UPPER'); + static const lower = EnumTestEnumStringEnum._('lower'); static const empty = EnumTestEnumStringEnum._(''); /// List of all possible values in this [enum][EnumTestEnumStringEnum]. static const values = [ - upper_, - lower_, + UPPER, + lower, empty, ]; @@ -202,8 +202,8 @@ class EnumTestEnumStringEnumTypeTransformer { /// and users are still using an old app with the old code. EnumTestEnumStringEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'UPPER': return EnumTestEnumStringEnum.upper_; - case 'lower': return EnumTestEnumStringEnum.lower_; + case 'UPPER': return EnumTestEnumStringEnum.UPPER; + case 'lower': return EnumTestEnumStringEnum.lower; case '': return EnumTestEnumStringEnum.empty; default: if (allowNull == false) { @@ -238,14 +238,14 @@ class EnumTestEnumStringRequiredEnum { String toJson() => value; - static const upper_ = EnumTestEnumStringRequiredEnum._('UPPER'); - static const lower_ = EnumTestEnumStringRequiredEnum._('lower'); + static const UPPER = EnumTestEnumStringRequiredEnum._('UPPER'); + static const lower = EnumTestEnumStringRequiredEnum._('lower'); static const empty = EnumTestEnumStringRequiredEnum._(''); /// List of all possible values in this [enum][EnumTestEnumStringRequiredEnum]. static const values = [ - upper_, - lower_, + UPPER, + lower, empty, ]; @@ -279,8 +279,8 @@ class EnumTestEnumStringRequiredEnumTypeTransformer { /// and users are still using an old app with the old code. EnumTestEnumStringRequiredEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'UPPER': return EnumTestEnumStringRequiredEnum.upper_; - case 'lower': return EnumTestEnumStringRequiredEnum.lower_; + case 'UPPER': return EnumTestEnumStringRequiredEnum.UPPER; + case 'lower': return EnumTestEnumStringRequiredEnum.lower; case '': return EnumTestEnumStringRequiredEnum.empty; default: if (allowNull == false) { @@ -315,13 +315,13 @@ class EnumTestEnumIntegerEnum { String toJson() => value; - static const number1_ = EnumTestEnumIntegerEnum._(1); - static const number1_ = EnumTestEnumIntegerEnum._(-1); + static const number1 = EnumTestEnumIntegerEnum._(1); + static const number1 = EnumTestEnumIntegerEnum._(-1); /// List of all possible values in this [enum][EnumTestEnumIntegerEnum]. static const values = [ - number1_, - number1_, + number1, + number1, ]; static EnumTestEnumIntegerEnum fromJson(dynamic value) => @@ -354,8 +354,8 @@ class EnumTestEnumIntegerEnumTypeTransformer { /// and users are still using an old app with the old code. EnumTestEnumIntegerEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 1: return EnumTestEnumIntegerEnum.number1_; - case -1: return EnumTestEnumIntegerEnum.number1_; + case 1: return EnumTestEnumIntegerEnum.number1; + case -1: return EnumTestEnumIntegerEnum.number1; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -389,13 +389,13 @@ class EnumTestEnumNumberEnum { String toJson() => value; - static const 11_ = EnumTestEnumNumberEnum._('1.1'); - static const 12_ = EnumTestEnumNumberEnum._('-1.2'); + static const number1period1 = EnumTestEnumNumberEnum._('1.1'); + static const number1period2 = EnumTestEnumNumberEnum._('-1.2'); /// List of all possible values in this [enum][EnumTestEnumNumberEnum]. static const values = [ - 11_, - 12_, + number1period1, + number1period2, ]; static EnumTestEnumNumberEnum fromJson(dynamic value) => @@ -428,8 +428,8 @@ class EnumTestEnumNumberEnumTypeTransformer { /// and users are still using an old app with the old code. EnumTestEnumNumberEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case '1.1': return EnumTestEnumNumberEnum.11_; - case '-1.2': return EnumTestEnumNumberEnum.12_; + case '1.1': return EnumTestEnumNumberEnum.number1period1; + case '-1.2': return EnumTestEnumNumberEnum.number1period2; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart index 90d7fd18feca..3d8a868b041b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart @@ -17,7 +17,7 @@ class FormatTest { this.int64, @required this.number, this.float, - this.double, + this.double_, this.decimal, this.string, @required this.byte, @@ -56,7 +56,7 @@ class FormatTest { // minimum: 67.8 // maximum: 123.4 - double double; + double double_; double decimal; @@ -95,7 +95,7 @@ class FormatTest { other.int64 == int64 && other.number == number && other.float == float && - other.double == double && + other.double_ == double_ && other.decimal == decimal && other.string == string && other.byte == byte && @@ -114,7 +114,7 @@ class FormatTest { (int64 == null ? 0 : int64.hashCode) + (number == null ? 0 : number.hashCode) + (float == null ? 0 : float.hashCode) + - (double == null ? 0 : double.hashCode) + + (double_ == null ? 0 : double_.hashCode) + (decimal == null ? 0 : decimal.hashCode) + (string == null ? 0 : string.hashCode) + (byte == null ? 0 : byte.hashCode) + @@ -127,7 +127,7 @@ class FormatTest { (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter.hashCode); @override - String toString() => 'FormatTest[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double=$double, decimal=$decimal, string=$string, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, uuid=$uuid, password=$password, patternWithDigits=$patternWithDigits, patternWithDigitsAndDelimiter=$patternWithDigitsAndDelimiter]'; + String toString() => 'FormatTest[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double_=$double_, decimal=$decimal, string=$string, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, uuid=$uuid, password=$password, patternWithDigits=$patternWithDigits, patternWithDigitsAndDelimiter=$patternWithDigitsAndDelimiter]'; Map toJson() { final json = {}; @@ -146,8 +146,8 @@ class FormatTest { if (float != null) { json[r'float'] = float; } - if (double != null) { - json[r'double'] = double; + if (double_ != null) { + json[r'double'] = double_; } if (decimal != null) { json[r'decimal'] = decimal; @@ -194,7 +194,7 @@ class FormatTest { null : json[r'number'].toDouble(), float: json[r'float'], - double: json[r'double'], + double_: json[r'double'], decimal: json[r'decimal'], string: json[r'string'], byte: json[r'byte'], diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart index f82f4ba81d3e..86c73284068a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object2.dart @@ -101,13 +101,13 @@ class InlineObject2EnumFormStringArrayEnum { String toJson() => value; - static const _ = InlineObject2EnumFormStringArrayEnum._('>'); - static const _ = InlineObject2EnumFormStringArrayEnum._('$'); + static const greaterThan = InlineObject2EnumFormStringArrayEnum._('>'); + static const dollar = InlineObject2EnumFormStringArrayEnum._('$'); /// List of all possible values in this [enum][InlineObject2EnumFormStringArrayEnum]. static const values = [ - _, - _, + greaterThan, + dollar, ]; static InlineObject2EnumFormStringArrayEnum fromJson(dynamic value) => @@ -140,8 +140,8 @@ class InlineObject2EnumFormStringArrayEnumTypeTransformer { /// and users are still using an old app with the old code. InlineObject2EnumFormStringArrayEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case '>': return InlineObject2EnumFormStringArrayEnum._; - case '$': return InlineObject2EnumFormStringArrayEnum._; + case '>': return InlineObject2EnumFormStringArrayEnum.greaterThan; + case '$': return InlineObject2EnumFormStringArrayEnum.dollar; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -175,15 +175,15 @@ class InlineObject2EnumFormStringEnum { String toJson() => value; - static const abc_ = InlineObject2EnumFormStringEnum._('_abc'); - static const efg_ = InlineObject2EnumFormStringEnum._('-efg'); - static const xyz_ = InlineObject2EnumFormStringEnum._('(xyz)'); + static const abc = InlineObject2EnumFormStringEnum._('_abc'); + static const efg = InlineObject2EnumFormStringEnum._('-efg'); + static const leftParenthesisXyzRightParenthesis = InlineObject2EnumFormStringEnum._('(xyz)'); /// List of all possible values in this [enum][InlineObject2EnumFormStringEnum]. static const values = [ - abc_, - efg_, - xyz_, + abc, + efg, + leftParenthesisXyzRightParenthesis, ]; static InlineObject2EnumFormStringEnum fromJson(dynamic value) => @@ -216,9 +216,9 @@ class InlineObject2EnumFormStringEnumTypeTransformer { /// and users are still using an old app with the old code. InlineObject2EnumFormStringEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case '_abc': return InlineObject2EnumFormStringEnum.abc_; - case '-efg': return InlineObject2EnumFormStringEnum.efg_; - case '(xyz)': return InlineObject2EnumFormStringEnum.xyz_; + case '_abc': return InlineObject2EnumFormStringEnum.abc; + case '-efg': return InlineObject2EnumFormStringEnum.efg; + case '(xyz)': return InlineObject2EnumFormStringEnum.leftParenthesisXyzRightParenthesis; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart index e070b05e0886..c74b8b92529d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_object3.dart @@ -17,7 +17,7 @@ class InlineObject3 { this.int64, @required this.number, this.float, - @required this.double, + @required this.double_, this.string, @required this.patternWithoutDelimiter, @required this.byte, @@ -53,7 +53,7 @@ class InlineObject3 { /// None // minimum: 67.8 // maximum: 123.4 - double double; + double double_; /// None String string; @@ -86,7 +86,7 @@ class InlineObject3 { other.int64 == int64 && other.number == number && other.float == float && - other.double == double && + other.double_ == double_ && other.string == string && other.patternWithoutDelimiter == patternWithoutDelimiter && other.byte == byte && @@ -103,7 +103,7 @@ class InlineObject3 { (int64 == null ? 0 : int64.hashCode) + (number == null ? 0 : number.hashCode) + (float == null ? 0 : float.hashCode) + - (double == null ? 0 : double.hashCode) + + (double_ == null ? 0 : double_.hashCode) + (string == null ? 0 : string.hashCode) + (patternWithoutDelimiter == null ? 0 : patternWithoutDelimiter.hashCode) + (byte == null ? 0 : byte.hashCode) + @@ -114,7 +114,7 @@ class InlineObject3 { (callback == null ? 0 : callback.hashCode); @override - String toString() => 'InlineObject3[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double=$double, string=$string, patternWithoutDelimiter=$patternWithoutDelimiter, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, password=$password, callback=$callback]'; + String toString() => 'InlineObject3[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double_=$double_, string=$string, patternWithoutDelimiter=$patternWithoutDelimiter, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, password=$password, callback=$callback]'; Map toJson() { final json = {}; @@ -133,8 +133,8 @@ class InlineObject3 { if (float != null) { json[r'float'] = float; } - if (double != null) { - json[r'double'] = double; + if (double_ != null) { + json[r'double'] = double_; } if (string != null) { json[r'string'] = string; @@ -175,7 +175,7 @@ class InlineObject3 { null : json[r'number'].toDouble(), float: json[r'float'], - double: json[r'double'], + double_: json[r'double'], string: json[r'string'], patternWithoutDelimiter: json[r'pattern_without_delimiter'], byte: json[r'byte'], diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index ad46cde3fedb..7c930a530ff0 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -129,13 +129,13 @@ class MapTestMapOfEnumStringEnum { String toJson() => value; - static const upper_ = MapTestMapOfEnumStringEnum._('UPPER'); - static const lower_ = MapTestMapOfEnumStringEnum._('lower'); + static const UPPER = MapTestMapOfEnumStringEnum._('UPPER'); + static const lower = MapTestMapOfEnumStringEnum._('lower'); /// List of all possible values in this [enum][MapTestMapOfEnumStringEnum]. static const values = [ - upper_, - lower_, + UPPER, + lower, ]; static MapTestMapOfEnumStringEnum fromJson(dynamic value) => @@ -168,8 +168,8 @@ class MapTestMapOfEnumStringEnumTypeTransformer { /// and users are still using an old app with the old code. MapTestMapOfEnumStringEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'UPPER': return MapTestMapOfEnumStringEnum.upper_; - case 'lower': return MapTestMapOfEnumStringEnum.lower_; + case 'UPPER': return MapTestMapOfEnumStringEnum.UPPER; + case 'lower': return MapTestMapOfEnumStringEnum.lower; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index 4ba9c2ea96d9..e6660d5a08a5 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -143,15 +143,15 @@ class OrderStatusEnum { String toJson() => value; - static const placed_ = OrderStatusEnum._('placed'); - static const approved_ = OrderStatusEnum._('approved'); - static const delivered_ = OrderStatusEnum._('delivered'); + static const placed = OrderStatusEnum._('placed'); + static const approved = OrderStatusEnum._('approved'); + static const delivered = OrderStatusEnum._('delivered'); /// List of all possible values in this [enum][OrderStatusEnum]. static const values = [ - placed_, - approved_, - delivered_, + placed, + approved, + delivered, ]; static OrderStatusEnum fromJson(dynamic value) => @@ -184,9 +184,9 @@ class OrderStatusEnumTypeTransformer { /// and users are still using an old app with the old code. OrderStatusEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'placed': return OrderStatusEnum.placed_; - case 'approved': return OrderStatusEnum.approved_; - case 'delivered': return OrderStatusEnum.delivered_; + case 'placed': return OrderStatusEnum.placed; + case 'approved': return OrderStatusEnum.approved; + case 'delivered': return OrderStatusEnum.delivered; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart index 5edeca38ef2f..90b78ad1d77e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart @@ -30,15 +30,15 @@ class OuterEnum { String toJson() => value; - static const placed_ = OuterEnum._('placed'); - static const approved_ = OuterEnum._('approved'); - static const delivered_ = OuterEnum._('delivered'); + static const placed = OuterEnum._('placed'); + static const approved = OuterEnum._('approved'); + static const delivered = OuterEnum._('delivered'); /// List of all possible values in this [enum][OuterEnum]. static const values = [ - placed_, - approved_, - delivered_, + placed, + approved, + delivered, ]; static OuterEnum fromJson(dynamic value) => @@ -71,9 +71,9 @@ class OuterEnumTypeTransformer { /// and users are still using an old app with the old code. OuterEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'placed': return OuterEnum.placed_; - case 'approved': return OuterEnum.approved_; - case 'delivered': return OuterEnum.delivered_; + case 'placed': return OuterEnum.placed; + case 'approved': return OuterEnum.approved; + case 'delivered': return OuterEnum.delivered; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart index a046a153dbb0..954bb4e528c4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -30,15 +30,15 @@ class OuterEnumDefaultValue { String toJson() => value; - static const placed_ = OuterEnumDefaultValue._('placed'); - static const approved_ = OuterEnumDefaultValue._('approved'); - static const delivered_ = OuterEnumDefaultValue._('delivered'); + static const placed = OuterEnumDefaultValue._('placed'); + static const approved = OuterEnumDefaultValue._('approved'); + static const delivered = OuterEnumDefaultValue._('delivered'); /// List of all possible values in this [enum][OuterEnumDefaultValue]. static const values = [ - placed_, - approved_, - delivered_, + placed, + approved, + delivered, ]; static OuterEnumDefaultValue fromJson(dynamic value) => @@ -71,9 +71,9 @@ class OuterEnumDefaultValueTypeTransformer { /// and users are still using an old app with the old code. OuterEnumDefaultValue decode(dynamic data, {bool allowNull}) { switch (data) { - case 'placed': return OuterEnumDefaultValue.placed_; - case 'approved': return OuterEnumDefaultValue.approved_; - case 'delivered': return OuterEnumDefaultValue.delivered_; + case 'placed': return OuterEnumDefaultValue.placed; + case 'approved': return OuterEnumDefaultValue.approved; + case 'delivered': return OuterEnumDefaultValue.delivered; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart index 0bb65d3251e4..dd0d8111bb6d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart @@ -30,15 +30,15 @@ class OuterEnumInteger { String toJson() => value; - static const number0_ = OuterEnumInteger._(0); - static const number1_ = OuterEnumInteger._(1); - static const number2_ = OuterEnumInteger._(2); + static const number0 = OuterEnumInteger._(0); + static const number1 = OuterEnumInteger._(1); + static const number2 = OuterEnumInteger._(2); /// List of all possible values in this [enum][OuterEnumInteger]. static const values = [ - number0_, - number1_, - number2_, + number0, + number1, + number2, ]; static OuterEnumInteger fromJson(dynamic value) => @@ -71,9 +71,9 @@ class OuterEnumIntegerTypeTransformer { /// and users are still using an old app with the old code. OuterEnumInteger decode(dynamic data, {bool allowNull}) { switch (data) { - case 0: return OuterEnumInteger.number0_; - case 1: return OuterEnumInteger.number1_; - case 2: return OuterEnumInteger.number2_; + case 0: return OuterEnumInteger.number0; + case 1: return OuterEnumInteger.number1; + case 2: return OuterEnumInteger.number2; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart index 506ab94c4af4..eb1eaae1c2db 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -30,15 +30,15 @@ class OuterEnumIntegerDefaultValue { String toJson() => value; - static const number0_ = OuterEnumIntegerDefaultValue._(0); - static const number1_ = OuterEnumIntegerDefaultValue._(1); - static const number2_ = OuterEnumIntegerDefaultValue._(2); + static const number0 = OuterEnumIntegerDefaultValue._(0); + static const number1 = OuterEnumIntegerDefaultValue._(1); + static const number2 = OuterEnumIntegerDefaultValue._(2); /// List of all possible values in this [enum][OuterEnumIntegerDefaultValue]. static const values = [ - number0_, - number1_, - number2_, + number0, + number1, + number2, ]; static OuterEnumIntegerDefaultValue fromJson(dynamic value) => @@ -71,9 +71,9 @@ class OuterEnumIntegerDefaultValueTypeTransformer { /// and users are still using an old app with the old code. OuterEnumIntegerDefaultValue decode(dynamic data, {bool allowNull}) { switch (data) { - case 0: return OuterEnumIntegerDefaultValue.number0_; - case 1: return OuterEnumIntegerDefaultValue.number1_; - case 2: return OuterEnumIntegerDefaultValue.number2_; + case 0: return OuterEnumIntegerDefaultValue.number0; + case 1: return OuterEnumIntegerDefaultValue.number1; + case 2: return OuterEnumIntegerDefaultValue.number2; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index 1fb0d7b04057..76ca801b9f4d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -143,15 +143,15 @@ class PetStatusEnum { String toJson() => value; - static const available_ = PetStatusEnum._('available'); - static const pending_ = PetStatusEnum._('pending'); - static const sold_ = PetStatusEnum._('sold'); + static const available = PetStatusEnum._('available'); + static const pending = PetStatusEnum._('pending'); + static const sold = PetStatusEnum._('sold'); /// List of all possible values in this [enum][PetStatusEnum]. static const values = [ - available_, - pending_, - sold_, + available, + pending, + sold, ]; static PetStatusEnum fromJson(dynamic value) => @@ -184,9 +184,9 @@ class PetStatusEnumTypeTransformer { /// and users are still using an old app with the old code. PetStatusEnum decode(dynamic data, {bool allowNull}) { switch (data) { - case 'available': return PetStatusEnum.available_; - case 'pending': return PetStatusEnum.pending_; - case 'sold': return PetStatusEnum.sold_; + case 'available': return PetStatusEnum.available; + case 'pending': return PetStatusEnum.pending; + case 'sold': return PetStatusEnum.sold; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart index cde5686edc46..8b29142ada8b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -12,27 +12,27 @@ part of openapi.api; class SpecialModelName { /// Returns a new [SpecialModelName] instance. SpecialModelName({ - this.$special[propertyName], + this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, }); - int $special[propertyName]; + int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; @override bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && - other.$special[propertyName] == $special[propertyName]; + other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; @override int get hashCode => - ($special[propertyName] == null ? 0 : $special[propertyName].hashCode); + (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode); @override - String toString() => 'SpecialModelName[$special[propertyName]=$$special[propertyName]]'; + String toString() => 'SpecialModelName[dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket=$dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket]'; Map toJson() { final json = {}; - if ($special[propertyName] != null) { - json[r'$special[property.name]'] = $special[propertyName]; + if (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { + json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; } return json; } @@ -42,7 +42,7 @@ class SpecialModelName { static SpecialModelName fromJson(Map json) => json == null ? null : SpecialModelName( - $special[propertyName]: json[r'$special[property.name]'], + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: json[r'$special[property.name]'], ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart index 65279abe35d2..790140d45a70 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/another_fake_api_test.dart @@ -20,8 +20,8 @@ void main() { // // To test special tags and operation ID starting with number // - //Future 123test@$%SpecialTags(Client client) async - test('test 123test@$%SpecialTags', () async { + //Future call123testSpecialTags(Client client) async + test('test call123testSpecialTags', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart index 42c218b20879..004677ba786e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_api_test.dart @@ -83,7 +83,7 @@ void main() { // // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 // - //Future testEndpointParameters(num number, double double, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async test('test testEndpointParameters', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart index 53f3fe775624..554439c5f2e3 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/format_test_test.dart @@ -31,12 +31,12 @@ void main() { // TODO }); - // double double - test('to test the property `double`', () async { + // double double_ + test('to test the property `double_`', () async { // TODO }); - // Decimal decimal + // double decimal test('to test the property `decimal`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart index 6a87c28a89cb..f6eba956c09f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_object3_test.dart @@ -37,8 +37,8 @@ void main() { }); // None - // double double - test('to test the property `double`', () async { + // double double_ + test('to test the property `double_`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart index 7eb4643f1dfd..5d9e9afd14ac 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/special_model_name_test.dart @@ -6,8 +6,8 @@ void main() { final instance = SpecialModelName(); group('test SpecialModelName', () { - // int $special[propertyName] - test('to test the property `$special[propertyName]`', () async { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { // TODO });