mirror of
https://github.com/NorfairKing/autodocodec.git
synced 2024-08-17 18:30:30 +03:00
opt-env-conf upgrades
This commit is contained in:
parent
ef4a7cc685
commit
3785aaf884
@ -48,14 +48,14 @@ data JSONSchema
|
||||
| ArraySchema !JSONSchema
|
||||
| MapSchema !JSONSchema
|
||||
| -- | This needs to be a list because keys should stay in their original ordering.
|
||||
ObjectSchema ObjectSchema
|
||||
ObjectSchema !ObjectSchema
|
||||
| ValueSchema !JSON.Value
|
||||
| AnyOfSchema !(NonEmpty JSONSchema)
|
||||
| OneOfSchema !(NonEmpty JSONSchema)
|
||||
| CommentSchema !Text !JSONSchema
|
||||
| RefSchema !Text
|
||||
| WithDefSchema !(Map Text JSONSchema) !JSONSchema
|
||||
deriving (Show, Eq, Generic)
|
||||
deriving (Show, Eq, Ord, Generic)
|
||||
|
||||
instance Validity JSONSchema where
|
||||
validate js =
|
||||
@ -167,7 +167,7 @@ data ObjectSchema
|
||||
| ObjectAnyOfSchema !(NonEmpty ObjectSchema)
|
||||
| ObjectOneOfSchema !(NonEmpty ObjectSchema)
|
||||
| ObjectAllOfSchema !(NonEmpty ObjectSchema)
|
||||
deriving (Show, Eq, Generic)
|
||||
deriving (Show, Eq, Ord, Generic)
|
||||
|
||||
instance Validity ObjectSchema
|
||||
|
||||
@ -304,7 +304,7 @@ validateAccordingTo val schema = (`evalState` M.empty) $ go val schema
|
||||
data KeyRequirement
|
||||
= Required
|
||||
| Optional !(Maybe JSON.Value) -- Default value
|
||||
deriving (Show, Eq, Generic)
|
||||
deriving (Show, Eq, Ord, Generic)
|
||||
|
||||
instance Validity KeyRequirement
|
||||
|
||||
|
@ -44,7 +44,6 @@ library
|
||||
, safe-coloured-text >=0.2.0.0
|
||||
, scientific
|
||||
, text
|
||||
, unordered-containers
|
||||
, vector
|
||||
, yaml
|
||||
default-language: Haskell2010
|
||||
|
@ -1,6 +1,6 @@
|
||||
{ mkDerivation, autodocodec, autodocodec-schema, base, bytestring
|
||||
, containers, lib, path, path-io, safe-coloured-text, scientific
|
||||
, text, unordered-containers, vector, yaml
|
||||
, text, vector, yaml
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "autodocodec-yaml";
|
||||
@ -8,8 +8,7 @@ mkDerivation {
|
||||
src = ./.;
|
||||
libraryHaskellDepends = [
|
||||
autodocodec autodocodec-schema base bytestring containers path
|
||||
path-io safe-coloured-text scientific text unordered-containers
|
||||
vector yaml
|
||||
path-io safe-coloured-text scientific text vector yaml
|
||||
];
|
||||
homepage = "https://github.com/NorfairKing/autodocodec#readme";
|
||||
description = "Autodocodec interpreters for yaml";
|
||||
|
@ -26,6 +26,5 @@ library:
|
||||
- safe-coloured-text >=0.2.0.0
|
||||
- scientific
|
||||
- text
|
||||
- unordered-containers
|
||||
- vector
|
||||
- yaml
|
||||
|
@ -17,6 +17,7 @@ module Autodocodec.Yaml
|
||||
schemaChunksViaCodec,
|
||||
schemaChunksVia,
|
||||
jsonSchemaChunks,
|
||||
jsonSchemaChunkLines,
|
||||
|
||||
-- * Instantiating @ToYaml@
|
||||
toYamlViaCodec,
|
||||
|
@ -46,7 +46,11 @@ schemaChunksVia = jsonSchemaChunks . jsonSchemaVia
|
||||
|
||||
-- | Render a 'JSONSchema' as 'Chunk's
|
||||
jsonSchemaChunks :: JSONSchema -> [Chunk]
|
||||
jsonSchemaChunks = concatMap (\l -> l ++ ["\n"]) . go
|
||||
jsonSchemaChunks = unlinesChunks . jsonSchemaChunkLines
|
||||
|
||||
-- | Render a 'JSONSchema' as lines of 'Chunk's
|
||||
jsonSchemaChunkLines :: JSONSchema -> [[Chunk]]
|
||||
jsonSchemaChunkLines = go
|
||||
where
|
||||
indent :: [[Chunk]] -> [[Chunk]]
|
||||
indent = map (" " :)
|
||||
|
@ -266,7 +266,7 @@ data NumberBounds = NumberBounds
|
||||
{ numberBoundsLower :: !Scientific,
|
||||
numberBoundsUpper :: !Scientific
|
||||
}
|
||||
deriving (Show, Eq, Generic)
|
||||
deriving (Show, Eq, Ord, Generic)
|
||||
|
||||
instance Validity NumberBounds
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user