Skip to content

Commit 9f3d9a5

Browse files
authored
[swift] New 'swift-combine' client generator for swift (#15823)
* swift-alt-gen init * swift-alt-gen in progress * swift-alt added runtime * swift-alt added transport * swift-alt added example * swift-alt v0.1.0 * swift-alt implemented form encoded body * swift-alt fixed array of enums to string * swift-alt v0.2.0 * swift-alt v0.3.0 * swift-alt v0.4.0 * swift-alt v0.5.0 * swift-alt v0.6.0 * swift-alt v0.7.0 * swift-alt v0.8.0 * swift-alt v0.9.0 * swift-alt v0.12.0 * swift-alt v0.13.0 * swift-alt v0.14.0 * swift-alt v0.15.0 * swift-alt v0.16.0 * swift-alt v0.17.0 * swift-alt v0.18.0 * swift-alt v0.19.0 Support for raw value in header * swift-alt v0.20.0 * swift-alt v0.21.0 * swift-alt v0.22.0 * swift-combine v0.23.0 * swift-combine PR rules adoption * swift-combine: updated transport * Updated bitrise.yml file * Fixed bitrise pipeline for swift-combine * Fixed code review comment
1 parent d160b82 commit 9f3d9a5

43 files changed

Lines changed: 4098 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
generatorName: swift-combine
2+
outputDir: samples/client/petstore/swift-combine/client
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/swift-combine
5+
additionalProperties:
6+
hideGenerationTimestamp: "true"
7+
projectName: "PetstoreOpenAPI"

bitrise.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ workflows:
2727
set -e
2828
2929
./samples/client/petstore/swift5/swift5_test_all.sh
30+
- script@1.2.0:
31+
title: Run swift-combine tests
32+
inputs:
33+
- content: |
34+
#!/usr/bin/env bash
35+
36+
set -e
37+
38+
./samples/client/petstore/swift-combine/swift-combine_test_all.sh
3039
3140
meta:
3241
bitrise.io:

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The following generators are available:
5959
* [scala-gatling](generators/scala-gatling.md)
6060
* [scala-sttp](generators/scala-sttp.md)
6161
* [scalaz](generators/scalaz.md)
62+
* [swift-combine](generators/swift-combine.md)
6263
* [swift5](generators/swift5.md)
6364
* [typescript (experimental)](generators/typescript.md)
6465
* [typescript-angular](generators/typescript-angular.md)

docs/generators/swift-combine.md

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
---
2+
title: Documentation for the swift-combine Generator
3+
---
4+
5+
## METADATA
6+
7+
| Property | Value | Notes |
8+
| -------- | ----- | ----- |
9+
| generator name | swift-combine | pass this to the generate command after -g |
10+
| generator stability | STABLE | |
11+
| generator type | CLIENT | |
12+
| generator language | Swift | |
13+
| generator default templating engine | mustache | |
14+
| helpTxt | Generates a Swift Combine client library. | |
15+
16+
## CONFIG OPTIONS
17+
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
18+
19+
| Option | Description | Values | Default |
20+
| ------ | ----------- | ------ | ------- |
21+
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
22+
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
23+
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
24+
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
25+
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
26+
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
27+
|mapFileBinaryToData|Map File and Binary to Data (default: true)| |true|
28+
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
29+
|projectName|Project name in Xcode| |null|
30+
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
31+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
32+
33+
## IMPORT MAPPING
34+
35+
| Type/Alias | Imports |
36+
| ---------- | ------- |
37+
38+
39+
## INSTANTIATION TYPES
40+
41+
| Type/Alias | Instantiated By |
42+
| ---------- | --------------- |
43+
|array|Array|
44+
|list|Array|
45+
46+
47+
## LANGUAGE PRIMITIVES
48+
49+
<ul class="column-ul">
50+
<li>Any</li>
51+
<li>AnyObject</li>
52+
<li>Bool</li>
53+
<li>Character</li>
54+
<li>Data</li>
55+
<li>Date</li>
56+
<li>Decimal</li>
57+
<li>Double</li>
58+
<li>Float</li>
59+
<li>Int</li>
60+
<li>Int32</li>
61+
<li>Int64</li>
62+
<li>String</li>
63+
<li>URL</li>
64+
<li>UUID</li>
65+
<li>Void</li>
66+
<li>[String: Any]</li>
67+
</ul>
68+
69+
## RESERVED WORDS
70+
71+
<ul class="column-ul">
72+
<li>#available</li>
73+
<li>#colorLiteral</li>
74+
<li>#column</li>
75+
<li>#else</li>
76+
<li>#elseif</li>
77+
<li>#endif</li>
78+
<li>#file</li>
79+
<li>#fileLiteral</li>
80+
<li>#function</li>
81+
<li>#if</li>
82+
<li>#imageLiteral</li>
83+
<li>#line</li>
84+
<li>#selector</li>
85+
<li>#sourceLocation</li>
86+
<li>Any</li>
87+
<li>AnyObject</li>
88+
<li>Array</li>
89+
<li>Bool</li>
90+
<li>COLUMN</li>
91+
<li>Character</li>
92+
<li>Class</li>
93+
<li>ClosedRange</li>
94+
<li>Codable</li>
95+
<li>CountableClosedRange</li>
96+
<li>CountableRange</li>
97+
<li>Data</li>
98+
<li>Decodable</li>
99+
<li>Dictionary</li>
100+
<li>Double</li>
101+
<li>Encodable</li>
102+
<li>Error</li>
103+
<li>FILE</li>
104+
<li>FUNCTION</li>
105+
<li>Float</li>
106+
<li>Float32</li>
107+
<li>Float64</li>
108+
<li>Float80</li>
109+
<li>Int</li>
110+
<li>Int16</li>
111+
<li>Int32</li>
112+
<li>Int64</li>
113+
<li>Int8</li>
114+
<li>LINE</li>
115+
<li>OptionSet</li>
116+
<li>Optional</li>
117+
<li>Protocol</li>
118+
<li>Range</li>
119+
<li>Result</li>
120+
<li>Self</li>
121+
<li>Set</li>
122+
<li>StaticString</li>
123+
<li>String</li>
124+
<li>Type</li>
125+
<li>UInt</li>
126+
<li>UInt16</li>
127+
<li>UInt32</li>
128+
<li>UInt64</li>
129+
<li>UInt8</li>
130+
<li>URL</li>
131+
<li>Unicode</li>
132+
<li>Void</li>
133+
<li>_</li>
134+
<li>as</li>
135+
<li>associatedtype</li>
136+
<li>associativity</li>
137+
<li>break</li>
138+
<li>case</li>
139+
<li>catch</li>
140+
<li>class</li>
141+
<li>continue</li>
142+
<li>convenience</li>
143+
<li>default</li>
144+
<li>defer</li>
145+
<li>deinit</li>
146+
<li>didSet</li>
147+
<li>do</li>
148+
<li>dynamic</li>
149+
<li>dynamicType</li>
150+
<li>else</li>
151+
<li>enum</li>
152+
<li>extension</li>
153+
<li>fallthrough</li>
154+
<li>false</li>
155+
<li>fileprivate</li>
156+
<li>final</li>
157+
<li>for</li>
158+
<li>func</li>
159+
<li>get</li>
160+
<li>guard</li>
161+
<li>if</li>
162+
<li>import</li>
163+
<li>in</li>
164+
<li>indirect</li>
165+
<li>infix</li>
166+
<li>init</li>
167+
<li>inout</li>
168+
<li>internal</li>
169+
<li>is</li>
170+
<li>lazy</li>
171+
<li>left</li>
172+
<li>let</li>
173+
<li>mutating</li>
174+
<li>nil</li>
175+
<li>none</li>
176+
<li>nonmutating</li>
177+
<li>open</li>
178+
<li>operator</li>
179+
<li>optional</li>
180+
<li>override</li>
181+
<li>postfix</li>
182+
<li>precedence</li>
183+
<li>prefix</li>
184+
<li>private</li>
185+
<li>protocol</li>
186+
<li>public</li>
187+
<li>repeat</li>
188+
<li>required</li>
189+
<li>rethrows</li>
190+
<li>return</li>
191+
<li>right</li>
192+
<li>self</li>
193+
<li>set</li>
194+
<li>static</li>
195+
<li>struct</li>
196+
<li>subscript</li>
197+
<li>super</li>
198+
<li>switch</li>
199+
<li>throw</li>
200+
<li>throws</li>
201+
<li>true</li>
202+
<li>try</li>
203+
<li>typealias</li>
204+
<li>unowned</li>
205+
<li>var</li>
206+
<li>weak</li>
207+
<li>where</li>
208+
<li>while</li>
209+
<li>willSet</li>
210+
</ul>
211+
212+
## FEATURE SET
213+
214+
215+
### Client Modification Feature
216+
| Name | Supported | Defined By |
217+
| ---- | --------- | ---------- |
218+
|BasePath|✗|ToolingExtension
219+
|Authorizations|✗|ToolingExtension
220+
|UserAgent|✗|ToolingExtension
221+
|MockServer|✗|ToolingExtension
222+
223+
### Data Type Feature
224+
| Name | Supported | Defined By |
225+
| ---- | --------- | ---------- |
226+
|Custom|✗|OAS2,OAS3
227+
|Int32|✓|OAS2,OAS3
228+
|Int64|✓|OAS2,OAS3
229+
|Float|✓|OAS2,OAS3
230+
|Double|✓|OAS2,OAS3
231+
|Decimal|✓|ToolingExtension
232+
|String|✓|OAS2,OAS3
233+
|Byte|✓|OAS2,OAS3
234+
|Binary|✓|OAS2,OAS3
235+
|Boolean|✓|OAS2,OAS3
236+
|Date|✓|OAS2,OAS3
237+
|DateTime|✓|OAS2,OAS3
238+
|Password|✓|OAS2,OAS3
239+
|File|✓|OAS2
240+
|Uuid||
241+
|Array|✓|OAS2,OAS3
242+
|Null|✗|OAS3
243+
|AnyType|✗|OAS2,OAS3
244+
|Object|✓|OAS2,OAS3
245+
|Maps|✓|ToolingExtension
246+
|CollectionFormat|✓|OAS2
247+
|CollectionFormatMulti|✓|OAS2
248+
|Enum|✓|OAS2,OAS3
249+
|ArrayOfEnum|✓|ToolingExtension
250+
|ArrayOfModel|✓|ToolingExtension
251+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
252+
|ArrayOfCollectionOfModel|✓|ToolingExtension
253+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
254+
|MapOfEnum|✓|ToolingExtension
255+
|MapOfModel|✓|ToolingExtension
256+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
257+
|MapOfCollectionOfModel|✓|ToolingExtension
258+
|MapOfCollectionOfEnum|✓|ToolingExtension
259+
260+
### Documentation Feature
261+
| Name | Supported | Defined By |
262+
| ---- | --------- | ---------- |
263+
|Readme|✗|ToolingExtension
264+
|Model|✓|ToolingExtension
265+
|Api|✓|ToolingExtension
266+
267+
### Global Feature
268+
| Name | Supported | Defined By |
269+
| ---- | --------- | ---------- |
270+
|Host|✓|OAS2,OAS3
271+
|BasePath|✓|OAS2,OAS3
272+
|Info|✓|OAS2,OAS3
273+
|Schemes|✗|OAS2,OAS3
274+
|PartialSchemes|✓|OAS2,OAS3
275+
|Consumes|✓|OAS2
276+
|Produces|✓|OAS2
277+
|ExternalDocumentation|✓|OAS2,OAS3
278+
|Examples|✓|OAS2,OAS3
279+
|XMLStructureDefinitions|✗|OAS2,OAS3
280+
|MultiServer|✗|OAS3
281+
|ParameterizedServer|✗|OAS3
282+
|ParameterStyling|✗|OAS3
283+
|Callbacks|✓|OAS3
284+
|LinkObjects|✗|OAS3
285+
286+
### Parameter Feature
287+
| Name | Supported | Defined By |
288+
| ---- | --------- | ---------- |
289+
|Path|✓|OAS2,OAS3
290+
|Query|✓|OAS2,OAS3
291+
|Header|✓|OAS2,OAS3
292+
|Body|✓|OAS2
293+
|FormUnencoded|✓|OAS2
294+
|FormMultipart|✓|OAS2
295+
|Cookie|✓|OAS3
296+
297+
### Schema Support Feature
298+
| Name | Supported | Defined By |
299+
| ---- | --------- | ---------- |
300+
|Simple|✓|OAS2,OAS3
301+
|Composite|✓|OAS2,OAS3
302+
|Polymorphism|✓|OAS2,OAS3
303+
|Union|✗|OAS3
304+
|allOf|✗|OAS2,OAS3
305+
|anyOf|✗|OAS3
306+
|oneOf|✗|OAS3
307+
|not|✗|OAS3
308+
309+
### Security Feature
310+
| Name | Supported | Defined By |
311+
| ---- | --------- | ---------- |
312+
|BasicAuth|✓|OAS2,OAS3
313+
|ApiKey|✓|OAS2,OAS3
314+
|OpenIDConnect|✗|OAS3
315+
|BearerToken|✓|OAS3
316+
|OAuth2_Implicit|✓|OAS2,OAS3
317+
|OAuth2_Password|✓|OAS2,OAS3
318+
|OAuth2_ClientCredentials|✓|OAS2,OAS3
319+
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
320+
|SignatureAuth|✗|OAS3
321+
322+
### Wire Format Feature
323+
| Name | Supported | Defined By |
324+
| ---- | --------- | ---------- |
325+
|JSON|✓|OAS2,OAS3
326+
|XML|✓|OAS2,OAS3
327+
|PROTOBUF|✗|ToolingExtension
328+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)