Skip to content

Array index in $ref #450

Closed
Closed

Description

@Yamakaky

Describe the bug
The generator doesn't seem to support array indices in $ref.

To Reproduce

openapi-python-client generate --path /tmp/bug.json
Generating bug-client
Warning(s) encountered while generating. Client was generated, but some pieces may be missing

ERROR parsing POST /alarms within default. Endpoint will not be generated.

Could not find reference in parsed models or enums

Reference(ref='#/paths/~1alarms/post/parameters/0/schema')

Expected behavior
The following $ref should resolve to the parameter's schema.

OpenAPI Spec File

{
  "openapi": "3.0.1",
  "info": {
    "title": "Bug",
    "version": "1.0"
  },
  "paths": {
    "/alarms": {
      "post": {
        "parameters": [
          {
            "name": "X-ID",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "$ref": "#/paths/~1alarms/post/parameters/0/schema"
                    }
                }
              }
            }
          }
        },
        "responses": {
        }
      }
    }
  }
}

Desktop (please complete the following information):

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

Activity

  1. added
    🐞bug
    on Jul 6, 2021
  2. added
    ✨ enhancement
    and removed
    🐞bug
    on Jul 8, 2021
  3. added
    🍭 OpenAPI Compliance
    on Aug 13, 2023
  4. locked and limited conversation to collaborators on Aug 13, 2023
  5. converted this issue into a discussion #835 on Aug 13, 2023
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

    ✨ enhancement🍭 OpenAPI Compliance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions