Azure / Azure/azure-rest-api-specs

[TypeSpec Requirement] Fail if PR contains new handwritten swagger, but service contains typespec-generated

Open
#28,697 1 comment 2 reactions 1 assignee Claimed by @mikeharder View on GitHub
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 2h
Merged PRs (30d)
424

Description

## Recommended
* In a PR, if a **new** swagger is not typespec-generated
* Check all swaggers under service folder (`specification/widget/resource-manager/Microsoft.Widget/Widget`)
* If any are typespec-generated:
* PR must be typespec-generated
* return/break

Example PR (should be blocked):
* https://github.com/Azure/azure-rest-api-specs/pull/39134

Also consider how suppressions should apply to "swagger after typespec": https://github.com/Azure/azure-rest-api-specs/issues/41726

## Alternative 1 (Original Plan)

* If a swagger is not typespec-generated in a PR
* For each Swagger in stable in current branch:
* If it is typespec-generated
* PR must be typespec-generated
* return/break
* If GA Swaggers exist and no Swagger from TypeSpec were found
* the swagger in the PR can be hand-written

I think checking the current branch (rather than main) is sufficient. It's very unlikely a spec folder would contain a typespec-generated swagger in main, but not the current branch. And it would be caught when merging to main regardless.

## Alternative 2

If we did need to check main, we could use the database at https://raw.githubusercontent.com/Azure/azure-sdk/main/_data/releases/latest/specs.csv, instead of querying the main git branch directly.

Example pwsh downloading DB:

https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/scripts/Package-Properties.ps1#L139

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.