morpheus-graphql 0.1.0 → 0.1.1
raw patch · 2 files changed
+14/−11 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
morpheus-graphql.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 4207df71e3ee77e9ae54b225cd5b0f2186ae77d3da256bd79d9856c5c51f0151+-- hash: fe81f2e1d1a7d86ae0559141dda5d0e6bc1749b212b11ce0ba37b9f020b58e48 name: morpheus-graphql-version: 0.1.0+version: 0.1.1 synopsis: Morpheus GraphQL description: Build GraphQL APIs with your favourite functional language! category: web, graphql
src/Data/Morpheus/Resolve/Operator.hs view
@@ -70,7 +70,7 @@ where querySchema _ = resolveTypes queryType (schemaTypes : types) where- queryType = initTypeLib (operatorType "Query" (hiddenRootFields ++ fields))+ queryType = initTypeLib (operatorType (hiddenRootFields ++ fields) "Query") (fields, types) = unzip $ objectFieldTypes (Proxy @(Rep a)) mutationSchema ::@@ -79,8 +79,8 @@ -> TypeUpdater mutationSchema _ initialType = resolveTypes mutationType types' where- mutationType = initialType {mutation = Just $ operatorType "Mutation" fields'}- (fields', types') = unzip $ objectFieldTypes (Proxy :: Proxy (Rep a))+ mutationType = initialType {mutation = maybeOperator fields "Mutation"}+ (fields, types') = unzip $ objectFieldTypes (Proxy :: Proxy (Rep a)) subscriptionSchema :: forall a m. IntroCon a@@ -88,10 +88,13 @@ -> TypeUpdater subscriptionSchema _ initialType = resolveTypes mutationType types' where- mutationType = initialType {subscription = Just $ operatorType "Subscription" fields'}- (fields', types') = unzip $ objectFieldTypes (Proxy :: Proxy (Rep a))+ mutationType = initialType {subscription = maybeOperator fields "Subscription"}+ (fields, types') = unzip $ objectFieldTypes (Proxy :: Proxy (Rep a)) -operatorType :: Text -> a -> (Text, DataType a)-operatorType name' fields' =- ( name'- , DataType {typeData = fields', typeName = name', typeFingerprint = SystemFingerprint name', typeDescription = ""})+maybeOperator :: [a] -> Text -> Maybe (Text, DataType [a])+maybeOperator [] = const Nothing+maybeOperator fields = Just . operatorType fields++operatorType :: [a] -> Text -> (Text, DataType [a])+operatorType typeData typeName =+ (typeName, DataType {typeData, typeName, typeFingerprint = SystemFingerprint typeName, typeDescription = ""})