[BUG][typescript] Unbalanced brackets in patterns during parsing
Created by: zodiia
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output?
Description
I am trying to generated an OpenAPI client using the typescript
generator. Unfortunately, I am hitting a bug with the parser, which seemingly forgets the last character of regex patterns.
With the pattern [A-Z]{3}
, I get the following error message:
Exception: Unbalanced '{' - missing '}' at
'[A-Z]{3'
^
Caused by: com.github.curiousoddman.rgxgen.parsing.dflt.RgxGenParseException: Unbalanced '{' - missing '}' at
'[A-Z]{3'
^
(full log using the provided sample OpenAPI in attached files: output.log)
Changing the pattern to something else, like [A-Z][A-Z][A-Z]
doesn't help either, the same error message pops up with the last character seemingly disappearing. Changing it to [A-Z]{3}}
solves the issue, but is obviously not a fix since it will break up other generators.
Note that, in the schemas section of the error message, the parsed schema does have the last pattern character in it (as seen in the full log: pattern: [A-Z]{3}
).
openapi-generator version
6.0.1
, 6.1.0
, 6.2.0
OpenAPI declaration file content or url
Generation Details
I am simply using the openapi-generator-cli
command, providing an input OpenAPI file, typescript
generator and an output directory.
Steps to reproduce
Using the provided sample OpenAPI file above and run the following command: openapi-generator-cli generate -i test.yml -g typescript -o ./out
Related issues/PRs
Not found.
Suggest a fix
My theory is that the typescript
generator is, for some reason, removing the last character of patterns, which it shouldn't do.