-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Convert an OpenAPI specification to a Dhall package
--
-- This package provides an `openapi-to-dhall` program that converts an
-- OpenAPI specification to a Dhall package containing types, defaults,
-- and schemas for that API.
@package dhall-openapi
@version 1.0.4
module Dhall.Kubernetes.Types
type Expr = Expr Src Import
type DuplicateHandler = (Text, [ModelName]) -> Maybe ModelName
type Prefix = Text
type ModelHierarchy = [ModelName]
-- | Type for the Swagger specification.
--
-- There is such a type defined in the swagger2 package, but
-- Kubernetes' OpenAPI file doesn't conform to that, so here we implement
-- a small version of that tailored to our needs.
data Swagger
Swagger :: Map ModelName Definition -> Swagger
[$sel:definitions:Swagger] :: Swagger -> Map ModelName Definition
data Definition
Definition :: Maybe Text -> Maybe Ref -> Maybe Text -> Maybe Scientific -> Maybe Bool -> Maybe Scientific -> Maybe Bool -> Maybe Text -> Maybe Definition -> Maybe (Map ModelName Definition) -> Maybe Definition -> Maybe (Set FieldName) -> Maybe BaseData -> Maybe Bool -> Definition
[$sel:typ:Definition] :: Definition -> Maybe Text
[$sel:ref:Definition] :: Definition -> Maybe Ref
[$sel:format:Definition] :: Definition -> Maybe Text
[$sel:minimum_:Definition] :: Definition -> Maybe Scientific
[$sel:exclusiveMinimum:Definition] :: Definition -> Maybe Bool
[$sel:maximum_:Definition] :: Definition -> Maybe Scientific
[$sel:exclusiveMaximum:Definition] :: Definition -> Maybe Bool
[$sel:description:Definition] :: Definition -> Maybe Text
[$sel:items:Definition] :: Definition -> Maybe Definition
[$sel:properties:Definition] :: Definition -> Maybe (Map ModelName Definition)
[$sel:additionalProperties:Definition] :: Definition -> Maybe Definition
[$sel:required:Definition] :: Definition -> Maybe (Set FieldName)
[$sel:baseData:Definition] :: Definition -> Maybe BaseData
[$sel:intOrString:Definition] :: Definition -> Maybe Bool
newtype Ref
Ref :: Text -> Ref
[$sel:unRef:Ref] :: Ref -> Text
newtype ModelName
ModelName :: Text -> ModelName
[$sel:unModelName:ModelName] :: ModelName -> Text
newtype FieldName
FieldName :: Text -> FieldName
[$sel:unFieldName:FieldName] :: FieldName -> Text
-- | This contains the static data that a Model might have
--
-- This applies only to kubernetes resources where
-- `$sel:kind:BaseData` and `$sel:apiVersion:BaseData` are
-- statically determined by the resource. See the `Kubernetes OpenAPI
-- Spec Readme`:
-- https:/github.comkuberneteskubernetesblobmasterapiopenapi-specREADME.md#x-kubernetes-group-version-kind
--
-- For example for a v1 Deployment we have
--
-- { kind = Deployment , apiVersion = "apps/v1" }
data BaseData
BaseData :: Text -> Text -> BaseData
[$sel:kind:BaseData] :: BaseData -> Text
[$sel:apiVersion:BaseData] :: BaseData -> Text
instance GHC.Classes.Eq Dhall.Kubernetes.Types.Ref
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Types.Ref
instance GHC.Show.Show Dhall.Kubernetes.Types.Ref
instance GHC.Generics.Generic Dhall.Kubernetes.Types.Ref
instance Prettyprinter.Internal.Pretty Dhall.Kubernetes.Types.ModelName
instance GHC.Classes.Eq Dhall.Kubernetes.Types.ModelName
instance Data.Aeson.Types.FromJSON.FromJSONKey Dhall.Kubernetes.Types.ModelName
instance GHC.Classes.Ord Dhall.Kubernetes.Types.ModelName
instance GHC.Show.Show Dhall.Kubernetes.Types.ModelName
instance GHC.Generics.Generic Dhall.Kubernetes.Types.ModelName
instance Prettyprinter.Internal.Pretty Dhall.Kubernetes.Types.FieldName
instance GHC.Classes.Eq Dhall.Kubernetes.Types.FieldName
instance GHC.Classes.Ord Dhall.Kubernetes.Types.FieldName
instance Data.Aeson.Types.FromJSON.FromJSONKey Dhall.Kubernetes.Types.FieldName
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Types.FieldName
instance GHC.Show.Show Dhall.Kubernetes.Types.FieldName
instance GHC.Generics.Generic Dhall.Kubernetes.Types.FieldName
instance GHC.Classes.Eq Dhall.Kubernetes.Types.BaseData
instance GHC.Show.Show Dhall.Kubernetes.Types.BaseData
instance GHC.Generics.Generic Dhall.Kubernetes.Types.BaseData
instance GHC.Classes.Eq Dhall.Kubernetes.Types.Definition
instance GHC.Show.Show Dhall.Kubernetes.Types.Definition
instance GHC.Generics.Generic Dhall.Kubernetes.Types.Definition
instance GHC.Show.Show Dhall.Kubernetes.Types.Swagger
instance GHC.Generics.Generic Dhall.Kubernetes.Types.Swagger
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Types.Swagger
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Types.Definition
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Types.BaseData
module Dhall.Kubernetes.Data
-- | This just removes the offending keys from the definition
patchCyclicImports :: Definition -> Definition
module Dhall.Kubernetes.Convert
-- | Converts all the Swagger definitions to Dhall Types
--
-- Note: we cannot do 1-to-1 conversion and we need the whole Map because
-- many types reference other types so we need to access them to decide
-- things like "should this key be optional"
toTypes :: Map Prefix Import -> ([ModelName] -> Definition -> Maybe ModelName) -> Bool -> [(String, String)] -> Map ModelName Definition -> Map ModelName Expr
-- | Convert a Dhall Type to its default value
toDefault :: Map Prefix Import -> Map ModelName Definition -> ModelName -> Expr -> Maybe Expr
-- | Get a Dhall.Map filled with imports, for creating giant Records or
-- Unions of types or defaults
getImportsMap :: Map Prefix Import -> DuplicateHandler -> [ModelName] -> Text -> [ModelName] -> Map Text Expr
-- | Build an import from path components (note: they need to be in reverse
-- order) and a filename
mkImport :: Map Prefix Import -> [Text] -> Text -> Import
toDefinition :: V1CustomResourceDefinition -> Either Text (ModelName, Definition)
-- | Given the pathsAndModels Map provides a function to be used
-- with toTypes to split types at mostly arbitrary points
--
-- The pathsAndModels argument takes the form of a path to an
-- optional ModelName. Paths are of the format noted by
-- modelsToPath. If a ModelName is provided as a value
-- for the given path, it will be returned (to be then used as the
-- ModelName for the nested definition. If no ModelName is
-- provided, guessModelNameForSplit will try to guess. If that
-- fails, Nothing will be returned such that no split will be done
-- by toTypes
--
-- Currently not all split points in for nested definitions are supported
-- (in fact only types with a properties attribute are currently
-- supported).
pathSplitter :: Map ModelHierarchy (Maybe ModelName) -> ModelHierarchy -> Definition -> Maybe ModelName
instance GHC.Generics.Generic Dhall.Kubernetes.Convert.V1CustomResourceDefinitionNames
instance GHC.Generics.Generic Dhall.Kubernetes.Convert.V1JSONSchemaProps
instance GHC.Generics.Generic Dhall.Kubernetes.Convert.V1CustomResourceValidation
instance GHC.Generics.Generic Dhall.Kubernetes.Convert.V1CustomResourceDefinitionVersion
instance GHC.Generics.Generic Dhall.Kubernetes.Convert.V1CustomResourceDefinitionSpec
instance GHC.Generics.Generic Dhall.Kubernetes.Convert.V1CustomResourceDefinition
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Convert.V1CustomResourceDefinition
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Convert.V1CustomResourceDefinitionSpec
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Convert.V1CustomResourceDefinitionVersion
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Convert.V1CustomResourceValidation
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Convert.V1JSONSchemaProps
instance Data.Aeson.Types.FromJSON.FromJSON Dhall.Kubernetes.Convert.V1CustomResourceDefinitionNames