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

[PR Workflow] Update REST API PR labeling bot for TypeSpec rename #5917

Closed
mikekistler opened this issue Apr 5, 2023 · 6 comments
Closed
Assignees
Labels
Central-EngSys This issue is owned by the Engineering System team. openapi-alps Items pertaining to https://devdiv.visualstudio.com/DevDiv/_git/openapi-alps/ Spec PR Tools Tooling that runs in azure-rest-api-specs repo.

Comments

@mikekistler
Copy link
Member

mikekistler commented Apr 5, 2023

Some time back we added support in our labelling bot to add the "Cadl" label to any PRs that included files with the ".cadl" suffix. With the rename of Cadl to TypeSpec, we need to update this automation to look for files with the ".tsp" suffix and when found add the "TypeSpec" label (I already created the label).

Related work:

@mikekistler mikekistler added the Spec PR Tools Tooling that runs in azure-rest-api-specs repo. label Apr 5, 2023
@konrad-jamrozik konrad-jamrozik moved this to 📋 Backlog in Spec PR Tools Apr 11, 2023
@konrad-jamrozik
Copy link
Contributor

Ideally to be fixed within the next 30 days.

@maririos
Copy link
Member

maririos commented Nov 2, 2023

If this is enabled, this could be used by the Release Planner apps and we can stop asking for this data manually.

@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented Nov 29, 2023

Relevant code:

export function isSwaggerGeneratedByCadl(swaggerFilePath:string) {
  try {
    return !!JSON.parse(readFileSync(swaggerFilePath).toString())?.info['x-cadl-generated']
  }
  catch{
    return false
  }
}

@weshaggard @mikeharder looks like we have automation that when it detects x-cadl-generated, it adds the cadl label. Do we want to follow this model, do instead regex file path matching as explained in #7353, or do both? If we want to do do such x- marker, how should it be called? x-typespec-generated?

Example of x-cadl-generated

{
  "swagger": "2.0",
  "info": {
    "title": "Microsoft.VoiceServices",
    "version": "2023-01-31",
    "x-cadl-generated": [
      {
        "emitter": "@azure-tools/cadl-autorest"
      }
    ]
  },

Example of automation adding cadl on 11/1/2023, i.e. a month ago.

@konrad-jamrozik konrad-jamrozik self-assigned this Nov 29, 2023
@mikekistler
Copy link
Member Author

We should do both -- check for TypeSpec files and check for TypeSpec-generated OpenAPI.

OpenAPI generated from TypeSpec will have an x-typespec-generated marker.

image

@konrad-jamrozik konrad-jamrozik moved this from 📋 Backlog to 🐝 In Progress in Spec PR Tools Nov 30, 2023
@konrad-jamrozik
Copy link
Contributor

@mikekistler thank you for the attribute name pointer! When I at first used GitHub search to find attributes like that it returned no results. I think I wasn't paying enough attention and had a bug in my search query (:

@konrad-jamrozik konrad-jamrozik moved this from 📋 Backlog to 🐝 Dev in Azure SDK EngSys 🚢🎉 Nov 30, 2023
@konrad-jamrozik konrad-jamrozik changed the title Update REST API PR labeling bot for TypeSpec rename [PR Workflow] Update REST API PR labeling bot for TypeSpec rename Dec 1, 2023
@konrad-jamrozik konrad-jamrozik added the openapi-alps Items pertaining to https://devdiv.visualstudio.com/DevDiv/_git/openapi-alps/ label Dec 1, 2023
@konrad-jamrozik
Copy link
Contributor

Closed as implemented and deployed. For details, see 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. openapi-alps Items pertaining to https://devdiv.visualstudio.com/DevDiv/_git/openapi-alps/ Spec PR Tools Tooling that runs in azure-rest-api-specs repo.
Projects
Archived in project
Status: 🎊 Closed
Development

No branches or pull requests

4 participants