oav icon indicating copy to clipboard operation
oav copied to clipboard

oav generate-examples cannot read swagger from uri

Open leni-msft opened this issue 3 years ago • 1 comments

➜  oav generate-examples openapi.json
{
  message: `fatal error: ENOENT: no such file or directory, open 'https:/raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json', {"errno":-2,"code":"ENOENT","syscall":"open","path":"https:/raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json"}`,
  level: '\x1B[31merror\x1B[39m'
}
fatal error: ENOENT: no such file or directory, open 'https:/raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json', {"errno":-2,"code":"ENOENT","syscall":"open","path":"https:/raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json"}

openapi.json snippet:

    "/providers/Microsoft.Contoso/operations": {
      "get": {
        "operationId": "Operations_List",
        "summary": "List the operations for Microsoft.Consoto",
        "parameters": [
          {
            "$ref": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "ARM operation completed successfully.",
            "schema": {
              "$ref": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json#/definitions/OperationListResult"
            }
          },
          "default": {
            "description": "Common error response for all Azure Resource Manager APIs to return error details for failed operations.",
            "schema": {
              "$ref": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
            }
          }
        },
        "tags": [
          "Operations"
        ],
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },

leni-msft avatar Nov 24 '21 03:11 leni-msft

try to use local absolute path, didn't work either:

fatal error: ENOENT: no such file or directory, open 'home/me/workspace/azure-rest-api-specs/specification/common-types/resource-management/v3/types.json', {"errno":-2,"code":"ENOENT","syscall":"open","path":"home/me/workspace/azure-rest-api-specs/specification/common-types/resource-management/v3/types.json"}```

leni-msft avatar Nov 24 '21 03:11 leni-msft