[Swift] Objects should be treated as AnyObjects instead of String
Swagger Generator: v2.1.5 Language: swift
In the given sample json: https://gist.github.com/jaz-ah/99c4e011604e59264d91
If you have a json object type like this: "Data": { "type": "object", "description": "Could be a string/dictionary/etc..." } our current Swift generator turns it into a String like this:
public var Data: String!
But in reality it really should be an AnyObject to allow generic dictionaries to come through that Json. Note that the ObjectiveC code correctly treats an object as an NSObject which is the moral equivalent of the AnyObject in Swift.
@jaz-ah thanks for the PR.
Would you have time to create unit tests for Swift Petstore similar to what we've for ObjC Petstore?
For ObjC petstore, one can run the unit tests using the following commands:
cd samples/client/petstore/objc && mvn integration-test -rf :ObjcPetstoreClientTests
We need something similar for Swift. (For day 1 requirement, it's ok to manually open a XCode project to run the tests for Swift Petstore).
@wing328 yes I should have time this weekend to start that up - should I treat that as a different PR/issue than this one or add into this one?
@jaz-ah thanks! :beer:
I prefer putting the unit tests into this one.
@wing328 ok all done - I've made them build with the maven command like the objc ones and added several basic tests (create/get/delete) for the apis. There currently isn't an object in the petstore.json that would expose the bug I'm fixing here so I can't add a test for it explicitly unfortunately. I've also broken the commit into several commits so it should be easier to look at the tests since the # of files changed is so large w/ the pod checkin... let me know if this looks good. thx.