Skip to content

Commit 7238fe4

Browse files
committed
Implemented errors to spec
1 parent 23eec8d commit 7238fe4

22 files changed

+531
-333
lines changed

packages/firebase_data_connect/firebase_data_connect/example/dataconnect/connector/mutations.gql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ mutation deleteMovie($id: UUID!) @auth(level: PUBLIC) {
6262
movie_delete(id: $id)
6363
}
6464

65-
mutation thing($title: Any! = "ABC") {
65+
mutation thing($title: Any! = "ABC") @auth(level: PUBLIC) {
6666
abc: thing_insert(data: {
6767
id: "a231d1ff-1825-447d-8b12-de092fb3a0f1"
6868
title: $title

packages/firebase_data_connect/firebase_data_connect/example/lib/generated/add_date_and_timestamp.dart

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,34 @@ class AddDateAndTimestampVariablesBuilder {
55
Timestamp timestamp;
66

77
final FirebaseDataConnect _dataConnect;
8-
AddDateAndTimestampVariablesBuilder(this._dataConnect, {required this.date,required this.timestamp,});
9-
Deserializer<AddDateAndTimestampData> dataDeserializer = (dynamic json) => AddDateAndTimestampData.fromJson(jsonDecode(json));
10-
Serializer<AddDateAndTimestampVariables> varsSerializer = (AddDateAndTimestampVariables vars) => jsonEncode(vars.toJson());
11-
Future<OperationResult<AddDateAndTimestampData, AddDateAndTimestampVariables>> execute() {
8+
AddDateAndTimestampVariablesBuilder(
9+
this._dataConnect, {
10+
required this.date,
11+
required this.timestamp,
12+
});
13+
Deserializer<AddDateAndTimestampData> dataDeserializer =
14+
(dynamic json) => AddDateAndTimestampData.fromJson(jsonDecode(json));
15+
Serializer<AddDateAndTimestampVariables> varsSerializer =
16+
(AddDateAndTimestampVariables vars) => jsonEncode(vars.toJson());
17+
Future<OperationResult<AddDateAndTimestampData, AddDateAndTimestampVariables>>
18+
execute() {
1219
return ref().execute();
1320
}
1421

1522
MutationRef<AddDateAndTimestampData, AddDateAndTimestampVariables> ref() {
16-
AddDateAndTimestampVariables vars= AddDateAndTimestampVariables(date: date,timestamp: timestamp,);
17-
return _dataConnect.mutation("addDateAndTimestamp", dataDeserializer, varsSerializer, vars);
23+
AddDateAndTimestampVariables vars = AddDateAndTimestampVariables(
24+
date: date,
25+
timestamp: timestamp,
26+
);
27+
return _dataConnect.mutation(
28+
"addDateAndTimestamp", dataDeserializer, varsSerializer, vars);
1829
}
1930
}
2031

2132
class AddDateAndTimestampTimestampHolderInsert {
2233
String id;
23-
AddDateAndTimestampTimestampHolderInsert.fromJson(dynamic json):
24-
id = nativeFromJson<String>(json['id']);
34+
AddDateAndTimestampTimestampHolderInsert.fromJson(dynamic json)
35+
: id = nativeFromJson<String>(json['id']);
2536

2637
Map<String, dynamic> toJson() {
2738
Map<String, dynamic> json = {};
@@ -36,8 +47,10 @@ class AddDateAndTimestampTimestampHolderInsert {
3647

3748
class AddDateAndTimestampData {
3849
AddDateAndTimestampTimestampHolderInsert timestampHolder_insert;
39-
AddDateAndTimestampData.fromJson(dynamic json):
40-
timestampHolder_insert = AddDateAndTimestampTimestampHolderInsert.fromJson(json['timestampHolder_insert']);
50+
AddDateAndTimestampData.fromJson(dynamic json)
51+
: timestampHolder_insert =
52+
AddDateAndTimestampTimestampHolderInsert.fromJson(
53+
json['timestampHolder_insert']);
4154

4255
Map<String, dynamic> toJson() {
4356
Map<String, dynamic> json = {};
@@ -53,9 +66,11 @@ class AddDateAndTimestampData {
5366
class AddDateAndTimestampVariables {
5467
DateTime date;
5568
Timestamp timestamp;
56-
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
57-
AddDateAndTimestampVariables.fromJson(Map<String, dynamic> json):
58-
date = nativeFromJson<DateTime>(json['date']),timestamp = Timestamp.fromJson(json['timestamp']);
69+
@Deprecated(
70+
'fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
71+
AddDateAndTimestampVariables.fromJson(Map<String, dynamic> json)
72+
: date = nativeFromJson<DateTime>(json['date']),
73+
timestamp = Timestamp.fromJson(json['timestamp']);
5974

6075
Map<String, dynamic> toJson() {
6176
Map<String, dynamic> json = {};
@@ -69,4 +84,3 @@ class AddDateAndTimestampVariables {
6984
required this.timestamp,
7085
});
7186
}
72-

packages/firebase_data_connect/firebase_data_connect/example/lib/generated/add_director_to_movie.dart

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,50 @@
11
part of 'movies.dart';
22

33
class AddDirectorToMovieVariablesBuilder {
4-
Optional<AddDirectorToMovieVariablesPersonId> _personId = Optional.optional(AddDirectorToMovieVariablesPersonId.fromJson, defaultSerializer);
4+
Optional<AddDirectorToMovieVariablesPersonId> _personId = Optional.optional(
5+
AddDirectorToMovieVariablesPersonId.fromJson, defaultSerializer);
56
Optional<String> _movieId = Optional.optional(nativeFromJson, nativeToJson);
67

78
final FirebaseDataConnect _dataConnect;
8-
AddDirectorToMovieVariablesBuilder personId(AddDirectorToMovieVariablesPersonId? t) {
9-
_personId.value = t;
10-
return this;
9+
AddDirectorToMovieVariablesBuilder personId(
10+
AddDirectorToMovieVariablesPersonId? t) {
11+
_personId.value = t;
12+
return this;
1113
}
14+
1215
AddDirectorToMovieVariablesBuilder movieId(String? t) {
13-
_movieId.value = t;
14-
return this;
16+
_movieId.value = t;
17+
return this;
1518
}
1619

17-
AddDirectorToMovieVariablesBuilder(this._dataConnect, );
18-
Deserializer<AddDirectorToMovieData> dataDeserializer = (dynamic json) => AddDirectorToMovieData.fromJson(jsonDecode(json));
19-
Serializer<AddDirectorToMovieVariables> varsSerializer = (AddDirectorToMovieVariables vars) => jsonEncode(vars.toJson());
20-
Future<OperationResult<AddDirectorToMovieData, AddDirectorToMovieVariables>> execute() {
20+
AddDirectorToMovieVariablesBuilder(
21+
this._dataConnect,
22+
);
23+
Deserializer<AddDirectorToMovieData> dataDeserializer =
24+
(dynamic json) => AddDirectorToMovieData.fromJson(jsonDecode(json));
25+
Serializer<AddDirectorToMovieVariables> varsSerializer =
26+
(AddDirectorToMovieVariables vars) => jsonEncode(vars.toJson());
27+
Future<OperationResult<AddDirectorToMovieData, AddDirectorToMovieVariables>>
28+
execute() {
2129
return ref().execute();
2230
}
2331

2432
MutationRef<AddDirectorToMovieData, AddDirectorToMovieVariables> ref() {
25-
AddDirectorToMovieVariables vars= AddDirectorToMovieVariables(personId: _personId,movieId: _movieId,);
26-
return _dataConnect.mutation("addDirectorToMovie", dataDeserializer, varsSerializer, vars);
33+
AddDirectorToMovieVariables vars = AddDirectorToMovieVariables(
34+
personId: _personId,
35+
movieId: _movieId,
36+
);
37+
return _dataConnect.mutation(
38+
"addDirectorToMovie", dataDeserializer, varsSerializer, vars);
2739
}
2840
}
2941

3042
class AddDirectorToMovieDirectedByInsert {
3143
String directedbyId;
3244
String movieId;
33-
AddDirectorToMovieDirectedByInsert.fromJson(dynamic json):
34-
directedbyId = nativeFromJson<String>(json['directedbyId']),movieId = nativeFromJson<String>(json['movieId']);
45+
AddDirectorToMovieDirectedByInsert.fromJson(dynamic json)
46+
: directedbyId = nativeFromJson<String>(json['directedbyId']),
47+
movieId = nativeFromJson<String>(json['movieId']);
3548

3649
Map<String, dynamic> toJson() {
3750
Map<String, dynamic> json = {};
@@ -48,8 +61,9 @@ class AddDirectorToMovieDirectedByInsert {
4861

4962
class AddDirectorToMovieData {
5063
AddDirectorToMovieDirectedByInsert directedBy_insert;
51-
AddDirectorToMovieData.fromJson(dynamic json):
52-
directedBy_insert = AddDirectorToMovieDirectedByInsert.fromJson(json['directedBy_insert']);
64+
AddDirectorToMovieData.fromJson(dynamic json)
65+
: directedBy_insert = AddDirectorToMovieDirectedByInsert.fromJson(
66+
json['directedBy_insert']);
5367

5468
Map<String, dynamic> toJson() {
5569
Map<String, dynamic> json = {};
@@ -64,8 +78,8 @@ class AddDirectorToMovieData {
6478

6579
class AddDirectorToMovieVariablesPersonId {
6680
String id;
67-
AddDirectorToMovieVariablesPersonId.fromJson(dynamic json):
68-
id = nativeFromJson<String>(json['id']);
81+
AddDirectorToMovieVariablesPersonId.fromJson(dynamic json)
82+
: id = nativeFromJson<String>(json['id']);
6983

7084
Map<String, dynamic> toJson() {
7185
Map<String, dynamic> json = {};
@@ -79,25 +93,29 @@ class AddDirectorToMovieVariablesPersonId {
7993
}
8094

8195
class AddDirectorToMovieVariables {
82-
late Optional<AddDirectorToMovieVariablesPersonId>personId;
83-
late Optional<String>movieId;
84-
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
96+
late Optional<AddDirectorToMovieVariablesPersonId> personId;
97+
late Optional<String> movieId;
98+
@Deprecated(
99+
'fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
85100
AddDirectorToMovieVariables.fromJson(Map<String, dynamic> json) {
86-
87-
personId = Optional.optional(AddDirectorToMovieVariablesPersonId.fromJson, defaultSerializer);
88-
personId.value = json['personId'] == null ? null : AddDirectorToMovieVariablesPersonId.fromJson(json['personId']);
89-
101+
personId = Optional.optional(
102+
AddDirectorToMovieVariablesPersonId.fromJson, defaultSerializer);
103+
personId.value = json['personId'] == null
104+
? null
105+
: AddDirectorToMovieVariablesPersonId.fromJson(json['personId']);
106+
90107
movieId = Optional.optional(nativeFromJson, nativeToJson);
91-
movieId.value = json['movieId'] == null ? null : nativeFromJson<String>(json['movieId']);
92-
108+
movieId.value = json['movieId'] == null
109+
? null
110+
: nativeFromJson<String>(json['movieId']);
93111
}
94112

95113
Map<String, dynamic> toJson() {
96114
Map<String, dynamic> json = {};
97-
if(personId.state == OptionalState.set) {
115+
if (personId.state == OptionalState.set) {
98116
json['personId'] = personId.toJson();
99117
}
100-
if(movieId.state == OptionalState.set) {
118+
if (movieId.state == OptionalState.set) {
101119
json['movieId'] = movieId.toJson();
102120
}
103121
return json;
@@ -108,4 +126,3 @@ class AddDirectorToMovieVariables {
108126
required this.movieId,
109127
});
110128
}
111-

packages/firebase_data_connect/firebase_data_connect/example/lib/generated/add_person.dart

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,34 @@ class AddPersonVariablesBuilder {
55

66
final FirebaseDataConnect _dataConnect;
77
AddPersonVariablesBuilder name(String? t) {
8-
_name.value = t;
9-
return this;
8+
_name.value = t;
9+
return this;
1010
}
1111

12-
AddPersonVariablesBuilder(this._dataConnect, );
13-
Deserializer<AddPersonData> dataDeserializer = (dynamic json) => AddPersonData.fromJson(jsonDecode(json));
14-
Serializer<AddPersonVariables> varsSerializer = (AddPersonVariables vars) => jsonEncode(vars.toJson());
12+
AddPersonVariablesBuilder(
13+
this._dataConnect,
14+
);
15+
Deserializer<AddPersonData> dataDeserializer =
16+
(dynamic json) => AddPersonData.fromJson(jsonDecode(json));
17+
Serializer<AddPersonVariables> varsSerializer =
18+
(AddPersonVariables vars) => jsonEncode(vars.toJson());
1519
Future<OperationResult<AddPersonData, AddPersonVariables>> execute() {
1620
return ref().execute();
1721
}
1822

1923
MutationRef<AddPersonData, AddPersonVariables> ref() {
20-
AddPersonVariables vars= AddPersonVariables(name: _name,);
21-
return _dataConnect.mutation("addPerson", dataDeserializer, varsSerializer, vars);
24+
AddPersonVariables vars = AddPersonVariables(
25+
name: _name,
26+
);
27+
return _dataConnect.mutation(
28+
"addPerson", dataDeserializer, varsSerializer, vars);
2229
}
2330
}
2431

2532
class AddPersonPersonInsert {
2633
String id;
27-
AddPersonPersonInsert.fromJson(dynamic json):
28-
id = nativeFromJson<String>(json['id']);
34+
AddPersonPersonInsert.fromJson(dynamic json)
35+
: id = nativeFromJson<String>(json['id']);
2936

3037
Map<String, dynamic> toJson() {
3138
Map<String, dynamic> json = {};
@@ -40,8 +47,8 @@ class AddPersonPersonInsert {
4047

4148
class AddPersonData {
4249
AddPersonPersonInsert person_insert;
43-
AddPersonData.fromJson(dynamic json):
44-
person_insert = AddPersonPersonInsert.fromJson(json['person_insert']);
50+
AddPersonData.fromJson(dynamic json)
51+
: person_insert = AddPersonPersonInsert.fromJson(json['person_insert']);
4552

4653
Map<String, dynamic> toJson() {
4754
Map<String, dynamic> json = {};
@@ -55,18 +62,18 @@ class AddPersonData {
5562
}
5663

5764
class AddPersonVariables {
58-
late Optional<String>name;
59-
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
65+
late Optional<String> name;
66+
@Deprecated(
67+
'fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
6068
AddPersonVariables.fromJson(Map<String, dynamic> json) {
61-
6269
name = Optional.optional(nativeFromJson, nativeToJson);
63-
name.value = json['name'] == null ? null : nativeFromJson<String>(json['name']);
64-
70+
name.value =
71+
json['name'] == null ? null : nativeFromJson<String>(json['name']);
6572
}
6673

6774
Map<String, dynamic> toJson() {
6875
Map<String, dynamic> json = {};
69-
if(name.state == OptionalState.set) {
76+
if (name.state == OptionalState.set) {
7077
json['name'] = name.toJson();
7178
}
7279
return json;
@@ -76,4 +83,3 @@ class AddPersonVariables {
7683
required this.name,
7784
});
7885
}
79-

packages/firebase_data_connect/firebase_data_connect/example/lib/generated/add_timestamp.dart

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,31 @@ class AddTimestampVariablesBuilder {
44
Timestamp timestamp;
55

66
final FirebaseDataConnect _dataConnect;
7-
AddTimestampVariablesBuilder(this._dataConnect, {required this.timestamp,});
8-
Deserializer<AddTimestampData> dataDeserializer = (dynamic json) => AddTimestampData.fromJson(jsonDecode(json));
9-
Serializer<AddTimestampVariables> varsSerializer = (AddTimestampVariables vars) => jsonEncode(vars.toJson());
7+
AddTimestampVariablesBuilder(
8+
this._dataConnect, {
9+
required this.timestamp,
10+
});
11+
Deserializer<AddTimestampData> dataDeserializer =
12+
(dynamic json) => AddTimestampData.fromJson(jsonDecode(json));
13+
Serializer<AddTimestampVariables> varsSerializer =
14+
(AddTimestampVariables vars) => jsonEncode(vars.toJson());
1015
Future<OperationResult<AddTimestampData, AddTimestampVariables>> execute() {
1116
return ref().execute();
1217
}
1318

1419
MutationRef<AddTimestampData, AddTimestampVariables> ref() {
15-
AddTimestampVariables vars= AddTimestampVariables(timestamp: timestamp,);
16-
return _dataConnect.mutation("addTimestamp", dataDeserializer, varsSerializer, vars);
20+
AddTimestampVariables vars = AddTimestampVariables(
21+
timestamp: timestamp,
22+
);
23+
return _dataConnect.mutation(
24+
"addTimestamp", dataDeserializer, varsSerializer, vars);
1725
}
1826
}
1927

2028
class AddTimestampTimestampHolderInsert {
2129
String id;
22-
AddTimestampTimestampHolderInsert.fromJson(dynamic json):
23-
id = nativeFromJson<String>(json['id']);
30+
AddTimestampTimestampHolderInsert.fromJson(dynamic json)
31+
: id = nativeFromJson<String>(json['id']);
2432

2533
Map<String, dynamic> toJson() {
2634
Map<String, dynamic> json = {};
@@ -35,8 +43,9 @@ class AddTimestampTimestampHolderInsert {
3543

3644
class AddTimestampData {
3745
AddTimestampTimestampHolderInsert timestampHolder_insert;
38-
AddTimestampData.fromJson(dynamic json):
39-
timestampHolder_insert = AddTimestampTimestampHolderInsert.fromJson(json['timestampHolder_insert']);
46+
AddTimestampData.fromJson(dynamic json)
47+
: timestampHolder_insert = AddTimestampTimestampHolderInsert.fromJson(
48+
json['timestampHolder_insert']);
4049

4150
Map<String, dynamic> toJson() {
4251
Map<String, dynamic> json = {};
@@ -51,9 +60,10 @@ class AddTimestampData {
5160

5261
class AddTimestampVariables {
5362
Timestamp timestamp;
54-
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
55-
AddTimestampVariables.fromJson(Map<String, dynamic> json):
56-
timestamp = Timestamp.fromJson(json['timestamp']);
63+
@Deprecated(
64+
'fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
65+
AddTimestampVariables.fromJson(Map<String, dynamic> json)
66+
: timestamp = Timestamp.fromJson(json['timestamp']);
5767

5868
Map<String, dynamic> toJson() {
5969
Map<String, dynamic> json = {};
@@ -65,4 +75,3 @@ class AddTimestampVariables {
6575
required this.timestamp,
6676
});
6777
}
68-

0 commit comments

Comments
 (0)