diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md index b0c81d51a4fe..bfdd79590ab0 100644 --- a/docs/generators/javascript-flowtyped.md +++ b/docs/generators/javascript-flowtyped.md @@ -51,6 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |array|Array| |list|Array| |map|Object| +|set|Set| ## LANGUAGE PRIMITIVES diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md index 3e62082c0959..1b266a0e0b04 100644 --- a/docs/generators/typescript-angular.md +++ b/docs/generators/typescript-angular.md @@ -63,6 +63,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -81,6 +83,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -88,6 +91,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md index a4c3819c4dd0..0d6f3f1e9cc5 100644 --- a/docs/generators/typescript-aurelia.md +++ b/docs/generators/typescript-aurelia.md @@ -48,6 +48,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -65,6 +67,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -72,6 +75,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 253dbb0801cf..c0912df90fef 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -56,6 +56,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -73,6 +75,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -80,6 +83,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index 20a758ccf3fd..bb39575e503c 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -56,6 +56,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -73,6 +75,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -80,6 +83,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md index b38c0ff9afb7..d4f7597e58c9 100644 --- a/docs/generators/typescript-inversify.md +++ b/docs/generators/typescript-inversify.md @@ -53,6 +53,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -71,6 +73,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -78,6 +81,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md index 626ac5a920f5..683f6cb87623 100644 --- a/docs/generators/typescript-jquery.md +++ b/docs/generators/typescript-jquery.md @@ -50,6 +50,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -67,6 +69,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -74,6 +77,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md index 9788a6139717..b181cdb053e0 100644 --- a/docs/generators/typescript-nestjs.md +++ b/docs/generators/typescript-nestjs.md @@ -58,6 +58,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -76,6 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -83,6 +86,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md index f19a9f34e5a3..51379870193c 100644 --- a/docs/generators/typescript-node.md +++ b/docs/generators/typescript-node.md @@ -49,6 +49,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -68,6 +70,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Object
  • ReadStream
  • ReadonlyArray
  • +
  • Record
  • RequestDetailedFile
  • RequestFile
  • Set
  • @@ -77,6 +80,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-redux-query.md b/docs/generators/typescript-redux-query.md index 0e0aa2ec3ce3..8a2ee1e92816 100644 --- a/docs/generators/typescript-redux-query.md +++ b/docs/generators/typescript-redux-query.md @@ -51,6 +51,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -68,6 +70,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -75,6 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript-rxjs.md b/docs/generators/typescript-rxjs.md index b5cdf9fe8a7a..4b9424f8ffa5 100644 --- a/docs/generators/typescript-rxjs.md +++ b/docs/generators/typescript-rxjs.md @@ -50,6 +50,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -68,6 +70,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -75,6 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS diff --git a/docs/generators/typescript.md b/docs/generators/typescript.md index ed7612a0cea4..9f36939fbc35 100644 --- a/docs/generators/typescript.md +++ b/docs/generators/typescript.md @@ -56,6 +56,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | |array|Array| +|map|Record| +|set|Set| ## LANGUAGE PRIMITIVES @@ -73,6 +75,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Map
  • Object
  • ReadonlyArray
  • +
  • Record
  • Set
  • String
  • any
  • @@ -80,6 +83,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • number
  • object
  • string
  • +
  • unknown
  • ## RESERVED WORDS 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 a90dc165cb68..790eaeffb46f 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 @@ -2058,9 +2058,19 @@ public String generateExamplePath(String path, Operation operation) { public String toInstantiationType(Schema schema) { if (ModelUtils.isMapSchema(schema)) { Schema additionalProperties = ModelUtils.getAdditionalProperties(schema); + Schema unaliasedAdditionalPropertiesSchema = unaliasSchema(additionalProperties); + String inner = getSchemaType(additionalProperties); String mapInstantion = instantiationTypes.get("map"); - if (mapInstantion != null) { + // Additional properties cannot be composed (allof, anyof, oneof) + if (!ModelUtils.isComposedSchema(additionalProperties) + && !ModelUtils.isRefToSchemaWithProperties(unaliasedAdditionalPropertiesSchema.get$ref()) + && StringUtils.isBlank(unaliasedAdditionalPropertiesSchema.get$ref()) + ) { + String primitiveAdditionalPropertiesType = getPrimitiveType(unaliasedAdditionalPropertiesSchema); + if ("object".equals(primitiveAdditionalPropertiesType)) { + inner = typeMapping.get("AnyType"); + } return mapInstantion + ""; } return inner; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index e751790abcf2..d50f27d409d5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -315,7 +315,9 @@ public AbstractTypeScriptClientCodegen() { "Error", "Map", "object", - "Set" + "Set", + "Record", + "unknown" )); languageGenericTypes = new HashSet<>(Collections.singletonList( @@ -323,6 +325,8 @@ public AbstractTypeScriptClientCodegen() { )); instantiationTypes.put("array", "Array"); + instantiationTypes.put("map", "Record"); + instantiationTypes.put("set", "Set"); typeMapping = new HashMap(); typeMapping.put("Set", "Set"); @@ -340,18 +344,18 @@ public AbstractTypeScriptClientCodegen() { typeMapping.put("double", "number"); typeMapping.put("object", "object"); typeMapping.put("integer", "number"); - typeMapping.put("Map", "any"); - typeMapping.put("map", "any"); + typeMapping.put("Map", "unknown"); + typeMapping.put("map", "unknown"); typeMapping.put("date", "string"); typeMapping.put("DateTime", "string"); - typeMapping.put("binary", "any"); - typeMapping.put("File", "any"); - typeMapping.put("file", "any"); + typeMapping.put("binary", "unknown"); + typeMapping.put("File", "unknown"); + typeMapping.put("file", "unknown"); typeMapping.put("ByteArray", "string"); typeMapping.put("UUID", "string"); typeMapping.put("URI", "string"); typeMapping.put("Error", "Error"); - typeMapping.put("AnyType", "any"); + typeMapping.put("AnyType", "unknown"); cliOptions.add(new CliOption(CodegenConstants.ENUM_NAME_SUFFIX, CodegenConstants.ENUM_NAME_SUFFIX_DESC).defaultValue(this.enumSuffix)); cliOptions.add(new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC).defaultValue(this.enumPropertyNaming.name())); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java index 5b9aba6ab0b3..21b14a38ecce 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -227,7 +227,7 @@ public ModelsMap postProcessModels(ModelsMap objs) { CodegenModel cm = mo.getModel(); // Type is already any - if (cm.getAdditionalPropertiesIsAnyType() && "any".equals(cm.getAdditionalPropertiesType())) { + if (cm.getAdditionalPropertiesIsAnyType() && "unknown".equals(cm.getAdditionalPropertiesType())) { cm.setAdditionalPropertiesIsAnyType(false); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index 4e78a623b0e7..32a41c32c5cc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -110,7 +110,7 @@ public TypeScriptClientCodegen() { "constructor")); typeMapping.put("List", "Array"); - typeMapping.put("object", "any"); + typeMapping.put("object", "object"); typeMapping.put("DateTime", "Date"); cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); @@ -494,7 +494,7 @@ public String getTypeDeclaration(Schema p) { } else if (ModelUtils.isFileSchema(p)) { return "HttpFile"; } else if (ModelUtils.isBinarySchema(p)) { - return "any"; + return "unknown"; } else { return super.getTypeDeclaration(p); } diff --git a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/modelGeneric.mustache index 1ed248653dbd..ad1a8dc883c7 100644 --- a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/modelGeneric.mustache @@ -12,7 +12,7 @@ */ export type {{classname}} = { {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/modelGenericAdditionalProperties.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/modelGenericAdditionalProperties.mustache index e6499ce9d63f..faefc2b7bdb6 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/modelGenericAdditionalProperties.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/modelGenericAdditionalProperties.mustache @@ -1,5 +1,5 @@ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache index 878383ded67d..9a56704713b4 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache @@ -5,7 +5,7 @@ */ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#additionalPropertiesIsAnyType}}{{#hasVars}} | any{{/hasVars}}{{/additionalPropertiesIsAnyType}}; + [key: string]: {{{additionalPropertiesType}}}{{#additionalPropertiesIsAnyType}}{{#hasVars}} | unknown{{/hasVars}}{{/additionalPropertiesIsAnyType}}; {{/additionalPropertiesType}} {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache index 4b8bfa06a1bc..8c87372f6a12 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache @@ -5,7 +5,7 @@ */ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} {{#vars}} /** diff --git a/modules/openapi-generator/src/main/resources/typescript-inversify/modelGenericAdditionalProperties.mustache b/modules/openapi-generator/src/main/resources/typescript-inversify/modelGenericAdditionalProperties.mustache index e6499ce9d63f..faefc2b7bdb6 100644 --- a/modules/openapi-generator/src/main/resources/typescript-inversify/modelGenericAdditionalProperties.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-inversify/modelGenericAdditionalProperties.mustache @@ -1,5 +1,5 @@ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-jquery/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-jquery/modelGeneric.mustache index 2d0c18223600..2ccef57decc1 100644 --- a/modules/openapi-generator/src/main/resources/typescript-jquery/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-jquery/modelGeneric.mustache @@ -1,6 +1,6 @@ export interface {{classname}} {{#parent}}extends models.{{{.}}} {{/parent}}{ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache index e6499ce9d63f..faefc2b7bdb6 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache @@ -1,5 +1,5 @@ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-redux-query/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-redux-query/modelGeneric.mustache index 893131f90f8a..3ec90dd79580 100644 --- a/modules/openapi-generator/src/main/resources/typescript-redux-query/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-redux-query/modelGeneric.mustache @@ -16,7 +16,7 @@ import { */ export interface {{classname}} {{#allParents.0}}extends{{#allParents}} {{{.}}}{{^-last}},{{/-last}}{{/allParents}}{{/allParents.0}} { {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} {{#vars}} /** diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/modelGeneric.mustache index a12ceb35c3dc..3c22758061b2 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/modelGeneric.mustache @@ -13,7 +13,7 @@ import type { */ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | unknown{{/hasVars}}; {{/additionalPropertiesType}} {{#vars}} /**{{#description}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java index 848d5d7edf0b..6b4363ea5480 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java @@ -538,7 +538,7 @@ public void mapModelTest() { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "a map model"); Assert.assertEquals(cm.vars.size(), 0); - Assert.assertEquals(cm.parent, "HashMap"); + Assert.assertEquals(cm.parent, "Children"); Assert.assertEquals(cm.imports.size(), 4); Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("ApiModel", "Map", "HashMap", "Children")).size(), 4); } diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Drawing.java index e9d2beb1456e..fa3f5fafc1e5 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Drawing.java @@ -54,7 +54,7 @@ Drawing.JSON_PROPERTY_SHAPES }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class Drawing extends HashMap { +public class Drawing extends Fruit { public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; private Shape mainShape; diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java index e9d2beb1456e..fa3f5fafc1e5 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java @@ -54,7 +54,7 @@ Drawing.JSON_PROPERTY_SHAPES }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT") -public class Drawing extends HashMap { +public class Drawing extends Fruit { public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; private Shape mainShape; diff --git a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts index d3616f85e38c..2bce263eacd1 100644 --- a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts +++ b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts @@ -149,10 +149,10 @@ export class DefaultService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public test(body?: any, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public test(body?: any, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public test(body?: any, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public test(body?: any, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { + public test(body?: unknown, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; + public test(body?: unknown, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public test(body?: unknown, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public test(body?: unknown, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { let localVarHeaders = this.defaultHeaders; diff --git a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts index d3616f85e38c..2bce263eacd1 100644 --- a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts +++ b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts @@ -149,10 +149,10 @@ export class DefaultService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public test(body?: any, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public test(body?: any, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public test(body?: any, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public test(body?: any, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { + public test(body?: unknown, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; + public test(body?: unknown, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public test(body?: unknown, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public test(body?: unknown, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { let localVarHeaders = this.defaultHeaders; diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts index d759ff399064..89f76193cd4e 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts @@ -79,10 +79,10 @@ export type DogBreedEnum = typeof DogBreedEnum[keyof typeof DogBreedEnum]; export interface FilePostRequest { /** * - * @type {any} + * @type {unknown} * @memberof FilePostRequest */ - 'file'?: any; + 'file'?: unknown; } /** * diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index 2d63feaab3a4..8709c590c804 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -43,10 +43,10 @@ export interface AdditionalPropertiesClass { 'map_of_map_property'?: { [key: string]: { [key: string]: string; }; }; /** * - * @type {any} + * @type {unknown} * @memberof AdditionalPropertiesClass */ - 'anytype_1'?: any; + 'anytype_1'?: unknown; /** * * @type {object} @@ -61,10 +61,10 @@ export interface AdditionalPropertiesClass { 'map_with_undeclared_properties_anytype_2'?: object; /** * - * @type {{ [key: string]: any; }} + * @type {{ [key: string]: unknown; }} * @memberof AdditionalPropertiesClass */ - 'map_with_undeclared_properties_anytype_3'?: { [key: string]: any; }; + 'map_with_undeclared_properties_anytype_3'?: { [key: string]: unknown; }; /** * an object with no declared properties and no undeclared properties, hence it\'s an empty map. * @type {object} @@ -447,7 +447,7 @@ export interface Dog extends Animal { * @interface Drawing */ export interface Drawing { - [key: string]: Fruit | any; + [key: string]: Fruit | unknown; /** * @@ -644,16 +644,16 @@ export interface EquilateralTriangle { export interface FileSchemaTestClass { /** * - * @type {any} + * @type {unknown} * @memberof FileSchemaTestClass */ - 'file'?: any; + 'file'?: unknown; /** * - * @type {Array} + * @type {Array} * @memberof FileSchemaTestClass */ - 'files'?: Array; + 'files'?: Array; } /** * @@ -1043,7 +1043,7 @@ export interface Name { * @interface NullableClass */ export interface NullableClass { - [key: string]: object | any; + [key: string]: object | unknown; /** * @@ -1533,7 +1533,7 @@ export interface Tag { * @interface TestInlineFreeformAdditionalPropertiesRequest */ export interface TestInlineFreeformAdditionalPropertiesRequest { - [key: string]: any; + [key: string]: unknown; /** * @@ -1629,16 +1629,16 @@ export interface User { 'objectWithNoDeclaredPropsNullable'?: object | null; /** * test code generation for any type Here the \'type\' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - * @type {any} + * @type {unknown} * @memberof User */ - 'anyTypeProp'?: any; + 'anyTypeProp'?: unknown; /** * test code generation for any type Here the \'type\' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The \'nullable\' attribute does not change the allowed values. - * @type {any} + * @type {unknown} * @memberof User */ - 'anyTypePropNullable'?: any | null; + 'anyTypePropNullable'?: unknown | null; } /** * @@ -1671,7 +1671,7 @@ export interface Whale { * @interface Zebra */ export interface Zebra { - [key: string]: any; + [key: string]: unknown; /** * @@ -2138,11 +2138,11 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testAdditionalPropertiesReference: async (requestBody: { [key: string]: any; }, options: RawAxiosRequestConfig = {}): Promise => { + testAdditionalPropertiesReference: async (requestBody: { [key: string]: unknown; }, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'requestBody' is not null or undefined assertParamExists('testAdditionalPropertiesReference', 'requestBody', requestBody) const localVarPath = `/fake/additionalProperties-reference`; @@ -2867,11 +2867,11 @@ export const FakeApiFp = function(configuration?: Configuration) { /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async testAdditionalPropertiesReference(requestBody: { [key: string]: unknown; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.testAdditionalPropertiesReference(requestBody, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FakeApi.testAdditionalPropertiesReference']?.[localVarOperationServerIndex]?.url; @@ -3125,11 +3125,11 @@ export const FakeApiFactory = function (configuration?: Configuration, basePath? /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: any): AxiosPromise { + testAdditionalPropertiesReference(requestBody: { [key: string]: unknown; }, options?: any): AxiosPromise { return localVarFp.testAdditionalPropertiesReference(requestBody, options).then((request) => request(axios, basePath)); }, /** @@ -3361,12 +3361,12 @@ export class FakeApi extends BaseAPI { /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FakeApi */ - public testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig) { + public testAdditionalPropertiesReference(requestBody: { [key: string]: unknown; }, options?: RawAxiosRequestConfig) { return FakeApiFp(this.configuration).testAdditionalPropertiesReference(requestBody, options).then((request) => request(this.axios, this.basePath)); } diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index c0f214239f19..64a181fe640e 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -175,7 +175,7 @@ export interface ArrayTest { * @interface Banana */ export interface Banana { - [key: string]: any; + [key: string]: unknown; /** * @@ -456,16 +456,16 @@ export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof export interface FileSchemaTestClass { /** * - * @type {any} + * @type {unknown} * @memberof FileSchemaTestClass */ - 'file'?: any; + 'file'?: unknown; /** * - * @type {Array} + * @type {Array} * @memberof FileSchemaTestClass */ - 'files'?: Array; + 'files'?: Array; } /** * @@ -811,7 +811,7 @@ export interface Name { * @interface NullableClass */ export interface NullableClass { - [key: string]: object | any; + [key: string]: object | unknown; /** * @@ -1208,7 +1208,7 @@ export interface Tag { * @interface TestInlineFreeformAdditionalPropertiesRequest */ export interface TestInlineFreeformAdditionalPropertiesRequest { - [key: string]: any; + [key: string]: unknown; /** * @@ -1285,16 +1285,16 @@ export interface User { 'arbitraryNullableObject'?: object | null; /** * test code generation for any type Value can be any type - string, number, boolean, array or object. - * @type {any} + * @type {unknown} * @memberof User */ - 'arbitraryTypeValue'?: any; + 'arbitraryTypeValue'?: unknown; /** * test code generation for any type Value can be any type - string, number, boolean, array, object or the \'null\' value. - * @type {any} + * @type {unknown} * @memberof User */ - 'arbitraryNullableTypeValue'?: any | null; + 'arbitraryNullableTypeValue'?: unknown | null; } /** * @@ -1728,11 +1728,11 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testAdditionalPropertiesReference: async (requestBody: { [key: string]: any; }, options: RawAxiosRequestConfig = {}): Promise => { + testAdditionalPropertiesReference: async (requestBody: { [key: string]: unknown; }, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'requestBody' is not null or undefined assertParamExists('testAdditionalPropertiesReference', 'requestBody', requestBody) const localVarPath = `/fake/additionalProperties-reference`; @@ -2476,11 +2476,11 @@ export const FakeApiFp = function(configuration?: Configuration) { /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async testAdditionalPropertiesReference(requestBody: { [key: string]: unknown; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.testAdditionalPropertiesReference(requestBody, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FakeApi.testAdditionalPropertiesReference']?.[localVarOperationServerIndex]?.url; @@ -2728,11 +2728,11 @@ export const FakeApiFactory = function (configuration?: Configuration, basePath? /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: any): AxiosPromise { + testAdditionalPropertiesReference(requestBody: { [key: string]: unknown; }, options?: any): AxiosPromise { return localVarFp.testAdditionalPropertiesReference(requestBody, options).then((request) => request(axios, basePath)); }, /** @@ -2951,12 +2951,12 @@ export class FakeApi extends BaseAPI { /** * * @summary test referenced additionalProperties - * @param {{ [key: string]: any; }} requestBody request body + * @param {{ [key: string]: unknown; }} requestBody request body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FakeApi */ - public testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig) { + public testAdditionalPropertiesReference(requestBody: { [key: string]: unknown; }, options?: RawAxiosRequestConfig) { return FakeApiFp(this.configuration).testAdditionalPropertiesReference(requestBody, options).then((request) => request(this.axios, this.basePath)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index 484c15265f5f..2367e393ae0e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -79,7 +79,7 @@ export interface FakePropertyEnumIntegerSerializeRequest { } export interface TestAdditionalPropertiesReferenceRequest { - requestBody: { [key: string]: any; }; + requestBody: { [key: string]: unknown; }; } export interface TestBodyWithBinaryRequest { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts index 25bf3ba4dbf1..413c65d99342 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts @@ -21,16 +21,16 @@ import { mapValues } from '../runtime'; export interface FileSchemaTestClass { /** * - * @type {any} + * @type {unknown} * @memberof FileSchemaTestClass */ - file?: any; + file?: unknown; /** * - * @type {Array} + * @type {Array} * @memberof FileSchemaTestClass */ - files?: Array; + files?: Array; } /** diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts index b64cd7d8f452..4fcf56a0be33 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts @@ -19,7 +19,7 @@ import { mapValues } from '../runtime'; * @interface NullableClass */ export interface NullableClass { - [key: string]: object | any; + [key: string]: object | unknown; /** * * @type {number} diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts index acc16c94f495..5afa0e535636 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts @@ -19,7 +19,7 @@ import { mapValues } from '../runtime'; * @interface TestInlineFreeformAdditionalPropertiesRequest */ export interface TestInlineFreeformAdditionalPropertiesRequest { - [key: string]: any | any; + [key: string]: unknown | unknown; /** * * @type {string} diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts index 25bf3ba4dbf1..413c65d99342 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts @@ -21,16 +21,16 @@ import { mapValues } from '../runtime'; export interface FileSchemaTestClass { /** * - * @type {any} + * @type {unknown} * @memberof FileSchemaTestClass */ - file?: any; + file?: unknown; /** * - * @type {Array} + * @type {Array} * @memberof FileSchemaTestClass */ - files?: Array; + files?: Array; } /** diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts index b64cd7d8f452..4fcf56a0be33 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts @@ -19,7 +19,7 @@ import { mapValues } from '../runtime'; * @interface NullableClass */ export interface NullableClass { - [key: string]: object | any; + [key: string]: object | unknown; /** * * @type {number} diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts index ddd7a052d56a..cfcf9f3b7bad 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts @@ -13,7 +13,7 @@ import { HttpFile } from '../http/http'; export class FilePostRequest { - 'file'?: any; + 'file'?: unknown; static readonly discriminator: string | undefined = undefined; @@ -21,7 +21,7 @@ export class FilePostRequest { { "name": "file", "baseName": "file", - "type": "any", + "type": "unknown", "format": "" } ];