Skip to content

Commit 31fc2d6

Browse files
author
Dan Fithian
committed
Add an example for a newtype in the schema, and output all schemas from the spec in the test
1 parent af76a39 commit 31fc2d6

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

nix/tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let
1111
extraFlags = extraFlags;
1212
};
1313
};
14-
goldenTestCode = generateCode { fileName = "z_complex_self_made_example.yml"; };
14+
goldenTestCode = generateCode { fileName = "z_complex_self_made_example.yml"; extraFlags = [ "--output-all-schemas" ]; };
1515
exampleGeneratedCode = generateCode { fileName = "petstore.yaml"; };
1616
codeForSpecsLevelOne = [
1717
(generateCode { fileName = "google-payment.json"; })

specifications/z_complex_self_made_example.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ components:
393393
- $ref: '#/components/schemas/Test9'
394394
- $ref: '#/components/schemas/Test10'
395395
- $ref: '#/components/schemas/Value'
396+
CatWrapper:
397+
$ref: '#/components/schemas/Cat'
396398
parameters:
397399
PetParameters:
398400
name: petId

testing/golden-output/src/OpenAPI/TypeAlias.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import qualified GHC.Int
3131
import qualified GHC.Show
3232
import qualified GHC.Types
3333
import qualified OpenAPI.Common
34+
import {-# SOURCE #-} OpenAPI.Types.Cat
3435
import {-# SOURCE #-} OpenAPI.Types.Dog
3536

3637

@@ -63,3 +64,8 @@ type Test10 = GHC.Base.NonEmpty Data.Text.Internal.Text
6364
--
6465
--
6566
type Test = Data.Text.Internal.Text
67+
68+
-- | Defines an alias for the schema located at @components.schemas.CatWrapper@ in the specification.
69+
--
70+
--
71+
type CatWrapper = Cat

0 commit comments

Comments
 (0)