Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[typescript-axios] Add any to index type when additionalPropertiesIsAnyType is true (#16494) #17625

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ public ModelsMap postProcessModels(ModelsMap objs) {
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ export interface Dog extends Animal {
* @interface Drawing
*/
export interface Drawing {
[key: string]: Fruit;
[key: string]: Fruit | any;

/**
*
Expand Down Expand Up @@ -1043,7 +1043,7 @@ export interface Name {
* @interface NullableClass
*/
export interface NullableClass {
[key: string]: object;
[key: string]: object | any;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export interface Name {
* @interface NullableClass
*/
export interface NullableClass {
[key: string]: object;
[key: string]: object | any;

/**
*
Expand Down