graphql_error.proto 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright 2024 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. // Adapted from third_party/firebase/dataconnect/emulator/server/api/graphql_error.proto
  15. syntax = "proto3";
  16. package google.firebase.dataconnect.v1alpha;
  17. import "google/protobuf/struct.proto";
  18. option java_package = "com.google.firebase.dataconnect.v1alpha";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "GraphqlErrorProto";
  21. // GraphqlError conforms to the GraphQL error spec.
  22. // https://spec.graphql.org/draft/#sec-Errors
  23. //
  24. // Firebase Data Connect API surfaces `GraphqlError` in various APIs:
  25. // - Upon compile error, `UpdateSchema` and `UpdateConnector` return
  26. // Code.Invalid_Argument with a list of `GraphqlError` in error details.
  27. // - Upon query compile error, `ExecuteGraphql` and `ExecuteGraphqlRead` return
  28. // Code.OK with a list of `GraphqlError` in response body.
  29. // - Upon query execution error, `ExecuteGraphql`, `ExecuteGraphqlRead`,
  30. // `ExecuteMutation` and `ExecuteQuery` all return Code.OK with a list of
  31. // `GraphqlError` in response body.
  32. message GraphqlError {
  33. // The detailed error message.
  34. // The message should help developer understand the underlying problem without
  35. // leaking internal data.
  36. string message = 1;
  37. // The source locations where the error occurred.
  38. // Locations should help developers and toolings identify the source of error
  39. // quickly.
  40. //
  41. // Included in admin endpoints (`ExecuteGraphql`, `ExecuteGraphqlRead`,
  42. // `UpdateSchema` and `UpdateConnector`) to reference the provided GraphQL
  43. // GQL document.
  44. //
  45. // Omitted in `ExecuteMutation` and `ExecuteQuery` since the caller shouldn't
  46. // have access access the underlying GQL source.
  47. repeated SourceLocation locations = 2;
  48. // The result field which could not be populated due to error.
  49. //
  50. // Clients can use path to identify whether a null result is intentional or
  51. // caused by a runtime error.
  52. // It should be a list of string or index from the root of GraphQL query
  53. // document.
  54. google.protobuf.ListValue path = 3;
  55. // Additional error information.
  56. GraphqlErrorExtensions extensions = 4;
  57. }
  58. // SourceLocation references a location in a GraphQL source.
  59. message SourceLocation {
  60. // Line number starting at 1.
  61. int32 line = 1;
  62. // Column number starting at 1.
  63. int32 column = 2;
  64. }
  65. // GraphqlErrorExtensions contains additional information of `GraphqlError`.
  66. // (-- TODO(b/305311379): include more detailed error fields:
  67. // go/firemat:api:gql-errors. --)
  68. message GraphqlErrorExtensions {
  69. // The source file name where the error occurred.
  70. // Included only for `UpdateSchema` and `UpdateConnector`, it corresponds
  71. // to `File.path` of the provided `Source`.
  72. string file = 1;
  73. }