Skip to content

OpenAPI 3.1.0 support: add rendering support for JSON Schema 2020-12 #8513

@char0n

Description

@char0n

The goal of this issue is to add rendering support for JSON Schema 2020-12 within SwaggerUI. Currently there isn't any JSON Schema 2020-12 capable renderer.

There are multiple ways how JSON Schema 2020-12 can be represented depending on the use case. This issue will deal with an Object Representation. In this approach, the JSON Schema is represented as a JavaScript object that can be used in the React application. The goal of this object representation is to visualize the JSON Schema is such a way, that person look at this representation will easily understand what the JSON Schema does.

Implementation for the renderer should be done in separate SwaggerUI plugin where all JSON Schema 2020-12 related code will be concentrated. This will allow further to possibly decouple this code from SwaggerUI in future. We should not use SwaggerUI plugin system features (to allow future decupling), but rather classic React ones (like contexts).

Implementation phases

MVP1

This phase includes rendering Core vocabulary identifier keywords. This includes:

  • displaying properties keyword so that MVP1 have some value
  • creating recursive mechanism of rendering JSON Schema 2020-12
  • creating UI components
  • displaying schema type
  • displaying schema format
  • displaying schema description
  • displaying schema title
  • support for boolean schemas
  • basic collapsible behavior
  • extended collapsible behavior (expanding embedded schemas)
  • BooleanJSONSchema(false) should return never as type
  • infer type if type not defined
  • handling cycles while computing schema type
  • handling cycles during rendering
  • detect if schema is expandable
  • tracking embedding level
  • integrate MVP1 into Schemas section + lazy schema resolution
  • integrate deep linking into `Schemas section (not implemented for Draft 4 Schemas)
  • add support for defaultModelsExpandDepth config option

Current visual representation

image

MVP2

MVP3

MVP4

  • prepare code to use MVP3 in Operations
  • prepare code to use MVP3 in Webhooks
  • integrate MVP3 in Operations
  • integrate MPV3 in Callbacks
  • integrate MVP3 in Webhooks
  • include/exclude read-only properties from rendering
  • include/exclude write-only properties from rendering

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions