Skip to content

kin-openapi is not compatible with go-openapi/jsonpointer #247

@gordallott

Description

@gordallott

I realize this may be a bit of an esoteric issue, but right now, openapi3 structures are not compatible with github.com/go-openapi/jsonpointer. Functionally that means that you can't take a jsonpointer reference + an openapi3.Swagger and get reliably get a valid result.

The crux of the problem is the *Ref values. Using the petstore example and trying to get /paths/~1pet/put/responses/200/content fails as /paths/~1pet/put/responses/200 resolves to a ResponseRef value which doesn't have a content field

One approach would be by adding JSONLookup functions to all the ref structures, but the nieve approach (as outlined in how go-openapi deals with similar situations) introduces a dependency on github.com/go-openapi/jsonpointer which I'm not sure would be wanted

In addition to play nice with jsonpointer references, something like /components/schemas/Foobar should return a *Schema or struct{Ref string} depending on if Foobar is a Schema Object or a Request Object. Which would require a bunch of additional types like Schemas Headers Parameters and so on

I'm almost certainly going to need to solve this problem myself, but if I did so in a way that was upstreamable that would be a bonus

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