Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LintDiff] Upgrade autorest to latest #7755

Open
mikeharder opened this issue Feb 26, 2024 · 7 comments
Open

[LintDiff] Upgrade autorest to latest #7755

mikeharder opened this issue Feb 26, 2024 · 7 comments
Assignees
Labels
Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo.

Comments

@mikeharder
Copy link
Member

mikeharder commented Feb 26, 2024

LintDiff is currently using autorest pinned to 3.6.1:

https://dev.azure.com/devdiv/DevDiv/_git/openapi-alps?path=/private/azure-swagger-validation/azureSwaggerValidation/package.json&version=GBmain&line=36&lineEnd=37&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents

It should probably be upgraded to the latest version 3.7.1, since 3.6.1 is two years old now. However, I'm not aware of any current issues using 3.6.1, so maybe it's better to not touch it unless we need to?

I believe autorest@3.6.1 should automatically use the latest version of @autorest/core, since by default autorest floats the dependency as @autorest/core@^3.2.0:

if (args["v3"] && !args["version"]) {
  // --v3 without --version infers --version:^3.2.0 +
  args["version"] = "^3.2.0";
}

https://github.com/Azure/autorest/blob/8d137ce24e1af96444766688e7cd851767d6543c/packages/apps/autorest/src/app.ts#L42

For reference:

@mikeharder mikeharder added Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo. labels Feb 26, 2024
@timotheeguerin
Copy link
Member

I think that's just the CLI version which I don't think would solve the issue in question(It wouldnt' be bad to update that too, however).

What is failing the x-ms-enum.name I beleive is the version of autorest core

@konrad-jamrozik
Copy link
Contributor

@timotheeguerin how to update the core?

@timotheeguerin
Copy link
Member

Core would either use the latest or a version configured by --version or version: in the README.md.

@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented Feb 26, 2024

@timotheeguerin from this recent example log we can see:

Executing AutoRest with LintDiff: node /mnt/vss/_work/_tasks/AzureApiValidation_5654d05d-82c1-48da-ad8f-161b817f6d41/0.0.79/private/azure-swagger-validation/azureSwaggerValidation/node_modules/autorest/dist/app.js --v3 --spectral --azure-validator --semantic-validator=false --model-validator=false --message-format=json --openapi-type=data-plane --openapi-subtype=data-plane  --use=@microsoft.azure/openapi-validator@2.1.7 --tag=package-2018-01 /mnt/vss/_work/1/azure-rest-api-specs/specification/eventgrid/data-plane/readme.md
Execution of AutoRest with LintDiff done. Error is not null: true, stdout contains AutoRest 'error': true, stdout contains AutoRest 'fatal': true, stderr contains AutoRest 'error': false, stderr contains AutoRest 'fatal': false
RETURN definition momentOfTruth.executeAutoRestWithLintDiff.
{"level":"information","message":"AutoRest core version selected from configuration: ^3.2.0."}

There is a new version of AutoRest available (3.7.1).
 > You can install the newer version with with npm install -g autorest@latest

Notably:

"AutoRest core version selected from configuration: ^3.2.0."}
and
There is a new version of AutoRest available (3.7.1).
(because we use 3.6.1)

Judging based on that, the issue is with CLI or Core or hard to say?

@timotheeguerin
Copy link
Member

timotheeguerin commented Feb 26, 2024

the cli just basically loads autorest/core which then deals with all the logic. However I don't see here in the logs which version of autorest core is actually loaded. It just says it found some config that said to load ^3.2.0.

The original issue is complaining about missing name property under x-ms-enum.

For example having this:

"x-ms-enum": { "modelAsString": false}

There was some assumption that might have just been an older autorest complaining but it might be something else using an outdated json schema to validate.

@mikeharder mikeharder changed the title [LintDiff] Upgrade autorest from 3.6.1 to latest (currently 3.7.1) [LintDiff] Upgrade autorest from 3.6.1 to latest Feb 28, 2024
@mikeharder mikeharder changed the title [LintDiff] Upgrade autorest from 3.6.1 to latest [LintDiff] Upgrade autorest and @autorest/core to latest Feb 29, 2024
@mikeharder mikeharder changed the title [LintDiff] Upgrade autorest and @autorest/core to latest [LintDiff] Upgrade autorest to latest Mar 2, 2024
@abatishchev
Copy link

Please prioritize. the ShiftLeft pipeline started failing and it's unclear to me what I have to change/fix in order to get it unblocked

@konrad-jamrozik
Copy link
Contributor

Please prioritize. the ShiftLeft pipeline started failing and it's unclear to me what I have to change/fix in order to get it unblocked

Relevant discussion on Teams here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo.
Projects
Status: 📋 Backlog
Status: 📋 Backlog
Development

No branches or pull requests

4 participants