swagger-api / swagger-api/swagger-codegen

use dot in field name generate invalid js code

Open
#7,317 0 comments 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

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.