Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSONValue instead of Any for Swift 5 #9896

Merged
merged 1 commit into from
Dec 1, 2019

Conversation

hlineholm
Copy link
Contributor

@hlineholm hlineholm commented Nov 28, 2019

PR checklist

  • Read the contribution guidelines.
    I wasn't able to run the integration tests as I could install sudo gem install autotest-fsevent -v '0.2.12' on my machine, got Darwin 19 is not (yet) supported (RuntimeError).
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
    I cannot add reviewers. This PR should be review by @ehyche.

Description of the PR

Empty objects { ... } in the swagger specification is generated as an Any type which doesn't conform to Codable in Swift and that will result in a build error. In my case it isn't an error as the specification is correct. We want to send unspecified json values for some of our properties.

To solve this, I've replaced the use of the type Any with a new custom type, the JSONValue. When creating it, I used sergiosette's gist and article.

@hlineholm hlineholm changed the title Use JSONValue instead of Any Use JSONValue instead of Any for Swift 5 Nov 28, 2019
@ghost ghost force-pushed the hlineholm/use-jsonvalue branch from cdbe81c to 4ae2e89 Compare November 29, 2019 13:15
@ghost ghost force-pushed the hlineholm/use-jsonvalue branch from 4ae2e89 to 5ef4574 Compare November 29, 2019 14:24
@HugoMario
Copy link
Contributor

thanks a lot @hlineholm for this PR

@HugoMario HugoMario merged commit 0ceba0f into swagger-api:master Dec 1, 2019
@hlineholm hlineholm mentioned this pull request Dec 3, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants