Skip to content

feat(AIP-140): allow url field name in specific cases#1551

Merged
noahdietz merged 4 commits intoaip-dev:masterfrom
stephanemoore:patch-1
Sep 15, 2025
Merged

feat(AIP-140): allow url field name in specific cases#1551
noahdietz merged 4 commits intoaip-dev:masterfrom
stephanemoore:patch-1

Conversation

@stephanemoore
Copy link
Copy Markdown
Contributor

This proposes to update the guidelines to advocate for clearer naming for fields that can only return URLs.

It appears to be possible to misinterpret AIP-0140 guidelines to infer that fields that return URLs MUST be named as if they could be URIs. It seems more accurate to indicate that fields that COULD be URIs should use uri in the name and fields that MUST be URLs should use url in the name.

This proposes to update the guidelines to advocate for clearer naming for fields that can only return URLs.

It appears to be possible to misinterpret AIP-0140 guidelines to infer that fields that return URLs MUST be named as if they could be URIs. It seems more accurate to indicate that fields that COULD be URIs should use `uri` in the name and fields that MUST be URLs should use `url` in the name.
@stephanemoore stephanemoore requested a review from a team as a code owner August 27, 2025 07:06
@noahdietz noahdietz requested review from noahdietz and removed request for itsStrobe August 27, 2025 16:22
Copy link
Copy Markdown
Collaborator

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

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

Hey @stephanemoore this seems reasonable to do! Let me circle back with some others and get back to you.

Comment thread aip/general/0140.md Outdated
Comment thread aip/general/0140.md Outdated
Comment thread aip/general/0140.md Outdated
Comment thread aip/general/0140.md Outdated
stephanemoore and others added 2 commits September 12, 2025 15:13
Co-authored-by: Noah Dietz <noahdietz@users.noreply.github.com>
Changes include:
* Remove "always" from the prescription for URI fields for
  consistency.
* Collapse proposed URLs section into URIs section.
* Reformat prescription for URIs to be consistent with prescription for
  URLs.
* Add an example proto for clarity.
* Add a note indicating that the prescription for URLs should be
  balanced against local consistency and API stability.

PR link:
aip-dev#1551
Comment thread aip/general/0140.md Outdated
@noahdietz noahdietz changed the title Update guidance on URL/URI naming in AIP-140 ✍️ feat(AIP-140): allow url field name in specific cases Sep 15, 2025
@noahdietz noahdietz merged commit 154d8dc into aip-dev:master Sep 15, 2025
2 checks passed
stephanemoore added a commit to stephanemoore/api-linter that referenced this pull request Sep 19, 2025
… comments

AIP-140 was recently updated to clarify that field names may use `url`
when the field can only represent a URL. The current URI lint rule for
AIP-140 will unconditionally discourage using `url` in field names.
This change updates the URI lint rule to be more conservative by only
suggesting renaming the field to use `uri` when the field's comments
use the term URI.

Related update to AIP-140:
aip-dev/google.aip.dev#1551
noahdietz pushed a commit to googleapis/api-linter that referenced this pull request Sep 22, 2025
… comments (#1541)

* fix(AIP-140): restrict `uri` naming suggestions to fields with URI in comments

AIP-140 was recently updated to clarify that field names may use `url`
when the field can only represent a URL. The current URI lint rule for
AIP-140 will unconditionally discourage using `url` in field names.
This change updates the URI lint rule to be more conservative by only
suggesting renaming the field to use `uri` when the field's comments
use the term URI.

Related update to AIP-140:
aip-dev/google.aip.dev#1551

* Add a test case for a `uri` field with a comment mentioning "URI".

* Add a test case for a `url` field where comment has intra-word "uri" substring

---------

Co-authored-by: Santiago Quiroga <22756465+quirogas@users.noreply.github.com>
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.

2 participants