Skip to content

Commit

Permalink
Fix the post processing of enums in the Python generator, such that i…
Browse files Browse the repository at this point in the history
…t uses the proper variable namesfrom x-enum-varnames
  • Loading branch information
0xMattijs committed May 3, 2024
1 parent 73f2d82 commit 1670c6f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,10 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "str"));
} else {
model.vendorExtensions.putIfAbsent("x-py-enum-type", "int");
enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "int"));
// Do not overwrite the variable name if already set through x-enum-varnames
if (model.vendorExtensions.get("x-enum-varnames") == null) {
enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "int"));
}
}
}
}
Expand Down

0 comments on commit 1670c6f

Please sign in to comment.