Azure / Azure/oav

TypeError: jsonPath.nodes is not a function

Open
#613 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
104
Forks
62
Avg merge
2d 12h
Merged PRs (30d)
5

Description

## Describe the bug

I ran the command:

```
autorest --input-file=edgeRouter.json --input-file=operation.json --model-validator=true
```

This gave the following output:

```
AutoRest code generation utility [cli version: 3.2.0; node: v14.16.1, max-memory: 4096 MB]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
NOTE: AutoRest core version selected from configuration: ~2.0.4413.
Loading AutoRest core 'C:\Users\nickweeds\.autorest\@microsoft.azure_autorest-core@2.0.4419\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4419)
Loading AutoRest extension 'oav' (~0.4.20->0.4.70)
TypeError: jsonPath.nodes is not a function
at openApiValidationExample (C:\Users\nickweeds\.autorest\oav@0.4.70\node_modules\oav\dist\lib\autorestPlugin\extension.js:75:40)
at async analyzeSwagger (C:\Users\nickweeds\.autorest\oav@0.4.70\node_modules\oav\dist\lib\autorestPlugin\extension.js:34:38)
at async C:\Users\nickweeds\.autorest\oav@0.4.70\node_modules\oav\dist\lib\autorestPlugin\extension.js:48:70
at async Promise.all (index 0)
at async C:\Users\nickweeds\.autorest\oav@0.4.70\node_modules\oav\dist\lib\autorestPlugin\extension.js:49:5
at async C:\Users\nickweeds\.autorest\oav@0.4.70\node_modules\@microsoft.azure\autorest-extension-base\dist\lib\extension-base.js:39:17
FATAL: TypeError: jsonPath.nodes is not a function
FATAL: swagger-document/model-validator - FAILED
FATAL: Error: Plugin model-validator reported failure.
Process() cancelled due to exception : Plugin model-validator reported failure.
Error: Plugin model-validator reported failure.
```

## Expected behavior

I expected autorest to perform model validation and output any results.
In this case it appears that validation has failed but autorest has crashed trying to output the results.

## Additional context

I am in the process of writing a new Resource Provider API so the OpenAPI source files are at an early stage of development.

I have run "autorest --reset" and "autorest --latest" but still get the same result.

Contributor guide

Open the contributing guide

Research direction

Reproduce the command with the supplied OpenAPI inputs, then start at oav/dist/lib/autorestPlugin/extension.js, especially openApiValidationExample and analyzeSwagger, where the stack trace points. Trace the jsonPath dependency and its available API; done means model validation completes without the TypeError and reports its results.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.