mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
[typescript][axios] Add any to index type when additionalPropertiesIsAnyType is true (#16494) (#17625)
This commit is contained in:
parent
eb7d2d9fd2
commit
5397f64595
@ -226,6 +226,11 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
for (ModelMap mo : models) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
|
||||
// Type is already any
|
||||
if (cm.getAdditionalPropertiesIsAnyType() && "any".equals(cm.getAdditionalPropertiesType())) {
|
||||
cm.setAdditionalPropertiesIsAnyType(false);
|
||||
}
|
||||
|
||||
// Deduce the model file name in kebab case
|
||||
cm.classFilename = cm.classname.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
|
||||
{{#additionalPropertiesType}}
|
||||
[key: string]: {{{additionalPropertiesType}}}{{^additionalPropertiesIsAnyType}}{{#hasVars}} | any{{/hasVars}}{{/additionalPropertiesIsAnyType}};
|
||||
[key: string]: {{{additionalPropertiesType}}}{{#additionalPropertiesIsAnyType}}{{#hasVars}} | any{{/hasVars}}{{/additionalPropertiesIsAnyType}};
|
||||
|
||||
{{/additionalPropertiesType}}
|
||||
{{#vars}}
|
||||
|
@ -447,7 +447,7 @@ export interface Dog extends Animal {
|
||||
* @interface Drawing
|
||||
*/
|
||||
export interface Drawing {
|
||||
[key: string]: Fruit;
|
||||
[key: string]: Fruit | any;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1043,7 +1043,7 @@ export interface Name {
|
||||
* @interface NullableClass
|
||||
*/
|
||||
export interface NullableClass {
|
||||
[key: string]: object;
|
||||
[key: string]: object | any;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -811,7 +811,7 @@ export interface Name {
|
||||
* @interface NullableClass
|
||||
*/
|
||||
export interface NullableClass {
|
||||
[key: string]: object;
|
||||
[key: string]: object | any;
|
||||
|
||||
/**
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user