field_behavior.proto 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.api;
  16. import "google/protobuf/descriptor.proto";
  17. option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "FieldBehaviorProto";
  20. option java_package = "com.google.api";
  21. option objc_class_prefix = "GAPI";
  22. // An indicator of the behavior of a given field (for example, that a field
  23. // is required in requests, or given as output but ignored as input).
  24. // This **does not** change the behavior in protocol buffers itself; it only
  25. // denotes the behavior and may affect how API tooling handles the field.
  26. //
  27. // Note: This enum **may** receive new values in the future.
  28. enum FieldBehavior {
  29. // Conventional default for enums. Do not use this.
  30. FIELD_BEHAVIOR_UNSPECIFIED = 0;
  31. // Specifically denotes a field as optional.
  32. // While all fields in protocol buffers are optional, this may be specified
  33. // for emphasis if appropriate.
  34. OPTIONAL = 1;
  35. // Denotes a field as required.
  36. // This indicates that the field **must** be provided as part of the request,
  37. // and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
  38. REQUIRED = 2;
  39. // Denotes a field as output only.
  40. // This indicates that the field is provided in responses, but including the
  41. // field in a request does nothing (the server *must* ignore it and
  42. // *must not* throw an error as a result of the field's presence).
  43. OUTPUT_ONLY = 3;
  44. // Denotes a field as input only.
  45. // This indicates that the field is provided in requests, and the
  46. // corresponding field is not included in output.
  47. INPUT_ONLY = 4;
  48. // Denotes a field as immutable.
  49. // This indicates that the field may be set once in a request to create a
  50. // resource, but may not be changed thereafter.
  51. IMMUTABLE = 5;
  52. }
  53. extend google.protobuf.FieldOptions {
  54. // A designation of a specific field behavior (required, output only, etc.)
  55. // in protobuf messages.
  56. //
  57. // Examples:
  58. //
  59. // string name = 1 [(google.api.field_behavior) = REQUIRED];
  60. // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  61. // google.protobuf.Duration ttl = 1
  62. // [(google.api.field_behavior) = INPUT_ONLY];
  63. // google.protobuf.Timestamp expire_time = 1
  64. // [(google.api.field_behavior) = OUTPUT_ONLY,
  65. // (google.api.field_behavior) = IMMUTABLE];
  66. repeated FieldBehavior field_behavior = 1052;
  67. }