openapi-generators / openapi-generators/openapi-python-client

Unable to process schema when title is ambiguous

Open
#1,355 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

Unable to process schema /components/schemas/ActualApprovement:

Could not find reference in parsed models or enums

Failure to process schema has resulted in the removal of:
/components/schemas/ActualApprovement

Reference(ref='#/components/schemas/backend__server__src__models__types__approvement__ApprovementStatus')

OpenAPI Spec File
A link to an OpenAPI document which produces this issue. Ideally, write a minimal reproduction only containing the problematic pieces.

{
  "components": {
    "schemas": {
      "backend__gateways__types__ApprovementStatus": {
        "type": "string",
        "enum": [
          "in_progress",
          "suspended",
          "rejected",
          "closed"
        ],
        "title": "ApprovementStatus"
      },
      "backend__server__src__models__types__approvement__ApprovementStatus": {
        "type": "string",
        "enum": [
          "pending",
          "approved",
          "rejected",
          "cancelled"
        ],
        "title": "ApprovementStatus"
      },
"ActualApprovement": {
        "properties": {
          "status": {
            "$ref": "#/components/schemas/backend__server__src__models__types__approvement__ApprovementStatus"
          }
        },
        "type": "object",
        "required": [
          "status",
        ],
        "title": "ActualApprovement"
      },
}}}

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Python Version: 3.9
  • openapi-python-client version 0.27.1

Additional context
Add any other context about the problem here.

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 reproducing the failure with the OpenAPI document in the issue, focusing on schema parsing and reference resolution for the two schemas sharing the title "ApprovementStatus." Done means the referenced enum resolves correctly and the ActualApprovement schema is not removed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.