Skip to content

Loading error: kin-openapi bug found: circular schema reference not handled  #814

@17twenty

Description

@17twenty

Using with oapi-codegen I had errors trying to build out the Client from the code using:

#!/usr/bin/env
  FILE=xero_accounting.yaml

  ORIGINAL_STRIPPED=$(basename $FILE .yaml);
  NEW=$(echo $ORIGINAL_STRIPPED | tr 'xero-' 'xero_' | sed 's/xero_//')
  # Generate the API spec
  echo Generating from "$ORIGINAL_STRIPPED"
  mkdir -p "$PACKAGE_NAME/$NEW/"
  oapi-codegen --package=main -generate=types,client  -package "$PACKAGE_NAME" "$FILE" > "$PACKAGE_NAME/$NEW".gen.go

The output from that command being:

bash ./generator/scripts/golang/gen.sh
Generating from xero_accounting
error loading swagger spec in xero_accounting.yaml
: kin-openapi bug found: circular schema reference not handled - #/components/schemas/ExpenseClaim -> #/components/schemas/Payment -> #/components/schemas/CreditNote -> #/components/schemas/Payment -> #/components/schemas/Prepayment -> #/components/schemas/Allocation -> #/components/schemas/Prepayment -> #/components/schemas/Payment -> #/components/schemas/Invoice -> #/components/schemas/Payment

I followed up to use the latest kin-openapi as referenced in #764 but still see the below issue:

go run github.com/getkin/kin-openapi/cmd/validate@latest -- xero_accounting.yaml 
go: downloading github.com/getkin/kin-openapi v0.118.0
go: downloading github.com/perimeterx/marshmallow v1.1.4
2023/06/23 11:10:58 Loading error: kin-openapi bug found: circular schema reference not handled - #/components/schemas/Overpayment -> #/components/schemas/Payment -> #/components/schemas/Overpayment -> #/components/schemas/Allocation -> #/components/schemas/Invoice -> #/components/schemas/Prepayment -> #/components/schemas/Payment -> #/components/schemas/BatchPayment -> #/components/schemas/Payment -> #/components/schemas/CreditNote -> #/components/schemas/Allocation -> #/components/schemas/Invoice -> #/components/schemas/CreditNote -> #/components/schemas/Payment
exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions