make the arguments field optional in ActionDefinition (#4285)

This commit is contained in:
Karthikeyan Chinnakonda 2020-04-04 05:51:52 +05:30 committed by GitHub
parent 2b2145d024
commit a07a87066e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View File

@ -91,7 +91,7 @@ ActionDefinition
- Schema
- Description
* - arguments
- true
- false
- Array of InputArgument_
- Input arguments
* - output_type

View File

@ -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) =

View File

@ -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..!= []