Skip to content

core::0143::standardized-codes: allow field names if resource type #1575

@loeffel-io

Description

@loeffel-io

Hey,

i do see the point that it's language_code instead of language.
In this specific use case we have a resource Language which includes the language_code as field but the resource itself is called language.

i think it can make sense to allow core::0143::standardized-codes for resource types.

wdyt? 🙏

  // The language
  //
  // (-- api-linter: core::0143::standardized-codes=disabled
  //     aip.dev/not-precedent: We need to do this because reasons. --)
  string language = 1 [
    (google.api.resource_reference) = {type: "language.mindful.com/Language"}, <-- allow when resource? 
    (google.api.field_behavior) = REQUIRED
  ];
// Represents the languages resource
message Language {
  option (google.api.resource) = {
    type: "language.mindful.com/Language"
    pattern: "languages/{language}"
    singular: "language"
    plural: "languages"
  };
  // The resource name.
  // Format: languages/{language}
  string name = 1 [
    (google.api.field_behavior) = IDENTIFIER,
    (buf.validate.field).string = {pattern: "^languages\\/[a-z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"},
    (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE
  ];
  // The resource display name.
  // The display name is the human-readable name in the self language for the language.
  string display_name = 2 [
    (google.api.field_behavior) = REQUIRED,
    (buf.validate.field).string = {
      min_len: 1
      max_len: 63
    },
    (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE
  ];
  // The resource language code
  string language_code = 3 [(google.api.field_behavior) = REQUIRED];
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions