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

[typespec-next] Add linter rules to tspconfig.yaml #25675

Merged
merged 15 commits into from
Sep 7, 2023

Conversation

mikeharder
Copy link
Member

@mikeharder mikeharder commented Sep 6, 2023

Failing checks

  • SDK azure-sdk-for-java
    • Appears unrelated to PR
  • SDK azure-sdk-for-net-track2
    • Appears unrelated to PR
  • SDK azure-sdk-for-python
    • Appears unrelated to PR
  • Swagger BreakingChange
    • "1017 - ReferenceRedirection" is expected
    • "1029 - ReadonlyPropertyChanged" appears to be a false positive since both old and new are declared as "readOnly"
  • Swagger ModelValidation
  • Swagger PrettierCheck
  • TypeSpec APIView
    • Expected since @azure-tools/typespec-apiview is not compatible with dev versions

@openapi-pipeline-app
Copy link

openapi-pipeline-app bot commented Sep 6, 2023

Automatic PR validation restarted. This comment will be populated with next steps to merge this PR once validation is completed. Please wait ⌛.

@openapi-pipeline-app
Copy link

openapi-pipeline-app bot commented Sep 6, 2023

Swagger Validation Report

️❌BreakingChange: 6 Errors, 0 Warnings failed [Detail]
compared swaggers (via Oad v0.10.4)] new version base version
openapi.json v1.1(96f511d) v1.1(main)
openapi.json 2023-03-01-preview(96f511d) 2023-03-01-preview(main)
Rule Message
1017 - ReferenceRedirection The '$ref' property points to different models in the old and new versions.
New: AnomalyDetector/stable/v1.1/openapi.json#L1024:9
Old: AnomalyDetector/stable/v1.1/openapi.json#L1020:9
1017 - ReferenceRedirection The '$ref' property points to different models in the old and new versions.
New: AnomalyDetector/stable/v1.1/openapi.json#L559:9
Old: AnomalyDetector/stable/v1.1/openapi.json#L554:9
1017 - ReferenceRedirection The '$ref' property points to different models in the old and new versions.
New: HealthInsights/preview/2023-03-01-preview/openapi.json#L1533:9
Old: HealthInsights/preview/2023-03-01-preview/openapi.json#L1528:9
1017 - ReferenceRedirection The '$ref' property points to different models in the old and new versions.
New: HealthInsights/preview/2023-03-01-preview/openapi.json#L1881:9
Old: HealthInsights/preview/2023-03-01-preview/openapi.json#L1877:9
1029 - ReadonlyPropertyChanged The read only property has changed from 'true' to 'false'.
New: HealthInsights/preview/2023-03-01-preview/openapi.json#L1533:9
Old: HealthInsights/preview/2023-03-01-preview/openapi.json#L1528:9
1029 - ReadonlyPropertyChanged The read only property has changed from 'true' to 'false'.
New: HealthInsights/preview/2023-03-01-preview/openapi.json#L1881:9
Old: HealthInsights/preview/2023-03-01-preview/openapi.json#L1877:9
️️✔️Breaking Change(Cross-Version) succeeded [Detail] [Expand]
There are no breaking changes.
️⚠️LintDiff: 2 Warnings warning [Detail]
compared tags (via openapi-validator v2.1.4) new version base version
release_1_1 release_1_1(96f511d) release_1_1(typespec-next)
2023-03-01-preview 2023-03-01-preview(96f511d) 2023-03-01-preview(typespec-next)

[must fix]The following errors/warnings are introduced by current PR:

Rule Message Related RPC [For API reviewers]
⚠️ SchemaNamesConvention Schema name should be Pascal case.
Location: AnomalyDetector/stable/v1.1/openapi.json#L520
⚠️ SchemaNamesConvention Schema name should be Pascal case.
Location: HealthInsights/preview/2023-03-01-preview/openapi.json#L492


The following errors/warnings exist before current PR submission:

Only 30 items are listed, please refer to log for more details.

