mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-20 23:17:30 +03:00
make the arguments field optional in ActionDefinition (#4285)
This commit is contained in:
parent
2b2145d024
commit
a07a87066e
@ -91,7 +91,7 @@ ActionDefinition
|
||||
- Schema
|
||||
- Description
|
||||
* - arguments
|
||||
- true
|
||||
- false
|
||||
- Array of InputArgument_
|
||||
- Input arguments
|
||||
* - output_type
|
||||
|
@ -487,12 +487,11 @@ replaceMetadataToOrdJSON ( ReplaceMetadata
|
||||
actionDefinitionToOrdJSON (ActionDefinition args outputType kind headers frwrdClientHdrs handler) =
|
||||
AO.object $ [ ("kind", AO.toOrdered kind)
|
||||
, ("handler", AO.toOrdered handler)
|
||||
, ("arguments", AO.array $ map argDefinitionToOrdJSON args)
|
||||
, ("output_type", AO.toOrdered outputType)
|
||||
]
|
||||
<> [("forward_client_headers", AO.toOrdered frwrdClientHdrs) | frwrdClientHdrs]
|
||||
<> catMaybes [ listToMaybeOrdPair "headers" AO.toOrdered headers
|
||||
]
|
||||
, listToMaybeOrdPair "arguments" argDefinitionToOrdJSON args]
|
||||
where
|
||||
argDefinitionToOrdJSON :: ArgumentDefinition -> AO.Value
|
||||
argDefinitionToOrdJSON (ArgumentDefinition argName ty descM) =
|
||||
|
@ -103,7 +103,7 @@ $(J.deriveToJSON (J.aesonDrop 3 J.snakeCase) ''ActionDefinition)
|
||||
instance (J.FromJSON a) => J.FromJSON (ActionDefinition a) where
|
||||
parseJSON = J.withObject "ActionDefinition" $ \o ->
|
||||
ActionDefinition
|
||||
<$> o J..: "arguments"
|
||||
<$> o J..:? "arguments" J..!= []
|
||||
<*> o J..: "output_type"
|
||||
<*> o J..:? "kind" J..!= ActionSynchronous -- Synchronous is default action kind
|
||||
<*> o J..:? "headers" J..!= []
|
||||
|
Loading…
Reference in New Issue
Block a user