swagger-api / swagger-api/swagger-codegen

'hasMore' doesn't work as expected.

Open
#9,634 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

'hasMore' doesn't work as expected.

Description

I want to use 'swagger-codegen-maven-plugin' to generate Java code with custom template.
But it doesn't work as I expected.

Swagger-codegen version

2.4.7 and lower

Swagger declaration file content or url
 produces:
 - "application/xml"
 - "application/json"

I expect:

@Produces({"application/xml","application/json"})

but got:

@Produces({"@Produces({"application/xml","application/json"})

and mustache template is:

{{#produces}}@Produces({"{{/produces}}{{#produces}}{{#mediaType}}{{mediaType}}{{/mediaType}}{{#hasMore}}","{{/hasMore}}{{^hasMore}}"}){{/hasMore}}{{/produces}}

I'm not sure whether it's a bug.

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 supplied swagger-codegen-maven-plugin configuration, Swagger declaration, and Mustache template, then reproduce the generated Java output for swagger-codegen 2.4.7 or lower. Compare the handling of hasMore with the expected @Produces annotation and determine what output marks the issue as fixed; no test or source file is named in the report.

Written by the indexing model from the issue text.

Assessment

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