Skip to content

Add Layering support for OpenAPI documents #1160

@MaggieKimani1

Description

@MaggieKimani1

Feature description:
Currently, DevX API has been encountering performance bottlenecks within the API's capacity as a result of growth of Graph resources and the size of the OpenAPI file over time. In a bid to optimize performance and memory usage while adding support for different sovereign clouds, a new proposal targeting layering of OpenAPI documents was born.
Using this layering approach should also help optimize external reference resolution.

Possible solution:
Using a layering approach when dealing with different versions of OpenAPI documents e.g. v1-fairfax.yaml and beta-fairfax.yaml
To layer two OpenAPI documents, you can merge the content of both documents into a single OpenAPI document.

Example:

  1. First document (petStore1.yaml)
openapi: 3.0.0
info:
  title: Document 1
  version: 1.0.0
paths:
  /pets:
    get:
      summary: Get all pets
      responses:
        200:
          description: Success
  1. Second document (petStore2.yaml)
openapi: 3.0.0
info:
  title: Document 2
  version: 1.0.0
paths:
  /pets/{id}:
    get:
      summary: Get a pet's details
      responses:
        200:
          description: Success
  1. Combined document
openapi: 3.0.0
info:
  title: Combined Document
  version: 1.0.0
paths:
  /pets:
    get:
      summary: Get all pets
      responses:
        200:
          description: Success
  /pets/{id}:
    get:
      summary: Get a pet's details
      responses:
        200:
          description: Success

Additional Context:
There are two possible approaches we're considering:

  1. Using a collection that dedupes objects and shares memory between document object model graphs. We will however need to handle conflicts that may occur when both documents define the same elements (e.g., the same paths or properties) by removing the duplicate elements appearing in both documents. E.g.:
// merge 2 documents
petStore1.Attach(petStore2);

// Get DOM of the merged documents
var mergedInfo = petStore1.Info;
  1. Adding a layer property to the object models which in memory will be represented as a collection e.g. a dictionary of type <string, OpenAPIElement> which can help us index into a particular document and its properties e.g.
// Get DOM of a specific layer
var petStore1Info = petStore1.Layer["petStore1"].Info;
var petStore2Info = petStore1.Layer["petStore2"].Info;

Cc: @baywet, @darrelmiller

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-discussionAn issue that requires more discussion internally before resolvingstatus:on-holdAn issue that we are yet to work ontype:featureNew experience request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions