Skip to content

allOf with redundant type causes the type to be serde_json::Value when it should be the full type #56

Description

@mwja

Version or commit

openapi-to-rust 0.12.1

Affected area

Generated models

Minimal OpenAPI fragment

openapi: "3.1.0"
info:
  title: repro
  version: "1"
paths: {}
components:
  schemas:
    Widget:
      type: object
      allOf:
        - $ref: "#/components/schemas/WidgetBase"
        - $ref: "#/components/schemas/WidgetExtra"
    WidgetBase:
      type: object
      properties:
        id:
          type: string
    WidgetExtra:
      type: object
      properties:
        name:
          type: string

Configuration and command

openapi-to-rust generate repro-minimal.yaml --types-only --output-dir out --module-name repro

Actual behavior

allOf when paired with type: object collapses into serde_json::Value

Expected behavior

it should be a combination of all types involved, similar to anyOf becoming an enum

Environment

macOS 26.5, rustc 1.97.1 (8bab26f4f 2026-07-14), cargo install

Checks

  • I removed credentials and private API data.
  • I searched existing issues for this behavior.
  • This is not a security vulnerability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions