forked from hasura/graphql-engine
/
operations.rs
74 lines (71 loc) · 3.13 KB
/
operations.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use gql::ast::common as ast;
use lang_graphql as gql;
use open_dds::data_specification;
use serde_json as json;
use thiserror::Error;
use super::types::Annotation;
pub(crate) mod relationships;
pub(crate) mod response_processing;
pub(crate) mod select_one;
#[derive(Error, Debug)]
pub enum Error {
#[error("parsing failed: {0}")]
ParseFailure(#[from] gql::ast::spanning::Positioned<gql::parser::Error>),
#[error("validation failed: {0}")]
ValidationFailed(#[from] gql::validation::Error),
#[error("internal introspection error: {0}")]
IntrospectionError(#[from] gql::introspection::Error),
#[error("internal serialization error: {0}")]
SerializationError(#[from] json::Error),
#[error("internal IR conversion error: {0}")]
IRConversionError(#[from] gql::normalized_ast::Error),
#[error("internal error: unexpected annotation: {annotation:?}")]
UnexpectedAnnotation { annotation: Annotation },
#[error("internal communication error: {0}")]
GDCClientError(#[from] ndc_client::apis::Error),
#[error("internal error: unexpected response from data connector: {summary}")]
BadGDCResponse { summary: String },
#[error("internal error: invalid type in annotation: {type_name}")]
InvalidType {
type_name: data_specification::TypeName,
},
#[error("internal error: invalid field in annotation: {field_name}")]
InvalidField {
field_name: data_specification::FieldName,
},
#[error("No data source specified for field {field_name} in type {type_name}")]
NoDataSource {
type_name: ast::TypeName,
field_name: ast::Name,
},
#[error("No argument source specified for argument {argument_name} in field {field_name}")]
NoArgumentSource {
field_name: ast::Name,
argument_name: ast::Name,
},
#[error("Argument {argument_name} already exists in the relationship {relationship_name}")]
ArgumentAlreadyExistsInRelationship {
argument_name: data_specification::ArgumentName,
relationship_name: data_specification::RelationshipName,
},
#[error("mapping for source column {source_column} already exists in the relationship {relationship_name}")]
MappingExistsInRelationship {
source_column: data_specification::FieldName,
relationship_name: data_specification::RelationshipName,
},
#[error("Relationships only within the same data source are supported.")]
RemoteRelationshipsAreNotSupported,
#[error("{description}")]
InternalError { description: String },
#[error("Type mapping not found for the type name {type_name:} while executing the relationship {relationship_name:}")]
TypeMappingNotFoundForRelationship {
type_name: data_specification::TypeName,
relationship_name: data_specification::RelationshipName,
},
#[error("Field mapping not found for the field {field_name:} of type {type_name:} while executing the relationship {relationship_name:}")]
FieldMappingNotFoundForRelationship {
type_name: data_specification::TypeName,
relationship_name: data_specification::RelationshipName,
field_name: data_specification::FieldName,
},
}