Rule Message
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L72
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L114
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L155
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L204
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L243
LroExtension Operations with a 202 response must specify x-ms-long-running-operation: true.
Location: AnomalyDetector/stable/v1.1/openapi.json#L280
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L281
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Multivariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L341
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Univariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L391
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Univariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L434
OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Univariate' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
Location: AnomalyDetector/stable/v1.1/openapi.json#L477
XmsEnumValidation The enum types should have x-ms-enum type extension set with appropriate options.
Location: HealthInsights/preview/2023-03-01-preview/openapi.json#L105
XmsEnumValidation The enum types should have x-ms-enum type extension set with appropriate options.
Location: HealthInsights/preview/2023-03-01-preview/openapi.json#L231
⚠️ VersionConvention API version should be a date in YYYY-MM-DD format, optionally suffixed with '-preview'.
Location: AnomalyDetector/stable/v1.1/openapi.json#L5
⚠️ PageableOperation Based on the response model schema, operation 'Multivariate_GetMultivariateBatchDetectionResult' might be pageable. Consider adding the x-ms-pageable extension.
Location: AnomalyDetector/stable/v1.1/openapi.json#L71
⚠️ PaginationResponse Operation might be pageable. Consider adding the x-ms-pageable extension.
Location: AnomalyDetector/stable/v1.1/openapi.json#L71
⚠️ VersionPolicy Operation does not define an 'api-version' query parameter.
Location: AnomalyDetector/stable/v1.1/openapi.json#L75
⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
Location: AnomalyDetector/stable/v1.1/openapi.json#L76
⚠️ ErrorResponse Error response schema should contain an object property named error.
Location: AnomalyDetector/stable/v1.1/openapi.json#L94
⚠️ VersionPolicy Operation does not define an 'api-version' query parameter.
Location: AnomalyDetector/stable/v1.1/openapi.json#L117
⚠️ PaginationResponse Response body schema of pageable response should contain top-level array property value
Location: AnomalyDetector/stable/v1.1/openapi.json#L128
⚠️ ErrorResponse Error response schema should contain an object property named error.
Location: AnomalyDetector/stable/v1.1/openapi.json#L134
⚠️ VersionPolicy Operation does not define an 'api-version' query parameter.
Location: AnomalyDetector/stable/v1.1/openapi.json#L158
⚠️ Post201Response Using post for a create operation is discouraged.
Location: AnomalyDetector/stable/v1.1/openapi.json#L170
⚠️ ErrorResponse Error response schema should contain an object property named error.
Location: AnomalyDetector/stable/v1.1/openapi.json#L184
⚠️ VersionPolicy Operation does not define an 'api-version' query parameter.
Location: AnomalyDetector/stable/v1.1/openapi.json#L207
⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
Location: AnomalyDetector/stable/v1.1/openapi.json#L208
⚠️ ErrorResponse Error response schema should contain an object property named error.
Location: AnomalyDetector/stable/v1.1/openapi.json#L225
⚠️ VersionPolicy Operation does not define an 'api-version' query parameter.
Location: AnomalyDetector/stable/v1.1/openapi.json#L246
⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
Location: AnomalyDetector/stable/v1.1/openapi.json#L247
️️✔️Avocado succeeded [Detail] [Expand]
Validation passes for Avocado.
️️✔️SwaggerAPIView succeeded [Detail] [Expand]
️❌TypeSpecAPIView: 0 Errors, 5 Warnings failed [Detail]
Rule Message
⚠️ Failed to generate TypeSpec APIView. Please check the detail log and make sure TypeSpec compiler version is the latest. "How to fix":"Check the detailed log and verify if the TypeSpec emitter is able to create API review file for the changes in PR."
⚠️ Failed to generate TypeSpec APIView. Please check the detail log and make sure TypeSpec compiler version is the latest. "How to fix":"Check the detailed log and verify if the TypeSpec emitter is able to create API review file for the changes in PR."
⚠️ Failed to generate TypeSpec APIView. Please check the detail log and make sure TypeSpec compiler version is the latest. "How to fix":"Check the detailed log and verify if the TypeSpec emitter is able to create API review file for the changes in PR."
⚠️ Failed to generate TypeSpec APIView. Please check the detail log and make sure TypeSpec compiler version is the latest. "How to fix":"Check the detailed log and verify if the TypeSpec emitter is able to create API review file for the changes in PR."
⚠️ Failed to generate TypeSpec APIView. Please check the detail log and make sure TypeSpec compiler version is the latest. "How to fix":"Check the detailed log and verify if the TypeSpec emitter is able to create API review file for the changes in PR."
️❌ModelValidation: 2 Errors, 0 Warnings failed [Detail]
Rule Message
RESPONSE_STATUS_CODE_NOT_IN_EXAMPLE Following response status codes 200 for operation OncoPhenotype_CreateJob were present in the swagger spec, however they were not present in x-ms-examples. Please provide them.
Url: HealthInsights/preview/2023-03-01-preview/openapi.json#L86:18
ExampleUrl: preview/2023-03-01-preview/examples/SuccessfulOncoPhenotypeRequest.json#L52:16
RESPONSE_STATUS_CODE_NOT_IN_EXAMPLE Following response status codes 200 for operation TrialMatcher_CreateJob were present in the swagger spec, however they were not present in x-ms-examples. Please provide them.
Url: HealthInsights/preview/2023-03-01-preview/openapi.json#L212:18
ExampleUrl: preview/2023-03-01-preview/examples/SuccessfulTrialMatcherRequest.json#L149:16
️️✔️SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️❌PrettierCheck: 2 Errors, 0 Warnings failed [Detail]
Rule Message
HowToFix Code style issues found
path: AnomalyDetector/stable/v1.1/openapi.json
HowToFix Code style issues found
path: HealthInsights/preview/2023-03-01-preview/openapi.json
️️✔️SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️️✔️PR Summary succeeded [Detail] [Expand]
Validation passes for Summary.
️️✔️Automated merging requirements met succeeded [Detail] [Expand]
Posted by Swagger Pipeline | How to fix these errors?

@openapi-pipeline-app
Copy link

openapi-pipeline-app bot commented Sep 6, 2023

Swagger Generation Artifacts

️️✔️ApiDocPreview succeeded [Detail] [Expand]
 Please click here to preview with your @microsoft account. 
️️✔️SDK Breaking Change Tracking succeeded [Detail] [Expand]

Breaking Changes Tracking

️❌ azure-sdk-for-net-track2 failed [Detail]
  • Pipeline Framework Failed [Logs] Generate from 01074544974d3a01deeaecf9a8f49c5fadd355a8. SDK Automation 14.0.0
    Only show 15 items here, please refer to log for details.
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m 120 | �[0m … ectFolder = �[36;1m& $processScript $typespecFolder $commitid $repoHttpsUrl �[0m …
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m     | �[31;1m               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[31;1m�[36;1m     | �[31;1mFailed to generate sdk project at
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m     | �[31;1m/mnt/vss/_work/1/s/azure-sdk-for-net/sdk/contosowidgetmanager/Azure.Template.Contoso
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[0m
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[31;1mWrite-Error: �[0m/mnt/vss/_work/1/s/azure-sdk-for-net/eng/common/scripts/TypeSpec-Project-Process.ps1:26
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1mLine |
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m  26 | �[0m   $serviceDir = �[36;1mGet-ServiceDir $tspConfig $repoRoot�[0m
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m     | �[31;1m                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[31;1m�[36;1m     | �[31;1mMissing service-dir in parameters section of tspconfig.yaml. Please
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m     | �[31;1mrefer to
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[36;1m     | �[31;1mhttps://github.com/Azure/azure-rest-api-specs/blob/main/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml for the right schema.
    cmderr	[Invoke-GenerateAndBuildV2.ps1] �[0m
    the given reference name 'refs/heads/sdkAuto/25675/' is not valid
    Error: the given reference name 'refs/heads/sdkAuto/25675/' is not valid
  • error	Fatal error: the given reference name 'refs/heads/sdkAuto/25675/' is not valid
    error	The following packages are still pending:
    error
    error
    error
    error
    error
    error
    error
    error
️❌ azure-sdk-for-python failed [Detail]
  • Code Generator Failed [Logs] Generate from 01074544974d3a01deeaecf9a8f49c5fadd355a8. SDK Automation 14.0.0
    command	sh scripts/automation_init.sh ../azure-sdk-for-python_tmp/initInput.json ../azure-sdk-for-python_tmp/initOutput.json
    cmderr	[automation_init.sh] WARNING: Skipping azure-nspkg as it is not installed.
    warn		specification/cognitiveservices/data-plane/AnomalyDetector/readme.md skipped due to azure-sdk-for-python not found in swagger-to-sdk
    warn		specification/cognitiveservices/data-plane/HealthInsights/readme.md skipped due to azure-sdk-for-python not found in swagger-to-sdk
    warn		specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/cognitiveservices/HealthInsights/healthinsights.openapi/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/cognitiveservices/OpenAI.Inference/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/confidentialledger/Microsoft.ManagedCcf/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/containerservice/Fleet.Management/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/containerstorage/ContainerStorage.Management/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/mpcnetworkfunction/mpcnetworkfunction.Management/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/playwrighttesting/PlaywrightTesting/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/servicenetworking/ServiceNetworking.Management/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    warn		specification/sphere/Sphere.Management/tspconfig.yaml skipped due to azure-sdk-for-python not found in tspconfig.yaml
    command	sh scripts/automation_generate.sh ../azure-sdk-for-python_tmp/generateInput.json ../azure-sdk-for-python_tmp/generateOutput.json
    cmderr	[automation_generate.sh]
    cmderr	[automation_generate.sh] npm notice New major version of npm available! 9.6.7 -> 10.0.0
    cmderr	[automation_generate.sh] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.0.0>
    cmderr	[automation_generate.sh] npm notice Run `npm install -g npm@10.0.0` to update!
    cmderr	[automation_generate.sh] npm notice
    cmdout	[automation_generate.sh] [Autorest]/mnt/vss/_work/1/s/azure-sdk-for-python_tmp/venv-sdk/auto_temp.json does not exist!!!Error happened during codegen
    error	Script return with result [failed] code [1] signal [null] cwd [azure-sdk-for-python]: sh scripts/automation_generate.sh
    warn	Skip package processing as generation is failed
️🔄 azure-sdk-for-js inProgress [Detail]
️❌ azure-sdk-for-java failed [Detail]
  • Pipeline Framework Failed [Logs] Generate from 01074544974d3a01deeaecf9a8f49c5fadd355a8. SDK Automation 14.0.0
    command	./eng/mgmt/automation/init.sh ../azure-sdk-for-java_tmp/initInput.json ../azure-sdk-for-java_tmp/initOutput.json
    cmderr	[init.sh] [notice] A new release of pip is available: 23.0.1 -> 23.2.1
    cmderr	[init.sh] [notice] To update, run: pip install --upgrade pip
    cmderr	[init.sh] [notice] A new release of pip is available: 23.0.1 -> 23.2.1
    cmderr	[init.sh] [notice] To update, run: pip install --upgrade pip
    warn		specification/cognitiveservices/data-plane/AnomalyDetector/readme.md skipped due to azure-sdk-for-java not found in swagger-to-sdk
    warn		specification/cognitiveservices/data-plane/HealthInsights/readme.md skipped due to azure-sdk-for-java not found in swagger-to-sdk
    command	./eng/mgmt/automation/generate.py ../azure-sdk-for-java_tmp/generateInput.json ../azure-sdk-for-java_tmp/generateOutput.json
    cmderr	[generate.py] npm notice
    cmderr	[generate.py] npm notice New major version of npm available! 8.19.4 -> 10.0.0
    cmderr	[generate.py] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.0.0>
    cmderr	[generate.py] npm notice Run `npm install -g npm@10.0.0` to update!
    cmderr	[generate.py] npm notice
    cmderr	[generate.py] �[31;1mWrite-Error: �[31;1mFailed to generate sdk project at /mnt/vss/_work/1/s/azure-sdk-for-java/sdk/codesigning/azure-codesigning�[0m
    error	Fatal error: The "path" argument must be of type string. Received undefined
    The "path" argument must be of type string. Received undefined
    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
        at new NodeError (node:internal/errors:387:5)
        at validateString (node:internal/validators:162:11)
        at Object.basename (node:path:1309:5)
        at Object.exports.getPackageData (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/types/PackageData.js:38:82)
        at /mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:210:194
        at Array.map (<anonymous>)
        at workflowHandleReadmeMdOrTypeSpecProject (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:210:164)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async Object.exports.workflowMain (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:98:13)
        at async Object.exports.sdkAutoMain (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/entrypoint.js:193:13)
        at async /mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/cli/cli.js:20:18
Posted by Swagger Pipeline | How to fix these errors?

@openapi-pipeline-app
Copy link

openapi-pipeline-app bot commented Sep 6, 2023

Generated ApiView

Language Package Name ApiView Link
Swagger cognitiveservices-data-plane-HealthInsights https://apiview.dev/Assemblies/Review/ec9ff296c8e944b7a7c485b8b308b5b7
Swagger v1.1 https://apiview.dev/Assemblies/Review/13c486bd334e4579889ce5d58b62be6b

@mikeharder mikeharder self-assigned this Sep 6, 2023
Microsoft Auto Changeset Bot added 2 commits September 6, 2023 11:58
@AzureRestAPISpecReview AzureRestAPISpecReview added BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required data-plane labels Sep 6, 2023
@mikeharder
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@mikeharder
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@mikeharder mikeharder merged commit 190cde3 into Azure:typespec-next Sep 7, 2023
@mikeharder mikeharder deleted the typespec-next-3313 branch September 7, 2023 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required data-plane
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants