swagger-api / swagger-api/swagger-codegen

[Swift] swift documentation: response headers and examples repeat output

Open
#7,663 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

API Function documentation block:
headers and examples all elements are output, but it's repeated.

maybe number of elements.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

Spec File:
http://petstore.swagger.io/v2/swagger.json

UserAPI.swift:

    /**
     Logs user into the system
     - GET /user/login
     - 
     - responseHeaders: [X-Rate-Limit(Int32), X-Expires-After(NSDate)]
     - responseHeaders: [X-Rate-Limit(Int32), X-Expires-After(NSDate)]
     - examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example="aeiou"}]
     - examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example="aeiou"}]
     
     - parameter username: (query) The user name for login 
     - parameter password: (query) The password for login in clear text 

     - returns: RequestBuilder<String> 
     */

api.mustache (swift/swift3/swift4):

      - name: {{name}}{{/authMethods}}{{#responseHeaders}}
    - responseHeaders: {{responseHeaders}}{{/responseHeaders}}{{#examples}}
    - examples: {{{examples}}}{{/examples}}{{#externalDocs}}
Command line used for generation
swagger-codegen generate \
        -i http://petstore.swagger.io/v2/swagger.json \
        -l swift4 \
        -o ./swift4-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 api.mustache templates for swift, swift3, and swift4, then generate the client using the provided petstore Swagger URL and command. Compare the generated UserAPI.swift documentation with the issue example. Done means each responseHeaders and examples entry appears once rather than being repeated.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.