Skip to content

Support relative references in YAML/JSON #1961

Closed

Description

Is your feature request related to a problem? Please describe the problem.

I was attempting to scaffold a client for Mixpanel, unfortunately it uses references to other files (JSON pointers), which is apparently not supported in Kiota.

Mixpanel OpenAPI Spec: https://github.com/mixpanel/docs/blob/main/openapi/src/ingestion.openapi.yaml

As I understand doing this is actually valid according to the OpenAPI specification:

If a URI contains a fragment identifier, then the fragment should be resolved per the fragment resolution mechanism of the referenced document. If the representation of the referenced document is JSON or YAML, then the fragment identifier SHOULD be interpreted as a JSON-Pointer as per RFC6901.

Source: https://swagger.io/specification/#relative-references-in-uris

This is the error that gets raised by Kiota:

$> kiota generate -l CSharp -c MixpanelClient -n MixpanelTest.MixpanelClient -d https://raw.githubusercontent.com/mixpanel/docs/refs/heads/main/openapi/src/ingestion.openapi.yaml -o ./MixpanelClient

crit: Kiota.Builder.KiotaBuilder[0]
      error generating the client: Unable to cast object of type 'SharpYaml.Serialization.YamlScalarNode' to type 'SharpYaml.Serialization.YamlMappingNode'.

Client library/SDK language

Csharp

Describe the solution you'd like

It would be nice if it can resolve the relative URIs to scaffold the API successfully. I would be fine if I'm required to download all YAML files locally first - I imagine that is easier to implement.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions