Skip to content

Loader fails to load file with no reason #759

@akzincsystems

Description

@akzincsystems

I'm seeing an error:

bad data in "#/components/schemas/UserStruct"

when calling openapi3.NewLoader().LoadFromFile(path)

This is being emitted from openapi3/loader.go L358 which is the default case in a switch statement, and no reason is given.

Dumping the reflect values gives:
reflect.TypeOf(cursor).Kind().String == ptr
reflect.TypeOf(cursor).String() == *openapi3.SchemaRef

which I can see for all other schema components as well

The particular component is:

  schemas:
    UserStruct:
      title: "A User"
      type: object
      properties:
        struct:
          $ref: "#/components/schemas/StructVersionV1"
        data:
          $ref: "#/components/schemas/UserV1"

All referenced schemas are in the file and the entire yaml schema validates at https://app.swaggerhub.com

lib version is: github.com/getkin/kin-openapi v0.113.0

Any ideas why this might be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions