swagger-api / swagger-api/swagger-codegen
use dot in field name generate invalid js code
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
when I change the following part of the yaml file to
BigxSrc:
.........
src_userName:
type: string
example: 'Marry'
BigxSrc:
.........
src.userName: <<<<<<<<<<<<<<changed from src_userName
type: string
example: 'Marry'
swagger codegen generate some invalid javascript code.
As I want to make "src.userName" as a field name but not means next level.
as in javascript code, it will be something like
src.userName = undefined
which is syntax error. Is that possible to make it like this ?
["src.userName"] = undefined
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing JavaScript client generation with the YAML field name "src.userName" and inspect the generated assignment. Trace the generator template or entry point responsible for property assignments. Done means the literal dotted field name produces valid JavaScript and remains distinct from a nested property.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100