Skip to content

Commit 79d140a

Browse files
committed
Filter out ppxAllowStringReturnType
1 parent 3aebf83 commit 79d140a

File tree

10 files changed

+16
-17
lines changed

10 files changed

+16
-17
lines changed

snapshot_tests/operations/expected/apollo/compile/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ var Raw$1 = {};
6666

6767
var query$1 = Gql`query MyQuery {
6868
lists {
69-
...ListFragment @ppxAllowStringReturnType
69+
...ListFragment
7070
}
7171

7272
}

snapshot_tests/operations/expected/apollo/generate/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function back to the original JSON compatible data ")
136136
[
137137
"query MyQuery {
138138
lists {
139-
...ListFragment @ppxAllowStringReturnType
139+
...ListFragment
140140
}
141141

142142
}

snapshot_tests/operations/expected/native/generate/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function back to the original JSON compatible data ")
136136
[
137137
"query MyQuery {
138138
lists {
139-
...ListFragment @ppxAllowStringReturnType
139+
...ListFragment
140140
}
141141

142142
}

snapshot_tests/operations/expected/records/compile/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var Raw$1 = {};
6363

6464
var query$1 = Gql`query MyQuery {
6565
lists {
66-
...ListFragment @ppxAllowStringReturnType
66+
...ListFragment
6767
}
6868

6969
}

snapshot_tests/operations/expected/records/generate/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function back to the original JSON compatible data ")
136136
[
137137
"query MyQuery {
138138
lists {
139-
...ListFragment @ppxAllowStringReturnType
139+
...ListFragment
140140
}
141141

142142
}

snapshot_tests/operations/expected/template/compile/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var Raw$1 = {};
6767

6868
var query$1 = Gql`query MyQuery {
6969
lists {
70-
...ListFragment @ppxAllowStringReturnType
70+
...ListFragment
7171
}
7272

7373
}

snapshot_tests/operations/expected/template/generate/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function back to the original JSON compatible data ")
136136
[
137137
"query MyQuery {
138138
lists {
139-
...ListFragment @ppxAllowStringReturnType
139+
...ListFragment
140140
}
141141

142142
}

snapshot_tests/operations/expected/uncurried/compile/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var Raw$1 = {};
6363

6464
var query$1 = Gql`query MyQuery {
6565
lists {
66-
...ListFragment @ppxAllowStringReturnType
66+
...ListFragment
6767
}
6868

6969
}

snapshot_tests/operations/expected/uncurried/generate/fragmentWithdifferentReturnType.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function back to the original JSON compatible data ")
136136
[
137137
"query MyQuery {
138138
lists {
139-
...ListFragment @ppxAllowStringReturnType
139+
...ListFragment
140140
}
141141

142142
}

src/graphql_compiler/graphql_printer.ml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,13 @@ let print_directive d =
5353
| None -> ""
5454

5555
let is_internal_directive d =
56-
match d.item.d_name.item with
57-
| "bsOmitFutureValue" | "ppxOmitFutureValue" | "bsVariant" | "ppxVariant"
58-
| "bsRecord" | "ppxRecord" | "bsObject" | "ppxObject" | "bsDecoder"
59-
| "ppxDecoder" | "bsCustom" | "ppxCustom" | "ppxCustomOpt" | "bsAs" | "ppxAs"
60-
| "argumentDefinitions" | "arguments" | "bsField" | "ppxField" | "ppxConfig"
61-
->
62-
true
63-
| _ -> false
56+
let name = d.item.d_name.item in
57+
if
58+
String.starts_with ~prefix:"bs" name
59+
|| String.starts_with ~prefix:"ppx" name
60+
then true
61+
else
62+
match name with "argumentDefinitions" | "arguments" -> true | _ -> false
6463

6564
let print_directives ds =
6665
" "

0 commit comments

Comments
 (0)