Skip to content

Commit

Permalink
fix a typo and remove the r# generated to the paramName when we creat…
Browse files Browse the repository at this point in the history
…e the identifier
  • Loading branch information
xMAC94x committed Jan 3, 2025
1 parent 46f1379 commit b695b68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class AbstractRustCodegen extends DefaultCodegen implements Code

private final Logger LOGGER = LoggerFactory.getLogger(AbstractRustCodegen.class);

protected static final String VENDOR_EXTENTION_PARAM_IDENTIFIER = "x-rust-param-identifier";
protected static final String VENDOR_EXTENSION_PARAM_IDENTIFIER = "x-rust-param-identifier";

protected List<String> charactersToAllow = Collections.singletonList("_");
protected Set<String> keywordsThatDoNotSupportRawIdentifiers = new HashSet<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,14 @@ public void postProcessParameter(CodegenParameter parameter) {
if (this.useSingleRequestParameter) {
in_function_identifier = "params." + parameter.paramName;
} else {
in_function_identifier = "p_" + parameter.paramName;
if (parameter.paramName.startsWith("r#")) {
in_function_identifier = "p_" + parameter.paramName.substring(2);
} else {
in_function_identifier = "p_" + parameter.paramName;
}
}
if (!parameter.vendorExtensions.containsKey(this.VENDOR_EXTENTION_PARAM_IDENTIFIER)) { // allow to overwrite this value
parameter.vendorExtensions.put(this.VENDOR_EXTENTION_PARAM_IDENTIFIER, in_function_identifier);
if (!parameter.vendorExtensions.containsKey(this.VENDOR_EXTENSION_PARAM_IDENTIFIER)) { // allow to overwrite this value
parameter.vendorExtensions.put(this.VENDOR_EXTENSION_PARAM_IDENTIFIER, in_function_identifier);
}
}

Expand Down

0 comments on commit b695b68

Please sign in to comment.