Skip to content

Commit ba5ecbc

Browse files
authored
Improved Elixir Atom Generation (#20229)
* Update ElixirClientCodegen.java * Refine the regular expression for atoms The original regex incorrectly matched `@atom` (unquoted atoms cannot begin with @). However, through testing with `iex`, it also turns out that the atom `:@` is legal. The following atoms will now be quoted that would have been incorrectly not quoted: - `:@type` * Add model to petstore client to test new atom creation regex pattern
1 parent 52b5b8f commit ba5ecbc

File tree

5 files changed

+279
-237
lines changed

5 files changed

+279
-237
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
public class ElixirClientCodegen extends DefaultCodegen {
4949
private final Logger LOGGER = LoggerFactory.getLogger(ElixirClientCodegen.class);
5050

51-
private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_@\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-)\\z");
51+
private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-|@)\\z");
5252

5353
@Setter protected String packageVersion = "1.0.0";
5454
@Setter protected String moduleName;

0 commit comments

Comments
 (0)