Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created January 22, 2016 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codedmart/9f36412b683f5b76cad9 to your computer and use it in GitHub Desktop.
Save codedmart/9f36412b683f5b76cad9 to your computer and use it in GitHub Desktop.
data Filters = Filters
{ logicalOperator :: Text
, conditions :: [Condition | Filters]
} deriving (Show, Eq, Generic)
instance ToJSON Filters where
toJSON = genericToJSON $ aesonDrop 0 snakeCase
instance FromJSON Filters where
parseJSON = genericParseJSON $ aesonDrop 0 snakeCase
data Condition = Condition
{ path :: Text
, relation :: Text
, values :: [Value]
} deriving (Show, Eq, Generic)
instance ToJSON Condition where
toJSON = genericToJSON defaultOptions
instance FromJSON Condition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment