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

Allow multiple intervening folders between provider name and API version #1081

Merged
merged 2 commits into from
Sep 6, 2022

Conversation

jeskew
Copy link
Member

@jeskew jeskew commented Sep 2, 2022

Azure/azure-rest-api-specs#20103 introduced a change in the folder structure for Swagger specs for the Microsoft.Compute RP, leading to the deletion of all types for Microsoft.Compute in #1078. This PR updates the regex we use to parse swagger spec paths to accept multiple folders between the name of the provider and the API version.

Type gen result viewable at #1082

@codecov-commenter
Copy link

Codecov Report

Merging #1081 (45b075e) into main (1b7cb58) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1081   +/-   ##
=======================================
  Coverage   95.89%   95.89%           
=======================================
  Files          18       18           
  Lines         317      317           
=======================================
  Hits          304      304           
  Misses         13       13           
Flag Coverage Δ
dotnet 95.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@jeskew jeskew marked this pull request as ready for review September 3, 2022 02:06
@@ -114,7 +114,7 @@ async function generateAutorestConfig(logger: ILogger, readmePath: string, bicep
// We expect a path format convention of <provider>/(preview|stable)/<yyyy>-<mm>-<dd>(|-preview)/<filename>.json
// This information is used to generate individual tags in the generated autorest configuration
// eslint-disable-next-line no-useless-escape
const pathRegex = /^(\$\(this-folder\)\/|)([^\/]+)\/[^\/]+\/(\d{4}-\d{2}-\d{2}(|-preview))\/.*\.json$/i;
const pathRegex = /^(\$\(this-folder\)\/|)([^\/]+)(?:\/[^\/]+)+\/(\d{4}-\d{2}-\d{2}(|-preview))\/.*\.json$/i;
Copy link
Member

@anthony-c-martin anthony-c-martin Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Does this change the match group numbers (match[2] & match[3]) used below?
  2. Please could you also update the comment above regarding path format convention?

Were you able to validate this change generates the correct output when the pipeline is executed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The match group numbers remain the same ((?:...) is a non-matching group).

The updated pipeline was executed on Friday and produced this PR, which restored all the Microsoft.Compute types and had no other impact.

Copy link
Member

@anthony-c-martin anthony-c-martin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@jeskew jeskew enabled auto-merge (squash) September 6, 2022 16:14
@jeskew jeskew merged commit 74d1153 into main Sep 6, 2022
@jeskew jeskew deleted the jeskew/path-regex-fixup branch September 6, 2022 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants