Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module exports an OpenAPI specification for the GraphQL Engine metadata API.
The OpenAPI specification for metadata is experimental and incomplete. Please do not incorporate it into essential workflows at this time.
Synopsis
- metadataOpenAPI :: OpenApi
- openApiSchemas :: [NamedSchema]
- applySchemaName :: NamedSchema -> (Text, Schema)
- toNamedSchema :: HasCodec a => Proxy a -> NamedSchema
- toNamedSchemaVia :: JSONCodec a -> Proxy a -> NamedSchema
Documentation
metadataOpenAPI :: OpenApi Source #
An OpenApi document includes "schemas" that describe the data that may be produced or consumed by an API. It can also include "paths" which describe REST endpoints, and the document can include other API metadata. This example only includes schemas.
Throws an error if any schema listed in openApiSchemas
does not have
a name.
The OpenAPI specification for metadata is experimental and incomplete. Please do not incorporate it into essential workflows at this time.
openApiSchemas :: [NamedSchema] Source #
All metadata DTOs should be listed here. Schemas in this list must be
named! Some autodocodec combinators apply names for you, like object
.
Otherwise you can use the named
combinator to apply a name.
As far as I can tell it is necessary to explicitly list all of the data
types that should be included in the OpenApi document with their names. It
would be nice to provide only a top-level type (Metadata
in this case), and
have all of the types referenced by that type included automatically; but
I haven't seen a way to do that.
applySchemaName :: NamedSchema -> (Text, Schema) Source #
Introspect a given NamedSchema
to get its name, and return the
name with the unwrapped schema. (NamedSchema wraps a pair of an
Schema
and an optional name.)
Throws an exception if the named schema has no name. If this happens to you
then use autodocodec's named
combinator to apply a name to your codec.
toNamedSchema :: HasCodec a => Proxy a -> NamedSchema Source #
toNamedSchemaVia :: JSONCodec a -> Proxy a -> NamedSchema Source #