-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathTestGenScript.elm
More file actions
120 lines (99 loc) · 4.96 KB
/
TestGenScript.elm
File metadata and controls
120 lines (99 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
module TestGenScript exposing (run)
import Ansi.Color
import BackendTask
import Cli
import OpenApi.Config
import Pages.Script
{-| Generate various SDKs as test cases, all at once.
This is more than twice as fast as running the generator separately for
each OAS.
-}
run : Pages.Script.Script
run =
let
additionalProperties : OpenApi.Config.Input
additionalProperties =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/additional-properties.yaml")
recursiveAllofRefs : OpenApi.Config.Input
recursiveAllofRefs =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/recursive-allof-refs.yaml")
overridingGlobalSecurity : OpenApi.Config.Input
overridingGlobalSecurity =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/overriding-global-security.yaml")
|> OpenApi.Config.withOverrides [ OpenApi.Config.File "./example/overriding-global-security-override.yaml" ]
singleEnum : OpenApi.Config.Input
singleEnum =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/single-enum.yaml")
patreon : OpenApi.Config.Input
patreon =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/patreon.json")
realworldConduit : OpenApi.Config.Input
realworldConduit =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/realworld-conduit.yaml")
amadeusAirlineLookup : OpenApi.Config.Input
amadeusAirlineLookup =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/amadeus-airline-lookup.json")
dbFahrplanApi : OpenApi.Config.Input
dbFahrplanApi =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/db-fahrplan-api-specification.yaml")
marioPartyStats : OpenApi.Config.Input
marioPartyStats =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/MarioPartyStats.json")
viaggiatreno : OpenApi.Config.Input
viaggiatreno =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/viaggiatreno.yaml")
trustmark : OpenApi.Config.Input
trustmark =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/trustmark.json")
|> OpenApi.Config.withOutputModuleName [ "Trustmark" ]
|> OpenApi.Config.withEffectTypes [ OpenApi.Config.ElmHttpCmd ]
|> OpenApi.Config.withServer (OpenApi.Config.Single "https://api.sandbox.retrofitintegration.data-hub.org.uk")
trustmarkTradeCheck : OpenApi.Config.Input
trustmarkTradeCheck =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/trustmark-trade-check.json")
|> OpenApi.Config.withOutputModuleName [ "Trustmark", "TradeCheck" ]
|> OpenApi.Config.withEffectTypes [ OpenApi.Config.ElmHttpCmd ]
gitHub : OpenApi.Config.Input
gitHub =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/github-spec.json")
anyOfEnums : OpenApi.Config.Input
anyOfEnums =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/anyOfEnums.yaml")
binaryResponse : OpenApi.Config.Input
binaryResponse =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/binary-response.yaml")
nullableEnum : OpenApi.Config.Input
nullableEnum =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/nullable-enum.yaml")
config : OpenApi.Config.Config
config =
OpenApi.Config.init "./generated"
|> OpenApi.Config.withAutoConvertSwagger True
|> OpenApi.Config.withInput additionalProperties
|> OpenApi.Config.withInput recursiveAllofRefs
|> OpenApi.Config.withInput overridingGlobalSecurity
|> OpenApi.Config.withInput singleEnum
|> OpenApi.Config.withInput patreon
|> OpenApi.Config.withInput realworldConduit
|> OpenApi.Config.withInput amadeusAirlineLookup
|> OpenApi.Config.withInput dbFahrplanApi
|> OpenApi.Config.withInput marioPartyStats
|> OpenApi.Config.withInput viaggiatreno
|> OpenApi.Config.withInput trustmark
|> OpenApi.Config.withInput trustmarkTradeCheck
|> OpenApi.Config.withInput gitHub
|> OpenApi.Config.withInput anyOfEnums
|> OpenApi.Config.withInput binaryResponse
|> OpenApi.Config.withInput nullableEnum
in
Pages.Script.withoutCliOptions
(BackendTask.doEach
[ Cli.withConfig config
, "\nCompiling Example app"
|> Ansi.Color.fontColor Ansi.Color.brightGreen
|> Pages.Script.log
, Pages.Script.exec "sh"
[ "-c", "cd example && npx --no -- elm make src/Example.elm --output=/dev/null" ]
]
|> BackendTask.inDir "cli"
)