googleapis / api-linter

A linter for APIs defined in protocol buffers.
https://linter.aip.dev/
Apache License 2.0
558 stars 137 forks source link

AIP-123: google.api.resource plural field shouldn't be necessary for Singleton resources #1333

Closed noahdietz closed 3 months ago

noahdietz commented 4 months ago

If we can detect that a resource definition represents a Singleton, the plural annotation shouldn't be necessary.

Unless we know there are use cases for it, or if we want to enforce its presence regardless of Singleton status, it should be excused.

BrandonY commented 3 months ago

GCS also ran into this one. We've got a singleton resource, and the linter wants us to give it a plural annotation that won't be used.

noahdietz commented 3 months ago

@BrandonY you know I was just thinking about this the other day, because there was a YAQS regarding Singleton resources & pseudo-collection methods. There is technically a provision in AIP-156 that allows services to implement a Standard List + Reading across collections to list all Singleton resources for a parent collection: https://google.aip.dev/156#support-for-standard-list. I think we might want to still have it "just in case". I think it might seem silly at first but will be positive for future proofing. Going to bring it up in the next API design meeting

noahdietz commented 3 months ago

Ok we are going to require that Singletons also have the plural annotation for future proofing reasons, especially b.c there are viable uses for a plural singleton word (see above examples). Will need to update the AIP as well.

BrandonY commented 3 months ago

SGTM, thanks!