swagger-api / swagger-api/swagger-ui

Add better property, & "alternate type", level deprecated support in documentation generation

Open
#7,581 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: style & presentation
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Content & configuration

Swagger/OpenAPI definition:

   /bar:
       put:
         deprecated: true
         parameters: 
         - name: baz
           deprecated: true
           in: query
           schema:
             type: string
         requestBody:
           content:
             application/json:
               schema:
                   type: object
                   properties:
                     a:
                       type: integer
                     b:
                       deprecated: true
                       type: integer
                     c:
                       oneOf:
                       - type: boolean
                       - type: integer
                         deprecated: true
             application/xml:
               schema:
                   type: object
                   properties:
                     a:
                       type: integer
                   xml:
                     name: _foo_
Is your feature request related to a problem?

While efficientely clear at the path method & query parameter levels, the deprecation status is not clear enough at the property level & for property alternative types

image

image

We currently have different/inconsistent representations of the deprecated status depending or where it applies

Level Strike Grey Warning Red deprecated deprecated: true drop in example
method ✔️ ✔️ ✔️ NA
parameter ✔️ ✔️ NA
property ✔️ ✔️ ✔️
oneOf type ✔️ ✔️
ref ✔️
Describe the solution you'd like

Wherever a depracated flag is set, I'd expect a uniform combo of:

  • grey/italic fonct style & color
  • a red warning message
Additional context

Moreover
The deprecated flag is not accepted at (by schema) at those levels:

  • media type to deprecate a media type alternative (either in requestBody or responses)
  • paths property (ex /foo) to deprecate an URI whatever the method (currently requires one deprecated per method)
  • root or info, to deprecate a whole API definition (would currently require a deprecated for each method of each path)
  • servers item, to deprecate a server configuration compared to the others

but this should be a separated feature request ;-)

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 Swagger/OpenAPI definition in the issue and trace how documentation generation renders deprecated methods, parameters, properties, and oneOf types. Compare the existing representations shown in the table and examples; done means deprecated properties and alternative types consistently receive grey italic styling and a red warning message.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, frontend
Issue type
Feature
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.