Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Incorrect variable names generated for Swift #35

@aswathr

Description

@aswathr

Trying to generate object models result in weird behaviour for Swift.
For example, I expect the following JSON:

{  
    "teamId": "$ùp@n0v@",
    "teamspaceId": 12345,
    "team_name": "supernova"
}

to generate a model like:

struct Untitled2 {
    let teamId: String
    let teamspaceId: Int
    let team_name: String
}

however, I get this:

struct Untitled2 {
    let teamID: String        // The 'd' in teamId is automatically uppercased
    let teamspaceID: Int         // Same as above
    let teamName: String        // The underscore is removed here and the var name is automatically camel-cased
}

Ok, so I checked the web version of quick type and it seems to generate the CodingKeys along with the code, which is neat, but it seems to be missing in the vs-code version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions