Skip to content

Commit f9c487f

Browse files
authored
Merge pull request #103 from OxfordAbstracts/remove-ArgGql-from-genned-schema-#102
Remove arg gql from genned schema #102
2 parents 677b04a + d1cd25a commit f9c487f

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

Diff for: gen-schema-bundled.mjs

+8-8
Original file line numberDiff line numberDiff line change
@@ -41438,7 +41438,7 @@ var gqlToPursMainSchemaCode = function(v) {
4143841438
return notNullTypeToPurs(v1.value0);
4143941439
}
4144041440
;
41441-
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 445, column 16 - line 448, column 72): " + [v1.constructor.name]);
41441+
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 432, column 16 - line 435, column 72): " + [v1.constructor.name]);
4144241442
};
4144341443
var notNullTypeToPurs = function(v1) {
4144441444
if (v1 instanceof NonNullType_NamedType) {
@@ -41449,7 +41449,7 @@ var gqlToPursMainSchemaCode = function(v) {
4144941449
return listTypeToPurs(v1.value0);
4145041450
}
4145141451
;
41452-
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 459, column 23 - line 461, column 51): " + [v1.constructor.name]);
41452+
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 446, column 23 - line 448, column 51): " + [v1.constructor.name]);
4145341453
};
4145441454
var listTypeToPursNullable = function(t) {
4145541455
return wrapMaybe(listTypeToPurs(t));
@@ -41507,7 +41507,7 @@ var gqlToPursMainSchemaCode = function(v) {
4150741507
return wrapNotNull2(argNotNullTypeToPurs2(v1.value0));
4150841508
}
4150941509
;
41510-
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 427, column 19 - line 430, column 89): " + [v1.constructor.name]);
41510+
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 414, column 19 - line 417, column 89): " + [v1.constructor.name]);
4151141511
};
4151241512
var argNotNullTypeToPurs2 = function(v1) {
4151341513
if (v1 instanceof NonNullType_NamedType) {
@@ -41518,7 +41518,7 @@ var gqlToPursMainSchemaCode = function(v) {
4151841518
return argListTypeToPurs2(v1.value0);
4151941519
}
4152041520
;
41521-
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 433, column 26 - line 435, column 54): " + [v1.constructor.name]);
41521+
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 420, column 26 - line 422, column 54): " + [v1.constructor.name]);
4152241522
};
4152341523
var argListTypeToPurs2 = function(v1) {
4152441524
return "(Array " + (argTypeToPurs2(v1) + ")");
@@ -41543,7 +41543,7 @@ var gqlToPursMainSchemaCode = function(v) {
4154341543
return v2.value0.moduleName + ("." + v2.value0.typeName);
4154441544
}
4154541545
;
41546-
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 416, column 10 - line 421, column 53): " + [v2.constructor.name]);
41546+
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 403, column 10 - line 408, column 53): " + [v2.constructor.name]);
4154741547
}()));
4154841548
};
4154941549
};
@@ -41556,7 +41556,7 @@ var gqlToPursMainSchemaCode = function(v) {
4155641556
var tName = typeName_(v1.name);
4155741557
return docComment3(v1.description) + ("newtype " + (tName + (" = " + (tName + (maybe("{}")(function(v2) {
4155841558
return inputValueToFieldsDefinitionToPurs(tName)(v2);
41559-
})(v1.inputFieldsDefinition) + ("\nderive instance newtype" + (tName + (" :: Newtype " + (tName + (" _" + ("\ninstance argToGql" + (tName + (" :: (Newtype " + (tName + (" {| p}, RecordArg p a u) => ArgGql " + (tName + " { | a }"))))))))))))))));
41559+
})(v1.inputFieldsDefinition) + ("\nderive instance newtype" + (tName + (" :: Newtype " + (tName + " _")))))))));
4156041560
};
4156141561
var inputValueDefinitionsToPurs3 = function(v1) {
4156241562
return inlineComment2(v1.description) + (safeFieldname(v1.name) + (" :: " + argTypeToPurs2(v1.type)));
@@ -41584,7 +41584,7 @@ var gqlToPursMainSchemaCode = function(v) {
4158441584
return wrapMaybe(v2.value0.moduleName + ("." + v2.value0.typeName));
4158541585
}
4158641586
;
41587-
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 306, column 10 - line 311, column 65): " + [v2.constructor.name]);
41587+
throw new Error("Failed pattern match at GraphQL.Client.CodeGen.Schema (line 299, column 10 - line 304, column 65): " + [v2.constructor.name]);
4158841588
}())));
4158941589
};
4159041590
};
@@ -41597,7 +41597,7 @@ var gqlToPursMainSchemaCode = function(v) {
4159741597
var tName = typeName_(v1.name);
4159841598
return docComment3(v1.description) + function() {
4159941599
if (v.useNewtypesForRecords) {
41600-
return "newtype " + (typeName_(v1.name) + (" = " + (typeName_(v1.name) + (maybe("{}")(fieldsDefinitionToPurs(tName))(v1.fieldsDefinition) + ("\nderive instance newtype" + (tName + (" :: Newtype " + (tName + (" _" + ("\ninstance argToGql" + (tName + (" :: (Newtype " + (tName + (" {| p}, RecordArg p a u) => ArgGql " + (tName + " { | a }")))))))))))))));
41600+
return "newtype " + (typeName_(v1.name) + (" = " + (typeName_(v1.name) + (maybe("{}")(fieldsDefinitionToPurs(tName))(v1.fieldsDefinition) + ("\nderive instance newtype" + (tName + (" :: Newtype " + (tName + " _"))))))));
4160141601
}
4160241602
;
4160341603
return "type " + (typeName_(v1.name) + foldMap6(function(fd) {

Diff for: src/GraphQL/Client/Args.purs

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Data.Bifunctor (class Bifunctor)
66
import Data.Date (Date)
77
import Data.DateTime (DateTime)
88
import Data.Maybe (Maybe)
9+
import Data.Newtype (class Newtype)
910
import Data.Symbol (class IsSymbol)
1011
import Data.Time (Time)
1112
import GraphQL.Client.NullArray (NullArray)
@@ -70,7 +71,8 @@ else instance argToGqlMaybe :: ArgGql param arg => ArgGql param (Maybe arg)
7071
else instance argToGqlArray :: ArgGql param arg => ArgGql (Array param) (Array arg)
7172
else instance argToGqlArrayOne :: ArgGql param arg => ArgGql (Array param) arg
7273
else instance argVar :: ArgGql param arg => ArgGql param (Var sym arg)
73-
74+
else instance argToGqlRecord :: RecordArg p a u => ArgGql { | p } { | a }
75+
else instance argToGqlNewtypeRecord :: (Newtype n {| p}, RecordArg p a u) => ArgGql n { | a }
7476
class IsNotNull :: forall k1 k2. k1 -> k2 -> Constraint
7577
class IsNotNull param arg
7678

@@ -124,7 +126,6 @@ instance argToGqlTime :: ArgGql Time Time
124126

125127
instance argToGqlDateTime :: ArgGql DateTime DateTime
126128

127-
instance argToGqlRecord :: RecordArg p a u => ArgGql { | p } { | a }
128129

129130
class HMapWithIndex (ArgPropToGql p) { | a } u <= RecordArg p a u
130131

Diff for: src/GraphQL/Client/CodeGen/Schema.purs

+1-14
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,6 @@ gqlToPursMainSchemaCode { gqlScalarsToPursTypes, externalTypes, fieldTypeOverrid
270270
<> " :: Newtype "
271271
<> tName
272272
<> " _"
273-
<> "\ninstance argToGql"
274-
<> tName
275-
<> " :: (Newtype "
276-
<> tName
277-
<> " {| p}, RecordArg p a u) => ArgGql "
278-
<> tName
279-
<> " { | a }"
280273
else
281274
"type "
282275
<> typeName_ name
@@ -386,13 +379,7 @@ gqlToPursMainSchemaCode { gqlScalarsToPursTypes, externalTypes, fieldTypeOverrid
386379
<> " :: Newtype "
387380
<> tName
388381
<> " _"
389-
<> "\ninstance argToGql"
390-
<> tName
391-
<> " :: (Newtype "
392-
<> tName
393-
<> " {| p}, RecordArg p a u) => ArgGql "
394-
<> tName
395-
<> " { | a }"
382+
396383

397384
inputValueToFieldsDefinitionToPurs :: String -> List AST.InputValueDefinition -> String
398385
inputValueToFieldsDefinitionToPurs objectName definitions =

0 commit comments

Comments
 (0)