swagger-api / swagger-api/swagger-codegen

[Javascript] codegen produces broken models for types inherited from primitive

Open
#9,113 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Javascript codegen produces broken models (not using data at all) for types inherited from primitive types like the following.

Swagger-codegen version

Tested with 2.4.1 and 2.3.1, not a regression

Swagger declaration file content or url
  ResourceId:
    description: Identifier assigned for further use of the created resource through API calls
    type: string
    pattern: '^([a-zA-Z0-9 /\-?:\()\.,'']{1,35})$'
    readOnly: true
Related issues/PRs

https://github.com/swagger-api/swagger-codegen/pull/9112

Suggest a fix/enhancement

Checking if parent type is primitive

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

Read the JavaScript codegen handling for models inherited from primitive types, then compare the behavior with related PR #9112 and the provided ResourceId Swagger declaration. Done means generated models for primitive-derived types use the declared data instead of producing broken empty models.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.