Skip to content

[Typescript] Fix warning logs for additional properties that have not been set #21630

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -6024,10 +6024,8 @@ protected Map<String, Schema> unaliasPropertySchema(Map<String, Schema> properti
if (properties != null) {
for (String key : properties.keySet()) {
properties.put(key, unaliasSchema(properties.get(key)));

}
}

return properties;
}

Expand Down Expand Up @@ -7093,7 +7091,7 @@ public boolean convertPropertyToBoolean(String propertyKey) {
} else if (booleanValue instanceof String) {
result = Boolean.parseBoolean((String) booleanValue);
} else {
LOGGER.warn("The value (generator's option) must be either boolean or string. Default to `false`.");
LOGGER.warn("The value {} must be either boolean or string. Default to `false`.", propertyKey);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR

can we still keep (generator's option) in the log some users misunderstood this option as a global option instead if I remember correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have readded that information to the log

}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp

private final Map<String, String> frameworkToHttpLibMap;

@Setter
private boolean useRxJS;
@Setter
private boolean useInversify;

// NPM Options
private static final String NPM_REPOSITORY = "npmRepository";

Expand Down Expand Up @@ -461,12 +466,12 @@ public void processOpts() {
additionalProperties.put(IMPORT_FILE_EXTENSION_SWITCH, ".ts");
}

final boolean useRxJS = convertPropertyToBooleanAndWriteBack(USE_RXJS_SWITCH);
convertPropertyToBooleanAndWriteBack(USE_RXJS_SWITCH, this::setUseRxJS);
if (!useRxJS) {
supportingFiles.add(new SupportingFile("rxjsStub.mustache", "rxjsStub.ts"));
}

final boolean useInversify = convertPropertyToBooleanAndWriteBack(USE_INVERSIFY_SWITCH);
convertPropertyToBooleanAndWriteBack(USE_INVERSIFY_SWITCH, this::setUseInversify);
if (useInversify) {
supportingFiles.add(new SupportingFile("services" + File.separator + "index.mustache", "services", "index.ts"));
supportingFiles.add(new SupportingFile("services" + File.separator + "configuration.mustache", "services", "configuration.ts"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public void processOpts() {
}
}

setGenerateValidationAttributes(convertPropertyToBooleanAndWriteBack(VALIDATION_ATTRIBUTES));
convertPropertyToBooleanAndWriteBack(VALIDATION_ATTRIBUTES, this::setGenerateValidationAttributes);
}

@Override
Expand Down
Loading