-
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.
OpenAPI arrays use 'minItems', not 'minLength'
- Loading branch information
Showing
19 changed files
with
333 additions
and
80 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/MinItemsOne.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.MinItemsOne | ||
( MinItemsOne(..) | ||
, minItemsOneSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (Eq, Show) | ||
import qualified TestCases.Types.MinItemsOne.MinItemsOneItem as MinItemsOneItem | ||
|
||
newtype MinItemsOne = MinItemsOne (NEL.NonEmpty MinItemsOneItem.MinItemsOneItem) | ||
deriving (Show, Eq) | ||
|
||
minItemsOneSchema :: FC.Fleece schema => schema MinItemsOne | ||
minItemsOneSchema = | ||
FC.coerceSchema (FC.nonEmpty MinItemsOneItem.minItemsOneItemSchema) |
16 changes: 16 additions & 0 deletions
16
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinItemsOne/MinItemsOneItem.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.MinItemsOne.MinItemsOneItem | ||
( MinItemsOneItem(..) | ||
, minItemsOneItemSchema | ||
) where | ||
|
||
import qualified Fleece.Core as FC | ||
import Prelude (Bool, Eq, Show) | ||
|
||
newtype MinItemsOneItem = MinItemsOneItem Bool | ||
deriving (Show, Eq) | ||
|
||
minItemsOneItemSchema :: FC.Fleece schema => schema MinItemsOneItem | ||
minItemsOneItemSchema = | ||
FC.coerceSchema FC.boolean |
23 changes: 23 additions & 0 deletions
23
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinItemsOneInline.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,23 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinItemsOneInline | ||
( MinItemsOneInline(..) | ||
, minItemsOneInlineSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import Fleece.Core ((#+)) | ||
import qualified Fleece.Core as FC | ||
import Prelude (($), Eq, Maybe, Show) | ||
import qualified TestCases.Types.MinItemsOneInline.SomeArrayItem as SomeArrayItem | ||
|
||
data MinItemsOneInline = MinItemsOneInline | ||
{ someArray :: Maybe (NEL.NonEmpty SomeArrayItem.SomeArrayItem) | ||
} | ||
deriving (Eq, Show) | ||
|
||
minItemsOneInlineSchema :: FC.Fleece schema => schema MinItemsOneInline | ||
minItemsOneInlineSchema = | ||
FC.object $ | ||
FC.constructor MinItemsOneInline | ||
#+ FC.optional "someArray" someArray (FC.nonEmpty SomeArrayItem.someArrayItemSchema) |
16 changes: 16 additions & 0 deletions
16
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinItemsOneInline/SomeArrayItem.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.MinItemsOneInline.SomeArrayItem | ||
( SomeArrayItem(..) | ||
, someArrayItemSchema | ||
) where | ||
|
||
import qualified Fleece.Core as FC | ||
import Prelude (Bool, Eq, Show) | ||
|
||
newtype SomeArrayItem = SomeArrayItem Bool | ||
deriving (Show, Eq) | ||
|
||
someArrayItemSchema :: FC.Fleece schema => schema SomeArrayItem | ||
someArrayItemSchema = | ||
FC.coerceSchema FC.boolean |
18 changes: 18 additions & 0 deletions
18
...leece-openapi3/examples/test-cases/TestCases/Types/MinItemsOneInlineArrayNullableOneOf.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.MinItemsOneInlineArrayNullableOneOf | ||
( MinItemsOneInlineArrayNullableOneOf(..) | ||
, minItemsOneInlineArrayNullableOneOfSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (Eq, Show) | ||
import qualified TestCases.Types.MinItemsOneInlineArrayNullableOneOf.MinItemsOneInlineArrayNullableOneOfItem as MinItemsOneInlineArrayNullableOneOfItem | ||
|
||
newtype MinItemsOneInlineArrayNullableOneOf = MinItemsOneInlineArrayNullableOneOf (NEL.NonEmpty MinItemsOneInlineArrayNullableOneOfItem.MinItemsOneInlineArrayNullableOneOfItem) | ||
deriving (Show, Eq) | ||
|
||
minItemsOneInlineArrayNullableOneOfSchema :: FC.Fleece schema => schema MinItemsOneInlineArrayNullableOneOf | ||
minItemsOneInlineArrayNullableOneOfSchema = | ||
FC.coerceSchema (FC.nonEmpty MinItemsOneInlineArrayNullableOneOfItem.minItemsOneInlineArrayNullableOneOfItemSchema) |
23 changes: 23 additions & 0 deletions
23
...ases/Types/MinItemsOneInlineArrayNullableOneOf/MinItemsOneInlineArrayNullableOneOfItem.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,23 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinItemsOneInlineArrayNullableOneOf.MinItemsOneInlineArrayNullableOneOfItem | ||
( MinItemsOneInlineArrayNullableOneOfItem(..) | ||
, minItemsOneInlineArrayNullableOneOfItemSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (($), Bool, Either, Eq, Show) | ||
import qualified Shrubbery as Shrubbery | ||
|
||
newtype MinItemsOneInlineArrayNullableOneOfItem = MinItemsOneInlineArrayNullableOneOfItem (Shrubbery.Union | ||
'[ Either FC.Null (NEL.NonEmpty Bool) | ||
]) | ||
deriving (Show, Eq) | ||
|
||
minItemsOneInlineArrayNullableOneOfItemSchema :: FC.Fleece schema => schema MinItemsOneInlineArrayNullableOneOfItem | ||
minItemsOneInlineArrayNullableOneOfItemSchema = | ||
FC.coerceSchema $ | ||
FC.unionNamed (FC.qualifiedName "TestCases.Types.MinItemsOneInlineArrayNullableOneOf.MinItemsOneInlineArrayNullableOneOfItem" "MinItemsOneInlineArrayNullableOneOfItem") $ | ||
FC.unionMember (FC.nullable (FC.nonEmpty FC.boolean)) |
18 changes: 18 additions & 0 deletions
18
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinItemsOneInlineArrayOneOf.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.MinItemsOneInlineArrayOneOf | ||
( MinItemsOneInlineArrayOneOf(..) | ||
, minItemsOneInlineArrayOneOfSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (Eq, Show) | ||
import qualified TestCases.Types.MinItemsOneInlineArrayOneOf.MinItemsOneInlineArrayOneOfItem as MinItemsOneInlineArrayOneOfItem | ||
|
||
newtype MinItemsOneInlineArrayOneOf = MinItemsOneInlineArrayOneOf (NEL.NonEmpty MinItemsOneInlineArrayOneOfItem.MinItemsOneInlineArrayOneOfItem) | ||
deriving (Show, Eq) | ||
|
||
minItemsOneInlineArrayOneOfSchema :: FC.Fleece schema => schema MinItemsOneInlineArrayOneOf | ||
minItemsOneInlineArrayOneOfSchema = | ||
FC.coerceSchema (FC.nonEmpty MinItemsOneInlineArrayOneOfItem.minItemsOneInlineArrayOneOfItemSchema) |
23 changes: 23 additions & 0 deletions
23
...test-cases/TestCases/Types/MinItemsOneInlineArrayOneOf/MinItemsOneInlineArrayOneOfItem.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,23 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinItemsOneInlineArrayOneOf.MinItemsOneInlineArrayOneOfItem | ||
( MinItemsOneInlineArrayOneOfItem(..) | ||
, minItemsOneInlineArrayOneOfItemSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (($), Bool, Eq, Show) | ||
import qualified Shrubbery as Shrubbery | ||
|
||
newtype MinItemsOneInlineArrayOneOfItem = MinItemsOneInlineArrayOneOfItem (Shrubbery.Union | ||
'[ (NEL.NonEmpty Bool) | ||
]) | ||
deriving (Show, Eq) | ||
|
||
minItemsOneInlineArrayOneOfItemSchema :: FC.Fleece schema => schema MinItemsOneInlineArrayOneOfItem | ||
minItemsOneInlineArrayOneOfItemSchema = | ||
FC.coerceSchema $ | ||
FC.unionNamed (FC.qualifiedName "TestCases.Types.MinItemsOneInlineArrayOneOf.MinItemsOneInlineArrayOneOfItem" "MinItemsOneInlineArrayOneOfItem") $ | ||
FC.unionMember (FC.nonEmpty FC.boolean) |
23 changes: 23 additions & 0 deletions
23
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinItemsOneInlineObjectOneOf.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,23 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinItemsOneInlineObjectOneOf | ||
( MinItemsOneInlineObjectOneOf(..) | ||
, minItemsOneInlineObjectOneOfSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import Fleece.Core ((#+)) | ||
import qualified Fleece.Core as FC | ||
import Prelude (($), Eq, Maybe, Show) | ||
import qualified TestCases.Types.MinItemsOneInlineObjectOneOf.SomeArrayItem as SomeArrayItem | ||
|
||
data MinItemsOneInlineObjectOneOf = MinItemsOneInlineObjectOneOf | ||
{ someArray :: Maybe (NEL.NonEmpty SomeArrayItem.SomeArrayItem) | ||
} | ||
deriving (Eq, Show) | ||
|
||
minItemsOneInlineObjectOneOfSchema :: FC.Fleece schema => schema MinItemsOneInlineObjectOneOf | ||
minItemsOneInlineObjectOneOfSchema = | ||
FC.object $ | ||
FC.constructor MinItemsOneInlineObjectOneOf | ||
#+ FC.optional "someArray" someArray (FC.nonEmpty SomeArrayItem.someArrayItemSchema) |
23 changes: 23 additions & 0 deletions
23
...penapi3/examples/test-cases/TestCases/Types/MinItemsOneInlineObjectOneOf/SomeArrayItem.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,23 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module TestCases.Types.MinItemsOneInlineObjectOneOf.SomeArrayItem | ||
( SomeArrayItem(..) | ||
, someArrayItemSchema | ||
) where | ||
|
||
import qualified Data.List.NonEmpty as NEL | ||
import qualified Fleece.Core as FC | ||
import Prelude (($), Bool, Eq, Show) | ||
import qualified Shrubbery as Shrubbery | ||
|
||
newtype SomeArrayItem = SomeArrayItem (Shrubbery.Union | ||
'[ (NEL.NonEmpty Bool) | ||
]) | ||
deriving (Show, Eq) | ||
|
||
someArrayItemSchema :: FC.Fleece schema => schema SomeArrayItem | ||
someArrayItemSchema = | ||
FC.coerceSchema $ | ||
FC.unionNamed (FC.qualifiedName "TestCases.Types.MinItemsOneInlineObjectOneOf.SomeArrayItem" "SomeArrayItem") $ | ||
FC.unionMember (FC.nonEmpty FC.boolean) |
18 changes: 0 additions & 18 deletions
18
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinLengthOne.hs
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
json-fleece-openapi3/examples/test-cases/TestCases/Types/MinLengthOne/MinLengthOneItem.hs
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.