Skip to content

Commit

Permalink
Exercise minItems/NonEmpty in golden tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Apr 1, 2024
1 parent a89d27d commit 325816a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions specifications/z_complex_self_made_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ components:
type: string
enum:
- xxx
Test10:
type: array
items:
type: string
minItems: 1
CoverType:
type: object
properties:
Expand All @@ -382,6 +387,7 @@ components:
- $ref: '#/components/schemas/Test7'
- $ref: '#/components/schemas/Test8'
- $ref: '#/components/schemas/Test9'
- $ref: '#/components/schemas/Test10'
parameters:
PetParameters:
name: petId
Expand Down
5 changes: 5 additions & 0 deletions testing/golden-output/src/OpenAPI/TypeAlias.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ type Test3 = Data.Aeson.Types.Internal.Object
--
type Test2 = [Data.Text.Internal.Text]

-- | Defines an alias for the schema located at @components.schemas.Test10@ in the specification.
--
--
type Test10 = GHC.Base.NonEmpty Data.Text.Internal.Text

-- | Defines an alias for the schema located at @components.schemas.Test@ in the specification.
--
--
Expand Down
6 changes: 4 additions & 2 deletions testing/golden-output/src/OpenAPI/Types/CoverType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ data CoverTypeCoverVariants =
| CoverTypeCoverTest7 Test7
| CoverTypeCoverTest8 Test8
| CoverTypeCoverTest9 Test9
| CoverTypeCoverTest10 Test10
deriving (GHC.Show.Show, GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON CoverTypeCoverVariants
where {toJSON (CoverTypeCoverPetByAge a) = Data.Aeson.Types.ToJSON.toJSON a;
Expand All @@ -82,8 +83,9 @@ instance Data.Aeson.Types.ToJSON.ToJSON CoverTypeCoverVariants
toJSON (CoverTypeCoverTest6 a) = Data.Aeson.Types.ToJSON.toJSON a;
toJSON (CoverTypeCoverTest7 a) = Data.Aeson.Types.ToJSON.toJSON a;
toJSON (CoverTypeCoverTest8 a) = Data.Aeson.Types.ToJSON.toJSON a;
toJSON (CoverTypeCoverTest9 a) = Data.Aeson.Types.ToJSON.toJSON a}
toJSON (CoverTypeCoverTest9 a) = Data.Aeson.Types.ToJSON.toJSON a;
toJSON (CoverTypeCoverTest10 a) = Data.Aeson.Types.ToJSON.toJSON a}
instance Data.Aeson.Types.FromJSON.FromJSON CoverTypeCoverVariants
where {parseJSON val = case (CoverTypeCoverPetByAge Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverMischling Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest2 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest3 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest4 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest5 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest6 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest7 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest8 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest9 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched")))))))))) of
where {parseJSON val = case (CoverTypeCoverPetByAge Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverMischling Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest2 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest3 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest4 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest5 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest6 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest7 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest8 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest9 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest10 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched"))))))))))) of
{Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a;
Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a}}

0 comments on commit 325816a

Please sign in to comment.