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

Created on 11 Apr 2020  路  6Comments  路  Source: OpenAPITools/openapi-generator

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] What's the version of OpenAPI Generator used?
  • [x] Have you search for related issues/PRs?
  • [x] 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"
}

JavaScripNode.js Bug

All 6 comments

馃憤 Thanks for opening this issue!
馃彿 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

馃憢 Any news about that problem?

As a follow up, jsonld generates property names like @id and @context which are then changed to just id and context as the model property name.
This can cause duplicates in typescript models if there is another property without the @. E.g. id or context.

Is there a way to generate the model property names and keep them @id? I tried the allowUnicodeIdentifiers option.

Same issue here. Have you found any workaround?

Same problem.

For reference, it sounds like the OpenAPI files generated by API Platform don't comply with the Schema name restrictions specified in OpenAPI 3. See OAI/OpenAPI-Specification#634 and OAI/OpenAPI-Specification#1387 for spec discussion, api-platform/api-platform#1493 for API Platform discussion.

Was this page helpful?
0 / 5 - 0 ratings