OpenAPITools / OpenAPITools/openapi-generator

[BUG] attribute components.schemas.Schema name doesn't adhere to regular expression ^[a-zA-Z0-9.-_]+$

Open
#5,899 10 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: JavaScript/Node.js Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Hello, I use API Platform as API server and I use OpenAPI Generator to generate client for it from OpenAPI 3 Specs. API-Platform uses : as logical divider in Schema names and OpenAPI Generator does not like it.

-attribute components.schemas.Schema name CategoryProductTypeResource:jsonld doesn't adhere to regular expression ^[a-zA-Z0-9.-_]+$

openapi-generator version

3.1.0

OpenAPI declaration file content or url

https://pastebin.com/NHKAFep8

Command line used for generation

openapi-generator generate -i openapi.json -g javascript -o client --additional-properties usePromises=true,useES6=true

Steps to reproduce
  1. Use provided OpenAPI declaration file content and command line for generation.
Related issues/PRs

Didn't found anything related

Suggest a fix

I'm not sure whether the problem is in Api-Platform, or the requirements of OpenAPITools are too strict.

Maybe add option to provide some kind of rename mapping:
{
"Category:jsonld-category_logo": "CategoryCategoryLogo"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the linked OpenAPI declaration and the shown JavaScript generation command, then trace where schema names are validated. Determine whether the generator or the input specification should change, and document the expected handling of names containing colons, including any rename mapping behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.