-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from flipstone/min-length-makes-non-empty
CodeGen: minLength >= 1 emits NonEmpty
- Loading branch information
Showing
8 changed files
with
86 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinLengthOne.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinLengthOne | ||
( MinLengthOne(..) | ||
, minLengthOneSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (Eq, Show) | ||
import qualified TestCases.Types.MinLengthOne.MinLengthOneItem as MinLengthOneItem | ||
|
||
newtype MinLengthOne = MinLengthOne (NEL.NonEmpty MinLengthOneItem.MinLengthOneItem) | ||
deriving (Show, Eq) | ||
|
||
minLengthOneSchema :: FC.Fleece schema => schema MinLengthOne | ||
minLengthOneSchema = | ||
FC.coerceSchema (FC.nonEmpty MinLengthOneItem.minLengthOneItemSchema) |
16 changes: 16 additions & 0 deletions
16
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinLengthOne/MinLengthOneItem.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinLengthOne.MinLengthOneItem | ||
( MinLengthOneItem(..) | ||
, minLengthOneItemSchema | ||
) where | ||
|
||
import qualified Fleece.Core as FC | ||
import Prelude (Bool, Eq, Show) | ||
|
||
newtype MinLengthOneItem = MinLengthOneItem Bool | ||
deriving (Show, Eq) | ||
|
||
minLengthOneItemSchema :: FC.Fleece schema => schema MinLengthOneItem | ||
minLengthOneItemSchema = | ||
FC.coerceSchema FC.boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters