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