hunk.code_window:                       , ("output_type", AO.toOrdered outputType)
                         ]
             <> [("forward_client_headers", AO.toOrdered frwrdClientHdrs) | frwrdClientHdrs]
             <> catMaybes [ listToMaybeOrdPair "headers" AO.toOrdered headers
                          ]
             where
               argDefinitionToOrdJSON :: ArgumentDefinition -> AO.Value
               argDefinitionToOrdJSON (ArgumentDefinition argName ty descM) =
  
hunk.labels: keep keep keep keep replace keep keep keep
hunk.after_edit:                        , listToMaybeOrdPair "arguments" argDefinitionToOrdJSON args]
  
hunk.file_path: server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs
hunk.type: replace
file: module Hasura.RQL.MetadataSpec (spec) where
  
  import           Hasura.Prelude
  
  import qualified Data.Aeson.Ordered                as AO
  
  import           Data.Aeson                        (eitherDecodeStrict)
  import           Test.Hspec
  import           Test.QuickCheck
  
  import           Hasura.EncJSON
  import           Hasura.RQL.DDL.Metadata.Generator (genReplaceMetadata)
  import           Hasura.RQL.DDL.Metadata.Types     (ReplaceMetadata, replaceMetadataToOrdJSON)
  
  spec :: Spec
  spec = describe "replaceMetadataToOrdJSON" $ do
    it "produces JSON that can be parsed by the FromJSON instance for ReplaceMetadata" $
      withMaxSuccess 30 $
      forAll (resize 3 genReplaceMetadata) $ \metadata ->
        let encodedString = encJToBS $ AO.toEncJSON $ replaceMetadataToOrdJSON metadata
        in case eitherDecodeStrict @ReplaceMetadata encodedString of
             Left err -> counterexample err False
             Right _  -> property True
  