Skip to content

allOf with a single $ref to a composed schema renders {missing-type-info}` and an empty example #1170

Closed

Description

@azaczek

Since 10.0.0 (still in 12.0.0), wrapping a $ref in allOf (the common OAS 3.0 way to add a description next to a reference) loses all fields when the referenced schema itself uses allOf. It worked in 9.3.8.

Minimal spec
openapi: 3.0.3
info: { title: repro, version: 1.0.0 }
paths:
  /customers:
    get:
      responses:
        '200':
          description: ok
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Customer' }
components:
  schemas:
    Address:
      type: object
      properties:
        street: { type: string }
        city: { type: string }
    GeoAddress:
      allOf:
        - $ref: '#/components/schemas/Address'
        - type: object
          properties:
            lat: { type: number }
    Customer:
      type: object
      properties:
        address:
          description: Billing address
          allOf:
            - $ref: '#/components/schemas/GeoAddress'

Expected (as in 9.3.8)

Schema:

address  : object
  street : string
  city   : string
  lat    : number

Example:

{
  "address": {
    "street": "string",
    "city": "string",
    "lat": 0
  }
}

Actual (12.0.0)

Schema:

address  : {missing-type-info}

Example:

{}

Cause

Both schemaToAST and schemaToSampleObj treat schema.allOf.length === 1 && !schema.allOf[0].properties && !schema.allOf[0].items as a primitive. In schemaToAST this builds { ...schema.allOf[0], ...schema }, which overwrites the member's own allOf with the outer one, and then deletes allOf, so the member's composition is lost. In schemaToSampleObj the same condition returns no value, so the field is dropped from the example. The shortcut should not apply when the member has allOf / oneOf / anyOf.

Environment

RapiDoc 12.0.0 (official npm bundle), also reproduced in 11.0.1; correct in 9.3.8
render-style="focused" schema-style="table"
OpenAPI 3.0.3, validated against https://spec.openapis.org/oas/3.0/schema/2021-09-28

Activity

  1. thelastbackspace commented on Nov 6, 2026

    @thelastbackspace
    Contributor

    I took a look at this: the single-member allOf shortcut doesn't account for the member being composed itself, in schemaToAST, schemaToSampleObj and handleAllOfSchema. I have a small fix with tests and will open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions