Skip to content

Lazy resolution #4248

@shockey

Description

@shockey

Description

Lazy resolution will allow us to handle larger API definitions more effectively in Swagger-UI.

We currently run entire API definitions through the Swagger-Client resolver when the definition is loaded into the UI. We can save a lot of effort by having the UI request resolved data as needed.

Conveniently, $ref usage is restricted in the Swagger and OpenAPI Specifications, so we can rely on having enough data to populate a list of operations and models without resolving anything, and only resolve things when users interact with the UI.

Plan

  • Create specActions.requestResolution([...path])
  • Create specSelectors.getResolvedSubtree([...path])
  • New flow:
    • requestResolved ->
    • is resolved data cached in state?
      • yes? noop
      • no? async SwC.resolveIn ->
        • update resolved state ->
        • re-render with updated state through getResolvedSubtree
  • Rework Models & Operations to request and consume resolved subtrees as needed
  • Support Swagger-Editor lifecycle in modified rendering (invalidate and re-request resolved subtrees when the spec content updates)
  • Move spec metadata out of resolved key, into a new meta key
  • Stop resolving by default (will need to provide an example to folks who will continue relying on specResolved)
  • Collapse models by default, so they don't need to be resolved until the user interacts with them

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions