-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[shared] Add helper to return in-memory "model" of spec folder #33362
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
base: main
Are you sure you want to change the base?
Conversation
Next Steps to MergeNext steps that must be taken to merge this PR:
|
PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
…swaggers as that is all that is needed for Swagger LintDiff
API Change CheckAPI changes are not detected in this pull request. |
PR validation pipeline can not start as the pull request is not merged or mergeable - most likely it has merge conflicts. |
? obj["input-file"] | ||
: [obj["input-file"]]; | ||
for (const swaggerPath of inputFiles) { | ||
const swagger = await getSwagger(swaggerPath, dirname(readmePath), repoRoot, logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be a performance improvement here using mapAsync
const currentRefs = currentSchema | ||
.paths("file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentSchema.paths()
returns a list of all dependencies (including transitive dependencies) of the given swagger file. This list flattens the relationships between referenced swagger files. This means that, with the code in its current configuration, you can't reconstruct the complete dependency graph for a given input swagger file.
However, for purposes of LintDiff this limitation does not cause problems. It also may not cause problems in other parts of the code so I'm not treating this limitation as requiring resolution at this time.
"authorization", // specification/authorization/resource-manager/readme.md defines has duplicate tags including 'package-2020-10-01' | ||
"azureactivedirectory", // specification/azureactivedirectory/resource-manager/readme.md has duplicate tags including 'package-preview-2020-07' | ||
"cost-management", // specification/cost-management/resource-manager/readme.md has duplicate tags including 'package-2019-01' | ||
"migrate", // specification/migrate/resource-manager/readme.md has duplicate tags including 'package-migrate-2023-04' | ||
"quota", // specification/quota/resource-manager/readme.md has duplicate tags including 'package-2023-02-01' | ||
"redisenterprise", // specification/redisenterprise/resource-manager/readme.md has duplicate tags including 'package-2024-02' | ||
"security", // specification/security/resource-manager/readme.md has duplicate tags including 'package-2021-07-preview-only' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several services have readme.md files which define the same tag multiple times.
It appears that LintDiff's default behavior is that the last definition of the tag wins: #34215
I believe the authoritative source for readme.md parsing is package @autorest/configuration. I don't think we'd want to use this implementation directly, but we can use it as a reference, or possibly in tests to ensure our new implementation matches the existing logic.
Tests that might show how to use the API:
https://github.com/Azure/autorest/blob/53c9a2b82e10fed62097337bbdc516aed4120d49/packages/libs/configuration/test/scenarios.test.ts
https://github.com/Azure/autorest/blob/53c9a2b82e10fed62097337bbdc516aed4120d49/packages/extensions/core/test/configuration.e2e.ts