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

overriding model property with more specific object type doesn't work

Open
#1,123 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the issue with the OpenAPI spec linked in the report and inspect the generated models for BaseTask and SpecialTask. Trace how inherited and redeclared object properties are resolved; done means SpecialTask.result is generated with the SpecialTaskOutputData type rather than BaseTaskResult.

Written by the indexing model from the issue text.

Description

Describe the bug
When an object schema derives from another object schema using allOf, and redeclares a property that had an object type to use a different object type, the generated code uses the old type for that property.

OpenAPI Spec File
https://gist.github.com/eli-bl/d5658d6714e1c9ef544ef1fc8902960a

With this example, the type of SpecialTask.result in the generated code should be SpecialTaskOutputData. Instead it is being declared as BaseTaskResult, the same as BaseTask.result.

Desktop (please complete the following information):

  • OS: macOS 14.5
  • Python Version: 3.8.15
  • openapi-python-client version: 0.21.5
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.