Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Schema processing fails when "allOf" references to nullable object

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, python
Domain
api, tooling

Research direction

Start by running openapi-python-client 0.21.1 against the supplied OpenAPI 3.0.1 document and trace the schema-processing path that emits "Cannot take allOf a non-object." Use the nullable RelatedItemSuper and RelatedItem definitions as the regression case; done means client generation succeeds without requiring nullable to be changed to false.

Written by the indexing model from the issue text.

Description

Describe the bug
When using a schema that contains an "allOf" reference to a nullable object, the generation fails with the message "Cannot take allOf a non-object".

OpenAPI Spec File
Document to recreate:

openapi: 3.0.1
info:
  title: Title
  description: Description
  version: 1.0.0
servers:
  - url: /api
paths:
  /item:
    get:
      operationId: item
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'
components:
  schemas:
    RelatedItemSuper:
      type: object
      nullable: true
      properties:
        propertyA:
          type: string
    RelatedItem:
      type: object
      allOf:
        - $ref: '#/components/schemas/RelatedItemSuper'
        - type: object
          properties:
            propertyB:
              type: string
    Item:
      type: object
      nullable: false
      properties:
        key:
          type: string
        relatedItem:
          $ref: '#/components/schemas/RelatedItem'

A real world example can be found here.

Desktop (please complete the following information):

  • OS: Linux
  • Python Version: 3.11.2
  • openapi-python-client version: 0.21.1

Additional context
Changing "nullable" to "false" on "RelatedItem" in the above example works but does not seem to be a suitable solution as the construct used is legitimate, or is it not?

Dominant language
Python
Stars
2k
Forks
293
Avg merge
34m
Merged PRs (30d)
1

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.

More from openapi-generators/openapi-python-client

All issues in openapi-generators/openapi-python-client

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.