Redocly / Redocly/redocly-cli

Decorator or feature flag to bundle merge "allOf" schemas

Open
#1,236 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
228
Avg merge
1d 14h
Merged PRs (30d)
48

Description

Is your feature request related to a problem? Please describe.

Let's say I have these schemas:

schemas:
  Car:
    allOf: 
      - $ref: #/components/schemas/Make
      - $ref: #/components/schemas/Model
      - type: object
        properties:
          manufacturedAt:
             type: string
             format: date
          color:
             type: string
  Make:
    type: object
    properties:
       make:
           type: string
           enum: 
              - Batmobile
              - DeLorean
  Model:
    type: object
    properties:
       model:
           type: string

And now, I have an application (not Redocly), that needs to consume this schema and operate on it. The application struggles with the allOf. I wish to have a resulting merged schema like the following to make it easier for third party programs to use:

Car:
  type: object
  properties:
     make: ...
     model: ...
     manufacturedAt: ...
     color: ...

Describe the solution you'd like

  1. A flag on the bundle command like --merge-all-of.
  2. A decorator that can be included in a redocly.yaml file like merge-all-of.

Describe alternatives you've considered

Requesting third party libs have better allOf support. 🤣

Additional context

None

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 by examining the bundle command and the redocly.yaml decorator configuration mentioned in the issue. Determine how merging referenced allOf schemas should handle the shown properties and references, then verify that both the --merge-all-of flag and merge-all-of decorator produce the requested flattened schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.