Skip to content

Commit

Permalink
Add an example for a newtype in the schema, and output all schemas fr…
Browse files Browse the repository at this point in the history
…om the spec in the test
  • Loading branch information
dfithian committed May 24, 2024
1 parent af76a39 commit 31fc2d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nix/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let
extraFlags = extraFlags;
};
};
goldenTestCode = generateCode { fileName = "z_complex_self_made_example.yml"; };
goldenTestCode = generateCode { fileName = "z_complex_self_made_example.yml"; extraFlags = [ "--output-all-schemas" ]; };
exampleGeneratedCode = generateCode { fileName = "petstore.yaml"; };
codeForSpecsLevelOne = [
(generateCode { fileName = "google-payment.json"; })
Expand Down
2 changes: 2 additions & 0 deletions specifications/z_complex_self_made_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ components:
- $ref: '#/components/schemas/Test9'
- $ref: '#/components/schemas/Test10'
- $ref: '#/components/schemas/Value'
CatWrapper:
$ref: '#/components/schemas/Cat'
parameters:
PetParameters:
name: petId
Expand Down
6 changes: 6 additions & 0 deletions testing/golden-output/src/OpenAPI/TypeAlias.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified OpenAPI.Common
import {-# SOURCE #-} OpenAPI.Types.Cat
import {-# SOURCE #-} OpenAPI.Types.Dog


Expand Down Expand Up @@ -63,3 +64,8 @@ type Test10 = GHC.Base.NonEmpty Data.Text.Internal.Text
--
--
type Test = Data.Text.Internal.Text

-- | Defines an alias for the schema located at @components.schemas.CatWrapper@ in the specification.
--
--
type CatWrapper = Cat

0 comments on commit 31fc2d6

Please sign in to comment.