oav icon indicating copy to clipboard operation
oav copied to clipboard

oav fails to find REST API definition from readme.md

Open mikekistler opened this issue 3 years ago • 1 comments

I'm attempting to generate an API scenario test using oav following the directions here:

https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/api-scenario/how-to/generateABasicApiScenario.md

But oav fails because it cannot find the REST API definition file referenced in the readme.

[mikekistler@Mikes-MacBook-Pro] ~/Projects/Azure/azure-rest-api-specs (main)>oav generate-api-scenario static --readme specification/appconfiguration/resource-manager/readme.md
input swagger files: Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json
input-file:
[
  'Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json'
]
{
  message: `fatal error: ENOENT: no such file or directory, open 'Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json', {"errno":-2,"code":"ENOENT","syscall":"open","path":"Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json"}`,
  level: '\x1B[31merror\x1B[39m'
}
fatal error: ENOENT: no such file or directory, open 'Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json', {"errno":-2,"code":"ENOENT","syscall":"open","path":"Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json"}
[mikekistler@Mikes-MacBook-Pro] ~/Projects/Azure/azure-rest-api-specs (main)>

The file does exist.

[mikekistler@Mikes-MacBook-Pro] ~/Projects/Azure/azure-rest-api-specs (main)>ls specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json 
specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json
[mikekistler@Mikes-MacBook-Pro] ~/Projects/Azure/azure-rest-api-specs (main)>

It seems that oav is failing to include the directory part of the path to the readme when referencing the REST API file.

mikekistler avatar Jun 16 '22 03:06 mikekistler

I'm able to repro this issue @tianxchen-ms please help check

leniatgh avatar Jun 16 '22 05:06 leniatgh