Skip to content

oav generate-examples generated.json fails to parse x-ms-paths #1006

Open

Description

I have a set of TypeSpec files (see this draft PR into azure-rest-api-specs): Azure/azure-rest-api-specs#26146

I run "npx tsp compile" to create an OpenAPI file named "generated.json" from these TypeSpec files.

You can find "generated.json" in the mentioned PR.

I now run "oav generate-examples generated.json". I got a console spew that looks like one example is being generated, but at the end, I got the error below.

{
  message: "fatal error: Cannot read properties of undefined (reading 'post'), {}",
  level: '\x1B[31merror\x1B[39m'
}
fatal error: Cannot read properties of undefined (reading 'post'), {}

Looking at generated.json, I see I have:

"paths": {},
 "x-ms-paths": { ... }

I had to delete the empty "paths" element and rename "x-ms-paths" to "paths" to make the error go away. So I just ended up with:

"paths": {...},

On IM Timothee G. wrote, "Sounds like a bug in oav those paths should be in x-ms-paths it is invalid to have query parameters in paths in swagger which is why x-ms-paths was created". He suggested I open a GitHub issue here on this.

I'm using the latest version of oav (version 3.2.13)

Thanks,

Darren

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

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