vscode-azurefunctions
vscode-azurefunctions copied to clipboard
Update EventGrid sample file URL to use specific commit SHA after Azure/azure-rest-api-specs#38235
Background
Recent changes in the Azure/azure-rest-api-specs repository (see issue #38235 and PR #38236) removed almost all EventGrid sample directories and example files from main. As a result, the following URL used in EventGridTypeStep.ts now fails:
const sampleFilesUrl =
'https://api.github.com/repos/Azure/azure-rest-api-specs/contents/specification/eventgrid/data-plane/' +
'{eventSource}' +
'/stable/2018-01-01/examples/cloud-events-schema/';
Proposal
Use a specific SHA reference when fetching EventGrid sample files from the GitHub API. This will ensure the extension continues to provide sample events for all supported sources, even though the files are no longer present in the main branch.
Suggested approach:
- Modify the code in
EventGridTypeStep.tsto construct the sample files URL with a?ref=752dade436619ed28bd03ca2e77cfa5acf6222ddquery parameter. Example:
https://api.github.com/repos/Azure/azure-rest-api-specs/contents/specification/eventgrid/data-plane/Microsoft.Storage/stable/2018-01-01/examples/cloud-events-schema?ref=752dade436619ed28bd03ca2e77cfa5acf6222ddconst sampleFilesUrl = 'https://api.github.com/repos/Azure/azure-rest-api-specs/contents/specification/eventgrid/data-plane/' + '{eventSource}' + '/stable/2018-01-01/examples/cloud-events-schema?ref=752dade436619ed28bd03ca2e77cfa5acf6222dd'; - Document this workaround in the code, referencing the upstream issue and PR.
References
- Upstream issue: https://github.com/Azure/azure-rest-api-specs/issues/38235
- Upstream PR: https://github.com/Azure/azure-rest-api-specs/pull/38236
- Commit that removed the files: https://github.com/Azure/azure-rest-api-specs/commit/4c5f20efd968553cadf31805174b55934e68d482
Impact
- This workaround will allow the extension to continue functioning for EventGrid event sources despite the upstream file deletion.
- Future changes in azure-rest-api-specs may require further updates.
Labels: bug, eventgrid