swagger-api / swagger-api/swagger-codegen

[Kotlin] Parse @JsonProperty annotation values with spaces

Open
#8,685 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

Issue:

When generating a client in Kotlin (from a Kotlin project), @JsonProperty annotation values which have spaces in them are converted to variable names with spaces.
Example:
In project:
@JsonProperty("email address")
val email: String

Result in client:
val email address: String

This of course causes a build failure and thus the only solution at the moment is to not use values with spaces.

Possible solutions:
  1. Kotlin does allow for variable and method name declarations with spaces.
    For example, val `email address`: String
  2. The space could be replaced with an underscore
  3. The name could be parsed to form a word in camelCase (starting with a lower case letter).

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

No files or tests are named. Start by locating the Kotlin client generator and the handling of JsonProperty values, then reproduce the example with the value "email address". Done means the generated client uses a valid Kotlin declaration and includes a regression test for spaced annotation values.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
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.