@@ -401,9 +401,39 @@ data ProposalResponse
401401 , proposalResponseCcAbstainVotes :: Integer
402402 , proposalResponsePrevGovActionIndex :: Maybe Integer
403403 , proposalResponsePrevGovActionTxHash :: Maybe HexText
404+ , proposalResponseAuthors :: Maybe ProposalAuthors
404405 }
405406 deriving (Generic , Show )
406407
408+ newtype ProposalAuthors = ProposalAuthors { getProposalAuthors :: Value }
409+ deriving newtype (Show )
410+
411+ instance FromJSON ProposalAuthors where
412+ parseJSON v@ (Array _) = pure $ ProposalAuthors v
413+ parseJSON _ = fail " ProposalAuthors must be a JSON array"
414+
415+ instance ToJSON ProposalAuthors where
416+ toJSON (ProposalAuthors v) = v
417+
418+ instance ToSchema ProposalAuthors where
419+ declareNamedSchema _ = pure $ NamedSchema (Just " ProposalAuthors" ) $ mempty
420+ & type_ ?~ OpenApiArray
421+ & description ?~ " A JSON array of proposal authors"
422+ & example ?~ toJSON
423+ [ object
424+ [ " name" .= (" Alice" :: Text )
425+ , " witness_algorithm" .= (" algo" :: Text )
426+ , " public_key" .= (" key" :: Text )
427+ , " signature" .= (" sig" :: Text )
428+ ]
429+ , object
430+ [ " name" .= (" Bob" :: Text )
431+ , " witness_algorithm" .= (" algo2" :: Text )
432+ , " public_key" .= (" key2" :: Text )
433+ , " signature" .= (" sig2" :: Text )
434+ ]
435+ ]
436+
407437deriveJSON (jsonOptions " proposalResponse" ) ''ProposalResponse
408438
409439exampleProposalResponse :: Text
0 commit comments