Azure / Azure/oav

Autorest fails to run model-validation: true with latest oav tool

Open
#904 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
104
Forks
62
Avg merge
2d 12h
Merged PRs (30d)
5

Description

**Before filling a bug**

- [x] have you checked the [faq](https://github.com/Azure/autorest/tree/main/docs/faq.md) for known issues.
- [x] have you checked existing issues

**Describe the bug**
1) It appears that autorest is using a fairly outdated oav plugin version (0.4.20 << current v3.2.0) and also breaks when forcing use of that version with use-extension: oav: "~3.2.0"

2) Even after verifying that my manifest passes with direct use of oav (npm install -g oav@3.2.0) and with the use of other versions of oav I still see that autorest fails with the following error:

```bash
autorest pkg/ucp/api/README.md --tag=ucp-2022-09-01-privatepreviewAutoRest code generation utility [cli version: 3.6.2; node: v18.11.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info | Loading AutoRest core '/home/asilverman/.autorest/@autorestcore@3.9.3/nodemodules/@autorest/core/dist' (3.9.3)
info | Loading AutoRest extension 'oav' (~3.2.0->3.2.0)
info | Loading AutoRest extension '@autorest/go' (4.0.0-preview.44->4.0.0-preview.44)
info | Loading AutoRest extension '@autorest/modelerfour' (4.23.1->4.23.1)
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module '/home/asilverman/.autorest/oav@3.2.0/node_modules/oav/dist/lib/autorestPlugin/pluginHost.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.11.0
fatal | Process() cancelled due to failure
error | [Exception] AutoRest extension 'oav' terminated.
error | Error: [Exception] AutoRest extension 'oav' terminated.
error | Autorest completed with an error. If you think the error message is unclear, or is a
```
Please provide as much information as you can. This would be:
- OpenAPI files having the issues
- Autorest command used

### Autorest Version
```bash
autorest --version
AutoRest code generation utility [cli version: 3.6.2; node: v18.11.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest

Showing All Installed Extensions

Type Extension Name Version Location
core @autorest/core 3.9.3 /home/asilverman/.autorest/@autorest_core@3.9.3
extension @autorest/go 4.0.0-preview.44 /home/asilverman/.autorest/@autorest_go@4.0.0-preview.44
extension @autorest/modelerfour 4.23.1 /home/asilverman/.autorest/@autorest_modelerfour@4.23.1
core @microsoft.azure/autorest-core 2.0.4421 /home/asilverman/.autorest/@microsoft.azure_autorest-core@2.0.4421
extension @microsoft.azure/classic-openapi-validator 1.0.14 /home/asilverman/.autorest/@microsoft.azure_classic-openapi-validator@1.0.14
extension @microsoft.azure/openapi-validator 1.0.4 /home/asilverman/.autorest/@microsoft.azure_openapi-validator@1.0.4
extension @microsoft.azure/openapi-validator 1.13.0 /home/asilverman/.autorest/@microsoft.azure_openapi-validator@1.13.0
extension oav 0.4.20 /home/asilverman/.autorest/oav@0.4.20
extension oav 0.4.34 /home/asilverman/.autorest/oav@0.4.34
extension oav 0.4.70 /home/asilverman/.autorest/oav@0.4.70
extension oav 3.1.0 /home/asilverman/.autorest/oav@3.1.0
extension oav 3.2.0 /home/asilverman/.autorest/oav@3.2.0
```

#### OpenAPI Files
[2022-09-01-privatepreview.zip](https://github.com/Azure/autorest/files/9966063/2022-09-01-privatepreview.zip)

#### autorest configuration
[README.md](https://github.com/Azure/autorest/files/9966073/README.md)

```

**Expected behavior**
I expect autorest to run oav tool without failure

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the attached README.md and the reported AutoRest command while forcing oav@3.2.0. Start from the missing oav/dist/lib/autorestPlugin/pluginHost.js path and compare it with the installed package layout; done means model-validation: true runs without the module-not-found error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.