swagger-api / swagger-api/swagger-codegen

[spring] descriptions for requestBody do not seem to generate properly

Open
#9,915 0 comments 1 reaction 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

an example of a path I have in my yaml is

paths:
  /shipment/create:
    post:
     description: |
        ## This call will create a shipment
      requestBody:
        description: | 
          **Required information**
          ---
          > * Information 1
          > * Information 2
          > * Information 3
          > * Information 4
          ---

and how that gets generated in the Api interface is

ResponseEntity<Object> createShipment(@ApiParam(value = "**Required information**
---
> * Information 1
> * Information 2
> * Information 3
> * Information 4
---
" ,required=true )  @Valid @RequestBody ShipmentBasicInfoResponse body);

This will obviously not work without reformatting it to

ResponseEntity<Object> createShipment(@ApiParam(value = "**Required information** --- > * Information 1 > * Information 2 > * Information 3 > * Information 4 --- " ,required=true )  @Valid @RequestBody ShipmentBasicInfoResponse body);

This is being generated through swaggerhub. The only codegen option that has been changed was hideGenerationTimestamp = true.

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 by reproducing the issue with the YAML example and the generated Spring Api interface shown in the report. No source file or test is named, so locate the Spring generator's requestBody description handling and inspect the generated annotation output. Done means multiline Markdown descriptions produce valid, usable generated Java annotations without manual reformatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.