swagger-api / swagger-api/swagger-codegen

Swagger Spring Boot Code Gen - API docs don't reflect the actual YAML for Array return type

Open
#3,852 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

From @techlogix on September 22, 2016 13:51

Swagger File

 # paste your swagger document here
   responses:
        "200":
          description: successful operation
          schema:
            type: array
            items:
              $ref: "#/definitions/PaygoVendor"

/api-docs

responses: {
200: {
description: "successful operation",
schema: {
$ref: "#/definitions/PaygoVendor"
}

  • Version: swagger.editor.io
  • Browser/OS: all

Issue
There is a DIFFERENCE in the generated API spec from the Spring Boot generated source from the YAML spec for ARRAY return type.
Easy to replicate - basically

  1. define an API with in YAML a 200 schema type:array and items with a $ref.
    schema:
    type: array
    items:
    $ref: "#/definitions/PaygoVendor"
  2. Generate Spring Boot Server Stub.
  3. Compile and run with maven.
  4. view /api-docs and the response type schema rendered is NOT an array anymore!
    schema: {
    $ref: "#/definitions/PaygoVendor"
    }

Copied from original issue: swagger-api/swagger-editor#1068

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 provided Swagger YAML response schema and reproduce the issue by generating a Spring Boot server stub, compiling it with Maven, and viewing /api-docs. Compare the generated API documentation with the array schema and its $ref item; done means the rendered response remains an array.

Written by the indexing model from the issue text.

Assessment

Tech stack
spring-boot
Domain
api, tooling
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.