graphql-engine/server/src-dc-api/Hasura/Backends/DataConnector/API/V0/Schema.hs
David Overton 6586053296 Gdw 85/capabilities endpoint
>

## Description ✍️

- Creates a new `/capabilities` endpoint for the GDC agent API
- Removes capabilities from the `/schema` endpoint
- Removes the `/config-schema` endpoint and includes the `ConfigSchemaResponse` within the `CapabilitiesResponse`

### Related Issues ✍
->

https://hasurahq.atlassian.net/browse/GDW-85

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4478
GitOrigin-RevId: 426662ee9e751343d94207d439a5025df65d2de7
2022-06-03 08:08:23 +00:00

34 lines
1021 B
Haskell

{-# LANGUAGE DeriveAnyClass #-}
module Hasura.Backends.DataConnector.API.V0.Schema
( SchemaResponse (..),
)
where
import Autodocodec
import Control.DeepSeq (NFData)
import Data.Aeson (FromJSON, ToJSON)
import Data.Data (Data)
import Data.Hashable (Hashable)
import Data.OpenApi (ToSchema)
import GHC.Generics (Generic)
import Hasura.Backends.DataConnector.API.V0.Table qualified as API.V0
import Prelude
--------------------------------------------------------------------------------
-- Schema Response
-- | The Schema Response provides the schemas for tracked tables and
-- 'Capabilities' supported by the service.
newtype SchemaResponse = SchemaResponse
{ srTables :: [API.V0.TableInfo]
}
deriving stock (Eq, Ord, Show, Generic, Data)
deriving anyclass (NFData, Hashable)
deriving (FromJSON, ToJSON, ToSchema) via Autodocodec SchemaResponse
instance HasCodec SchemaResponse where
codec =
object "SchemaResponse" $
SchemaResponse <$> requiredField "tables" "Available tables" .= srTables