api-linter
api-linter copied to clipboard
Hoisting fields for BatchCreate* requests blocked by linter
The docs for batch creation state: Other fields may be "hoisted" from the standard Create request, which means that the field can be set at either the batch level or child request level.
However, this gets flagged by the linter: https://linter.aip.dev/233/request-unknown-fields
Which fields in particular are being flagged?
A field in the resource being created.
Ah, in that case you may just want to suppress the linter rule for that field, though it’s possible we could augment this rule to check if a same-named field exists in the resource.
On Thu, Sep 16, 2021 at 7:27 PM adsouza @.***> wrote:
A field in the resource being created.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/googleapis/api-linter/issues/879#issuecomment-921330689, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB6RMDXWEWYJ764PYW5Z4TUCJ4PVANCNFSM5EFOH54Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Such an augmentation would be super handy, although for now even a note in the linter doc explaining that false positives like this are expected would be nice.
we could augment this rule to check if a same-named field exists in the resource.
Hoisting is intended for fields in the Standard Create request message, not the resource within that Create request message. That said, I think the Create request message field representing the resource itself could be hoisted into the BatchCreate message and it would accomplish the same thing. I'd need to verify this with some folks.
If we were to implement this, we would need to keep in mind the sub-text to the "hoisting" allowance that disallows fields must be unique per-request message:
Fields which must be unique cannot be hoisted (e.g. Customer-provided id fields).