Skip to content

The OpenApiFilter service does not copy all references from the original document. #1799

Closed

Description

Related to microsoft/kiota#5263

Using the OpenApiFilter services does not copy all references in the original document resulting in some missing refs/invalid document.

Taking a look at the visitor at

The only references/components copied over are of type schemas,parameters,requestBodies and responses. This leads to leaving out other components that could be referenced like examples/headers/callbacks from the components. See properties at https://github.com/microsoft/OpenAPI.NET/blob/vnext/src/Microsoft.OpenApi/Models/OpenApiComponents.cs#L14

Activity

  1. changed the title [-]The OpenApiFilter services does not copy all references in the document.[/-] [+]The OpenApiFilter service does not copy all references from the original document.[/+] on Aug 29, 2024
  2. maisarissi commented on Aug 29, 2024

    @maisarissi

    Hey Andrew Omondi (@andrueastman) Maggie Kimani (@MaggieKimani1) , will this also fix the issue of having "relative path" in the server URL?
    I noticed yesterday by using Kiota that given this OpenAPI description: https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json my sliced OpenAPI description was also changing the server URL to:

    servers:
      - url: '{protocol}://{hostname}/api/v3'
        variables:
          hostname:
            default: HOSTNAME
            description: Self-hosted Enterprise Server or Enterprise Cloud hostname
          protocol:
            default: http
            description: Self-hosted Enterprise Server or Enterprise Cloud protocol

    Server URLs for plugin generation always need to be absolute and start with https. So this is making the integration to fail in TTK.

  3. MaggieKimani1 commented on Aug 30, 2024

    @MaggieKimani1
    Contributor

    Hey Andrew Omondi (@andrueastman) Maggie Kimani (@MaggieKimani1) , will this also fix the issue of having "relative path" in the server URL? I noticed yesterday by using Kiota that given this OpenAPI description: https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json my sliced OpenAPI description was also changing the server URL to:

    servers:
      - url: '{protocol}://{hostname}/api/v3'
        variables:
          hostname:
            default: HOSTNAME
            description: Self-hosted Enterprise Server or Enterprise Cloud hostname
          protocol:
            default: http
            description: Self-hosted Enterprise Server or Enterprise Cloud protocol

    Server URLs for plugin generation always need to be absolute and start with https. So this is making the integration to fail in TTK.

    No this seems to be a completely different issue as server information seems to get lost during copying. Let me investigate and work on a separate fix for this.

  4. andrueastman commented on Aug 30, 2024

    @andrueastman
    ContributorAuthor

    Hey Maísa Rissi (@maisarissi),

    Any chance you can double check this for us?

    The description at https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/ghes-3.0/ghes-3.0.json
    seems to replicate your scenario as the original server object is as you say.
    image

    However, using the document at https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json which you shared does not replicate this scenario.

  5. maisarissi commented on Aug 30, 2024

    @maisarissi

    Just figured out the issue.

    First time, I ran the deep link using the https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/ghes-3.0/ghes-3.0.json
    Kiota has copied the original OpenAPI description into the .kiota folder. But because we were having the issue with the Ref Examples and the server URL, I changed to https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json
    I guess Kiota was still using the local copy rather then the new URL.

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

Metadata

Metadata

Labels

type:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions