swagger-api / swagger-api/swagger-codegen

[JAVA] Problem with properties that have "set" in their name

Open
#10,362 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

Description

The API I'm trying to generate the client for, hat a class Card with a property "name" and a property "setName" (The name of the set it belongs to). From that, the generator generates duplicate methods: A method void setName(String name) for setting the name and a method Card setName(String setName) that sets the setName and returns this.

Is there any way to avoid this? I cannot change the API.

Swagger-codegen version

I used editor.swagger.io

Swagger declaration file content or url

https://github.com/jdharmon/scryfallapi/blob/master/swagger.yaml

Command line used for generation

The one editor.swagger.io uses

Steps to reproduce
  1. Use a YAML-File that has a class with the properties "name" and "setName"
  2. Generate a Java-client
  3. Try to build the client

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 with the linked swagger.yaml and reproduce the generation through editor.swagger.io using a Java client, following the listed steps. Compare the generated methods for the name and setName properties; done means the generated client no longer contains duplicate setName methods and builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.