Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13390
Closed
Open
Issue created Sep 09, 2022 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[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

test.yml

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.

Assignee
Assign to
Time tracking