Skip to content

[ObjC] fix mapping generation#3894

Merged
wing328 merged 2 commits intoswagger-api:masterfrom
ClayAtWork:2208-fix-obc-additonal-properties
Oct 11, 2016
Merged

[ObjC] fix mapping generation#3894
wing328 merged 2 commits intoswagger-api:masterfrom
ClayAtWork:2208-fix-obc-additonal-properties

Conversation

@ClayAtWork
Copy link
Copy Markdown
Contributor

@ClayAtWork ClayAtWork commented Sep 28, 2016

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch 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)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

fixes #2208

Fixes Objective-C generation of maps via additionalProperties, to create a string-to-object map. The JSON Mapping library used by the generated code, JSONModel, see jsonmodel/jsonmodel#341

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Oct 2, 2016

cc @mateuszmackowiak

@ClayAtWork
Copy link
Copy Markdown
Contributor Author

What's the timeline for this? I would love to get some feedback from the other objc consumers

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Oct 5, 2016

@ClayAtWork After reading jsonmodel/jsonmodel#341, one question I've is whether this change is compatible with iOS 9 only.

@ClayAtWork
Copy link
Copy Markdown
Contributor Author

@wing328 No, the previous version was the one that used Objective-C generics, which are erased at compile time. This uses a Protocol, which is available to the mapping library at runtime.

I'm not actually sure why this was in the generator how it was because the code did not actually compile. You cannot mix a generic and a protocol in a single declaration like the previous tests declared:
- Assert.assertEquals(property1.datatype, "NSDictionary<NSString*, SWGChildren>*");
notice SWGChildren is not a pointer type, it is actually a protocol, but NSString* is a pointer type, meaning the <...> is to indicate a generic type.

@ClayAtWork
Copy link
Copy Markdown
Contributor Author

Hey, can we evaluate this for being merged? Seems like an issue with the project is long term support for individual languages. Is there a single touchpoint for the Objective-C codegen?

@fabiendevos
Copy link
Copy Markdown

@wing328 : We are already using swagger in production on Android, and we plan on using swagger in production on both iOS and Web (through ruby) very soon. This could be a great demonstration of the power of using swagger code gen to do faster multi platform development. We published a blog post promoting the use of swagger in the past and we plan on publishing more, but we really need this to work for all clients or we will need to consider another technology, or even worse: forking this project. 😞 We love open source and would love to avoid the extreme solution of forking.

Please let us know what we can do to get this PR (and hopefully more in the future) get merged! :)

@fehguy
Copy link
Copy Markdown
Contributor

fehguy commented Oct 11, 2016

Hi @fabiendevos thanks for the PR. We'll get this considered based on compatibility--if it's a breaking change and causes clients to force an IOS upgrade (not saying it does!) we can always introduce a new version of the generator.

PS I never saw that blog post! You should mention @SwaggerAPI and tweet it out.

PPS Some of the team is right near your office and we can discuss changes faster in person...

@fabiendevos
Copy link
Copy Markdown

Hi @fehguy! Thanks for the quick answer. Sorry for not mentioning @SwaggerAPI when we tweeted. We will in the future.
@ClayAtWork is telling me that the code it was previously generating did not compile. So he is not sure how this could break anything that wasn't already broken?
It would be great to discuss in person! I'll send you an email.
Thanks again!

@wing328 wing328 merged commit 504f8f1 into swagger-api:master Oct 11, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Oct 11, 2016

Test results look good. PR merged into master. Thanks again for the contribution.

@fabiendevos
Copy link
Copy Markdown

@wing328 thanks a lot for merging this! We might have more contribution to come. :)

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Oct 11, 2016

acramatte added a commit to comerge/swagger-codegen that referenced this pull request Oct 12, 2016
* upstream/master:
  [html]Group api index by operations.baseName (swagger-api#3953)
  Revert "[WIP] Improve PHP client emitted code quality"
  update retrofit1,2 samples
  jaxrs-cxf-cdi POM template (swagger-api#3958)
  [Swift] Add / as enum separator
  issue-890 correct fix for deprecated Jersey method
  2208 fix Objc Mapping Generation (swagger-api#3894)
  [Spring] Format datetime in rfc3339 (swagger-api#3777)
  [Java/Jackson] use a jdk6 compatible DateFormat for java.util.Date (swagger-api#3768)
  add template owner jax-rs cxf cdi
  remove newline char in *.mustache; added generated code
  Add a new JAX-RS server generator - jaxrs-cxf-cdi (swagger-api#3940)
  added package paths for retrofit class names
  feature(PHP QA) add initial PHP client template tweaks to improve emitted code quality
  [resteasy] configure jackson to use rfc3339 dates
  [jersey] configure jackson to use rfc3339 dates
@wing328 wing328 changed the title 2208 fix Objc Mapping Generation [ObjC] fix mapping generation Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ObjC] Wrong generation of additionalProperties

4 participants