Skip to content

feat: Inject OpenAPI deprecations safely#4286

Merged
gmlewis merged 1 commit into
google:masterfrom
Skywalkr-dev:master
Jun 8, 2026
Merged

feat: Inject OpenAPI deprecations safely#4286
gmlewis merged 1 commit into
google:masterfrom
Skywalkr-dev:master

Conversation

@Skywalkr-dev
Copy link
Copy Markdown
Contributor

@Skywalkr-dev Skywalkr-dev commented Jun 6, 2026

  • Updates: openapi.go to parse and cache the 'deprecated' flag from spec
  • Updates: metadata.go to inject generic comment tags for deprecated endpoints

Fixes : #4269

@gmlewis gmlewis changed the title metadata: inject OpenAPI deprecations safely feat: Inject OpenAPI deprecations safely Jun 6, 2026
Comment thread ; Outdated
Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Also, it looks like a number of useful comments were removed from metadata.go for no apparent reason. Please review and revert the comment removals from this file.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Jun 6, 2026
@Skywalkr-dev
Copy link
Copy Markdown
Contributor Author

Also, it looks like a number of useful comments were removed from metadata.go for no apparent reason. Please review and revert the comment removals from this file.

Sorry about that, it should look good now I hope.

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Better, but some lines were still unnecessarily deleted. If you review your changes in the GitHub user interface, you can see what needs to be fixed:

Image

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.49%. Comparing base (eb96f3d) to head (6d5651c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4286   +/-   ##
=======================================
  Coverage   97.49%   97.49%           
=======================================
  Files         192      192           
  Lines       19256    19256           
=======================================
  Hits        18774    18774           
  Misses        267      267           
  Partials      215      215           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Skywalkr-dev
Copy link
Copy Markdown
Contributor Author

Better, but some lines were still unnecessarily deleted. If you review your changes in the GitHub user interface, you can see what needs to be fixed:
Image

yup, the current commit should fix it.
thanks for the review

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @Skywalkr-dev!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode

Copy link
Copy Markdown
Contributor

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread tools/metadata/metadata.go Outdated
Comment on lines +317 to +323
hasCustomDeprecated := false
for _, comment := range group.List {
if anyDeprecatedRE.MatchString(comment.Text) && !deprecatedRE.MatchString(comment.Text) {
hasCustomDeprecated = true
break
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
hasCustomDeprecated := false
for _, comment := range group.List {
if anyDeprecatedRE.MatchString(comment.Text) && !deprecatedRE.MatchString(comment.Text) {
hasCustomDeprecated = true
break
}
}
hasCustomDeprecated := slices.ContainsFunc(group.List, func(comment *ast.Comment) bool {
return anyDeprecatedRE.MatchString(comment.Text) && !deprecatedRE.MatchString(comment.Text)
})

Comment thread tools/metadata/metadata.go Outdated
Comment on lines +337 to +349
// add an empty line before adding doc links
isDeprecated := false
for _, op := range ops {
if op.Deprecated {
isDeprecated = true
break
}
}
if isDeprecated && !hasCustomDeprecated {
group.List = append(group.List, &ast.Comment{Text: "// Deprecated: This endpoint has been deprecated by GitHub."})
group.List = append(group.List, &ast.Comment{Text: "//"})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// add an empty line before adding doc links
isDeprecated := false
for _, op := range ops {
if op.Deprecated {
isDeprecated = true
break
}
}
if isDeprecated && !hasCustomDeprecated {
group.List = append(group.List, &ast.Comment{Text: "// Deprecated: This endpoint has been deprecated by GitHub."})
group.List = append(group.List, &ast.Comment{Text: "//"})
}
isDeprecated := slices.ContainsFunc(ops, func(op *operation) bool {
return op.Deprecated
})
if isDeprecated && !hasCustomDeprecated {
group.List = append(group.List, &ast.Comment{Text: "// Deprecated: This endpoint has been deprecated by GitHub."}, &ast.Comment{Text: "//"})
}
// add an empty line before adding doc links

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alexandear can u check now

Comment thread tools/metadata/metadata.go Outdated
Comment on lines +339 to +340
// add an empty line before adding doc links

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should keep this comment with the next line:

Suggested change
// add an empty line before adding doc links
// add an empty line before adding doc links

@alexandear
Copy link
Copy Markdown
Contributor

@Skywalkr-dev please do not use force push for future PRs. See
image

@Skywalkr-dev
Copy link
Copy Markdown
Contributor Author

@Skywalkr-dev please do not use force push for future PRs. See image

sorry about that, ill keep it in mind from next time

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Jun 8, 2026
@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Jun 8, 2026

Thank you, @Skywalkr-dev, @stevehipwell, and @alexandear!
Merging.

@gmlewis gmlewis merged commit 946bd71 into google:master Jun 8, 2026
12 checks passed
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.

Remove deprecated code_scanning_upload field from RateLimits

4 participants