170 Commits

Author SHA1 Message Date
Bruno Coelho
687692cedc
update AnyCodable and gitignore (#9777) 2021-06-17 00:37:23 +08:00
Ayman Bagabas
f923a0ef15
Swift5 Vapor 4 client library (#9625)
* [swift5] Add Vapor client library

* Try to improve overall spacing (#17)

* [swift5] try to remove changes in model and api

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* [swift5] update sample projects

* Update samples

* [swift5] vapor: return clientResponse when no default case

* Update samples

Co-authored-by: Bruno Coelho <4brunu@users.noreply.github.com>
2021-06-06 22:08:14 +08:00
Ayman Bagabas
9bce71656c
Swift5 namespace changes (#9624)
* [swift5] Rename the API class to {{projectName}}

Instead of {{projectName}}API. This removes some unnecessary naming
complexity.

* [swift5] Define models and Configuration classes under namespace

When swiftUseApiNamespace is set, API classes get defined under the
projectName namespace. This does the same for models and the
Configuration class. Plus adding a deprecation warning when using the
un-namespaced variants.

* [swift5] Use CodingKeys in model decoder

Fixes: 0f5e7d1e3cb9 ("Swift5 models improvements (#9205)")

* [swift5] Add swiftUseApiNamespace to urlsessionLibrary config

* Update samples

* Try to reduce model changes

Co-authored-by: Bruno Coelho <4brunu@gmail.com>
2021-06-02 00:45:01 +08:00
Bruno Coelho
6cf4843249
[swift5][client] update dependencies (#9633)
* [swift5][client] update dependencies

* [swift5][client] update sample projects

* [swift5][client] update dependencies in Carthage
2021-06-01 10:09:22 +08:00
Bruno Coelho
dee2840b20
[swift5][client] improve docs for Data (#9605) 2021-05-30 17:40:09 +08:00
Bruno Coelho
a61db6e596
[swift5][client] fix binary response (#9595)
* [swift5][client] fix binary respose

* [swift5][client] fix binary respose
2021-05-27 10:18:51 +08:00
Alexandre
6c40192706
[swift5] Add support for oneOfs (#8714)
* [swift5] Add support for oneOfs

* Generate a sample Swift project with oneOfs

* Update Swift Samples
2021-05-24 13:01:16 +08:00
William Cheng
4948ce78ed update samples 2021-05-21 12:54:40 +08:00
Makoto Aoyama
0a34839567
Add hashableModels to additional properties (#9495)
* Add hashableStruct

* Revert "Remove x-swift-hashable"

This reverts commit 18053af0016fdba13fd1e5df00ad86abee071283.

* Add Hashable for x-swift-hashable

* Add config yaml to test x-swift-hashable

* Run ./bin/generate-samples.sh ./bin/configs/swift5*

* Run ./bin/utils/export_docs_generators.sh

* Run ./bin/generate-samples.sh ./bin/configs/swift5*

* Verify setHashableStruct

* Rename hashableStruct => hashableModels

- Replace hashableStruct => hashableModels
- Replace HashableStruct => HashableModels
- Replace HASHABLE_STRUCT => HASHABLE_MODELS
- Update docs

* Refactor modelObject.mustache

* Control equals and hash functions
2021-05-20 23:04:19 +08:00
Bruno Coelho
f48311dac4
[swift5][client] make AnyCodable optional (#9479)
* [swift5][client] make AnyCodable usage optional

* [swift5][client] update sample projects
2021-05-18 23:47:26 +08:00
Bruno Coelho
e6a10ae350
[swift5][client] add option to generate or not the model additional properties (#9375)
* [swift5][client] add option to generate or not the models additional properties

* [swift5][client] update sample projects

* [swift5][client] format code

* [swift5][client] format code

* [swift5][client] format code

* [swift5][client] update docs
2021-05-15 15:46:32 +08:00
William Cheng
3e58b0908c Merge remote-tracking branch 'origin/5.2.x' into 6.0.x 2021-04-28 18:08:24 +08:00
William Cheng
37eaf70755 Merge remote-tracking branch 'origin/master' into 5.2.x 2021-04-28 17:48:21 +08:00
William Cheng
7df0f56fdc update samples 2021-04-26 10:21:48 +08:00
Ayman Bagabas
f7c3773903
Swift5 use json type for any (#9206)
* [swift5] Fix additionalProps inner type

* [swift5] Add and use AnyCodable type instead of any

* [swift5] Use the original petstore w/fake models for testing default

* [swift5] Update swift-tools-version to 5.1

* [swift5] Update samples and docs
2021-04-26 09:57:42 +08:00
Ayman Bagabas
0f5e7d1e3c
Swift5 models improvements (#9205)
* [swift5] Add useClasses to use `final class` instead of `struct`

* [swift5] Always include CodingKeys enum

* [swift5] Implement model equals and hash functions

* [swift5] Encode `null` values

* [swift5] Test `useClasses` in urlsessionLibrary

* [swift5] Add a required nullable prop test case to 2_0/swift/petstore*.yaml

* [swift5] Update samples and docs
2021-04-24 10:04:30 +08:00
William Cheng
05aa956fe1 update samples 2021-04-22 19:20:11 +08:00
Ayman Bagabas
33107c14de
[Swift5] escape reserved words (#9204)
* [swift5] `List` is not a Swift data type

* [swift5] Escape reserved words using backticks

https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412

* [swift5] Update tests

* [swift5] Update samples and docs
2021-04-22 19:13:39 +08:00
Ayman Bagabas
3894aa4759
[swift5] Add useSPMFileStructure (#9074)
* [swift5] Add useSPMFileStructure

Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>

* [swift5] Add swiftPackagePath

Prioritize swiftPackagePath over useSPMFileStructure

* [swift5] Add cli options and update docs

* [swift5] Fix tests

* [swift5] Update XcodeGen source path

* [swift5] Update samples and docs

Add useSPMFileStructure to URLSession library
2021-04-22 00:43:33 +08:00
Makoto Aoyama
c3b7ecff21
Add Hashable for Struct (#9166)
* Add hashable for struct

* Remove x-swift-hashable

* Run the shell script ./bin/generate-samples.sh
2021-04-06 10:50:23 +08:00
William Cheng
95d356ab6b Merge remote-tracking branch 'origin/5.2.x' into 6.0.x 2021-03-21 01:10:46 +08:00
William Cheng
47483e60cb update version to 5.2.0-SNAPSHOT, update samples 2021-03-21 00:10:10 +08:00
William Cheng
0dc62e8b79
Prepare v5.1.1 in the master (#9027)
* Prepare v5.1.1 in the master

* move dart dio next to configs/other
2021-03-20 23:05:11 +08:00
William Cheng
e023eaa821
Prepare v5.1.0 release (#9017)
* prepare v5.1.0 release

* update samples (dart-dio-next)
2021-03-20 16:45:05 +08:00
Markus Wandersee
fae4d7a73d
Fix for StackOverflow in Swift5 CodeGeneration Issue #8671 (#8672)
* StackOverflowFix for Issue 8671

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-03-15 17:59:09 +08:00
William Cheng
2c457a458e Merge remote-tracking branch 'origin/5.1.x' into 6.0.x 2021-02-02 21:43:53 +08:00
William Cheng
5b99d8724c Merge remote-tracking branch 'origin/master' into 5.1.x 2021-02-02 21:04:15 +08:00
Frank Lehmann
64f5dc8077
[swift5] URLSession: Fix memory leak of SessionDelegate (#8558)
* Remove unused stored reference of delegate. URLSession keeps a strong reference anyway.

* Fix cleanup

* Update samples
2021-01-29 10:52:39 +08:00
William Cheng
a96febaba8 update samples 2021-01-28 17:41:48 +08:00
William Cheng
f887441591 update samples 2021-01-28 16:47:09 +08:00
Frank Lehmann
f6019f00a1
[swift5] Fix #8511 (request closure not being called) (#8537)
* Remove weak self to fix too early deallocations

* Update samples

* Remove podfile lock

* Run pod install on samples/client/test/swift5/default/TestClientApp/

* Revert "Run pod install on samples/client/test/swift5/default/TestClientApp/"

This reverts commit 5ad327c70789a6ab50e372a5bbc2cfa3b0a7f883.
2021-01-27 11:17:42 +08:00
Bruno Coelho
17bb3750c4
[swift 5] fix objc integration (#8534)
* [swift 5] fix objc integration

* [swift 5] fix combine integration
2021-01-25 20:53:42 +08:00
Bruno Coelho
3a56e3818f
[Swift 5] remove old swift sample (#8280)
* [swift] remove old swift sample

* [swift] update bitrise.yml

* [swift] update unit tests
2021-01-25 13:34:10 +08:00
Frank Lehmann
eecd30c2da
[swift5] Fix target SDKs for Combine option (#8476)
* Update min sdks when Combine is used

* Update samples

* Revert "Update min sdks when Combine is used"

This reverts commit e88b8abaa787ebf8cffc6b8360ea22437ae20069.

* Wrap import combine with canImport directive

* Update samples

* Wrap functions using Combine with canImport because of compiler error on archive

* Update samples

* Remove unnecessary newline and update samles
2021-01-23 10:35:37 +08:00
Bruno Coelho
646bcc64ad
[Swift 5] code formatting (#8385)
* [swift] improve code formatting

* [swift] update sample projects

* Revert "[swift] improve code formatting"

This reverts commit 0cc280509cae1a9a581ea4ed92d8141dd0f35a5c.

* [swift] update sample projects
2021-01-10 13:50:19 +08:00
Bruno Coelho
dd9a19ab8f
[Swift 5] fix Multipart FormData encoding and add support for Form URLEncoded enconding (#8275)
* [swift5] fix issue with form data with null file

* [swift5] fix issue with form data with null file on alamofire implementation

* [swift5] update sample projects

* [swift5] fix issue with form data with null file on alamofire implementation

* [swift5] add support for form url enconded in URLSession

* [swift5] add support for form url enconded in Alamofire

* [swift] improve code formatting

* [swift] improve code formatting

* [swift] dont defaut to application/json
2021-01-05 09:27:14 +08:00
Bruno Coelho
d2aa40a935
[Swift 5] deprecate retry hook since its no longer needed (#8303)
* [Swift 5] deprecated retry hook since its no longer needed

* [Swift 5] deprecated retry hook since its no longer needed

* [swift] fix generator code formatting
2021-01-04 19:34:28 +08:00
Bruno Coelho
163c70e7d8
[Swift 5] create sample for URLSsession and Alamofire bearer authentication (#8302)
* [swift] create a sample of bearer token authentication with URLSession

* [swift] create a sample of bearer token authentication with URLSession

* [swift] create a sample of bearer token authentication with URLSession

* [swift] create a sample of bearer token authentication with URLSession

* [swift] create a sample of bearer token authentication with Alamofire

* [swift] create a sample of bearer token authentication with Alamofire
2021-01-04 10:03:26 +08:00
Bruno Coelho
72d6cff188
iOS - fix XcodeGen deploy target to match cocoapods (#8279) 2021-01-04 09:55:59 +08:00
Bruno Coelho
14efb8c70f
[swift 5] update dependencies (#8277) 2021-01-04 09:55:23 +08:00
Bruno Coelho
775b64f6c7
[swift5] add URLResponse to ErrorResponse (#8267)
* [swift5] add URLResponse to ErrorResponse

* [swift] improve unit tests

* [swift] improve unit tests
2020-12-29 23:31:12 +08:00
William Cheng
2e70405084
update swift samples, use swiftlint 0.41.0 (#8138) 2020-12-09 18:19:27 +08:00
William Cheng
82c5021df2
Revert "Bugfix swift5 code generation 2966 (#7301)" and provide a better (#8066)
fix for the stackoverflow issue
2020-12-02 21:20:44 +08:00
William Cheng
eacf61de7e
fix decimal mapping (#7875) 2020-11-08 11:46:33 +08:00
Francesco Marini
785cbbbb63
[Swift5][URLSession] Fix handling of customHeaders between retries (#7527)
* fix: correct handling of customHeaders

Problem: custom headers could be overwritten between 
request retries following, e.g. a token refresh ( for example,
while implementing @4brunu refresh code :
https://github.com/OpenAPITools/openapi-generator/issues/5462#issuecomment-592417371 ).
A simple reordering of the modifiedRequest headers construction
solves the problem.

* fix: correct PetStore samples implementation [PR#7527]

Co-authored-by: Franz Marini <f.marini@opengate.biz>
2020-09-28 21:46:47 +08:00
Grigory Entin
a5ee2e0454
[Swift5] Fixed spelling for promise. (#7516) 2020-09-27 16:13:21 +08:00
William Cheng
11a674f248
add extension for hashable in swift5 (#7300) 2020-08-26 19:29:29 +08:00
Alexandre
83f64dbc15
[Swift5] Fix Datetime default value (#7003)
* [Swift5] Fix Datetime default value

If a default value is provided by the API spec for a date-time attribute,
this commit fixes the generation code to build a correct Swift `Date` object.

* update samples with swiftlint

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-24 11:56:18 +08:00
William Cheng
720ab3d39b
run swiftlint latest version on swift samples (#6788) 2020-06-26 17:46:55 +08:00
Jim Schubert
60ceded171
[ci][cli] Moving ensures script to config-based batch generation of samples (#6509)
* Ensure CLI-level generator settings are available in additional properties

* Initial conversion to yaml configs

Configs prefix with 1- need to be manually evaluated.

* Add "other" configs not in ensure-up-to-date

* Add other/openapi3 files

* Cleanup all generation scripts

* Clean up: add missed configs and fix some openapi 3 diffs

* Move generate-samples script, error on batch failures

* Temporarily disable elm which requires skip validation of spec

* CI updates (todo: run all generators through appveyor or move to github workflows)

* Add success count to batch generation command output

* [samples] Regenerate

* Remove bin/windows

* Generate swift5 samples in bitrise

* Expand user input glob pattern

* Regenerate samples

* Update PR template

* Support config based generateAliasAsModel

* [samples] Regenerate

* [rust] Generate as alias for all samples configs

* [csharp] Move test staged file changes to in-directory

* Include "live" test files and ignore test cache files from samples.ci

* Remove concept of samples.ci staging

Generators support .openapi-generator-ignore, allowing maintainers to
explicitly ignore the regeneration of files which have been modified.

Note that the tooling does not overwrite test files whenever those files
exist, and it's not entirely necessary to add test files to the ignore
file.

* Re-add meta generator scripts

* Modify ensure-up-to-date to log stdout, so script does not look like it hangs on slower machines

* [csharp] Regenerate sample

* Set generateAliasAsModel CodegenConfigurator#toContext

This ensures the property (which is effectively a thread-local) gets set
as expected if the caller resets GlobalSettings as is done in the
GenerateBatch command.

* [rust] Regenerate samples

* Re-enable elm

* [java] Support OffsetDateTime example, fail ensures script on any generation error

* [samples] Regenerate

* Fix jersey2-java8 ignore file

* Fix elm spec validation

* Force UTC in sample generation to avoid timezone conflicts during generation (user vs ci)

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-06-09 18:28:58 +08:00