Skip to content

Remove cyclic dependency between rest-api-spec and schema.json #5304

@pquentin

Description

@pquentin

Today, the rest-api-spec is used as an input for generating the schema.json file. In #5295, the schema.json file is used as as the sole source to generate rest-api-spec files, which introduces a cyclic dependency. We'd like to eliminate it.

Here is what needs to change in the compiler to do so.

compiler/src/build-model.ts

  • rest-api-spec is the source of truth to list all APIs - we need to add all of them to the Elasticsearch specification.
  • compileEndpoints adds the following defaults from rest-api-spec:
    • API name, description, docUrl, docTag, extDocUrl, availability/stack, requestBodyRequired, urls, feature flags

Each step also has access to jsonSpec. It's used for:

compiler/src/steps/add-content-type.ts

  • headers: accept and content-type

steps/add-description.ts

  • default parts description
  • default query parameters description
  • request description
  • endpoint description

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