field_behavior.proto 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. // http://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. //
  15. syntax = "proto3";
  16. package google.api;
  17. import "google/protobuf/descriptor.proto";
  18. option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "FieldBehaviorProto";
  21. option java_package = "com.google.api";
  22. option objc_class_prefix = "GAPI";
  23. extend google.protobuf.FieldOptions {
  24. // A designation of a specific field behavior (required, output only, etc.)
  25. // in protobuf messages.
  26. //
  27. // Examples:
  28. //
  29. // string name = 1 [(google.api.field_behavior) = REQUIRED];
  30. // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  31. // google.protobuf.Duration ttl = 1
  32. // [(google.api.field_behavior) = INPUT_ONLY];
  33. // google.protobuf.Timestamp expire_time = 1
  34. // [(google.api.field_behavior) = OUTPUT_ONLY,
  35. // (google.api.field_behavior) = IMMUTABLE];
  36. repeated google.api.FieldBehavior field_behavior = 1052;
  37. }
  38. // An indicator of the behavior of a given field (for example, that a field
  39. // is required in requests, or given as output but ignored as input).
  40. // This **does not** change the behavior in protocol buffers itself; it only
  41. // denotes the behavior and may affect how API tooling handles the field.
  42. //
  43. // Note: This enum **may** receive new values in the future.
  44. enum FieldBehavior {
  45. // Conventional default for enums. Do not use this.
  46. FIELD_BEHAVIOR_UNSPECIFIED = 0;
  47. // Specifically denotes a field as optional.
  48. // While all fields in protocol buffers are optional, this may be specified
  49. // for emphasis if appropriate.
  50. OPTIONAL = 1;
  51. // Denotes a field as required.
  52. // This indicates that the field **must** be provided as part of the request,
  53. // and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
  54. REQUIRED = 2;
  55. // Denotes a field as output only.
  56. // This indicates that the field is provided in responses, but including the
  57. // field in a request does nothing (the server *must* ignore it and
  58. // *must not* throw an error as a result of the field's presence).
  59. OUTPUT_ONLY = 3;
  60. // Denotes a field as input only.
  61. // This indicates that the field is provided in requests, and the
  62. // corresponding field is not included in output.
  63. INPUT_ONLY = 4;
  64. // Denotes a field as immutable.
  65. // This indicates that the field may be set once in a request to create a
  66. // resource, but may not be changed thereafter.
  67. IMMUTABLE = 5;
  68. }