Skip to content

[ObjC] Fix deprecated JSONModel API usage#4133

Merged
wing328 merged 3 commits intoswagger-api:masterfrom
RomanTruba:fix-deprecated-jsonmodel-api
Nov 7, 2016
Merged

[ObjC] Fix deprecated JSONModel API usage#4133
wing328 merged 3 commits intoswagger-api:masterfrom
RomanTruba:fix-deprecated-jsonmodel-api

Conversation

@RomanTruba
Copy link
Copy Markdown
Contributor

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

Replaced deprecated call -[JSONKeyMapper initWithDictionary:] with -[JSONKeyMapper initWithModelToJSONDictionary:], inverting keys and values of dictionary as required.

@RomanTruba
Copy link
Copy Markdown
Contributor Author

Fix for #4129

@RomanTruba RomanTruba changed the title Fix deprecated jsonmodel api Fix deprecated JSONModel API usage Nov 4, 2016
@RomanTruba RomanTruba changed the title Fix deprecated JSONModel API usage [ObjC] Fix deprecated JSONModel API usage Nov 4, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Nov 4, 2016

@Dreddik thanks for the PR. Do we also need to update jsonmodel to the latest stable version (1.7) in the podspec: https://github.com/Dreddik/swagger-codegen/blob/9510ba5462317734b8237754a73e871dfba506af/modules/swagger-codegen/src/main/resources/objc/podspec.mustache#L34 ?

Btw, please run objc-petstore-all.sh to update ObjC Petstore samples (CoreData) as well.

cc @mateuszmackowiak

@RomanTruba
Copy link
Copy Markdown
Contributor Author

@wing328

Do we also need to update jsonmodel to the latest stable version (1.7)

Actually, API changed in v1.4, so we can use it, I suppose? In any way, clients will use version 1.7, because minor version is not specified in podspec.

Btw, please run objc-petstore-all.sh to update ObjC Petstore samples (CoreData) as well.

Already done.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Nov 4, 2016

Actually, API changed in v1.4, so we can use it, I suppose? In any way, clients will use version 1.7, because minor version is not specified in podspec.

Yes, please update it to v1.4 as that is the minimal version required for the auto-generated ObjC SDK after this change.

Also to confirm my understanding, I believe developers can still do the following after the change:

    pet = [[SWGPet alloc] initWithDictionary:petDict error:nil];

and they will receive a warning saying that initWithDictionary has been deprecated. In other words, this PR (change) is backward compatible. Please kindly correct me if I misunderstood.

@RomanTruba
Copy link
Copy Markdown
Contributor Author

RomanTruba commented Nov 4, 2016

Also to confirm my understanding, I believe developers can still do the following after the change...

This PR is backward compatible, because it only affects initialization of JSONKeyMapper inside of model classes.
[[SWGPet alloc] initWithDictionary:petDict error:nil] won't be affected (and actually not deprecated).

@wing328 wing328 merged commit a1cd019 into swagger-api:master Nov 7, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Nov 7, 2016

@Dreddik PR merged into master. Thanks for your contribution.

acramatte added a commit to comerge/swagger-codegen that referenced this pull request Nov 9, 2016
* upstream/master: (42 commits)
  add vendor extension to handle void response in jaxrs-cxf
  better handling of */*
  Select application/json content-type in python generated client, if */* is in the list of content-types
  update mxf4j sample
  [ObjC] Fix deprecated JSONModel API usage (swagger-api#4133)
  [aspnet5] Fix broken template directory for deprecated lang (swagger-api#4142)
  Add constructFromObject to Javascript enum generation. (swagger-api#4120)
  [Obj-c] Generated code documentation fixes (swagger-api#4130)
  Added QAdept to companies list
  added clarification for swagger-api#4138
  Default added sourceFolder to src/main/java
  Update pojo.mustache
  [feign] Use feign-form (swagger-api#4124)
  DART: Removed the 'justIgnoreThisFlag' flag (swagger-api#4116)
  fix[dart]: multi-word class names work properly now
  [ruby] Validate array correctly It never throws error with any values in array. Every element should be validated against the enum.
  remove glassfish dependencies and use MSF4J internal implementation for the simplicity and reduce dependencies
  updated to next development version
  Added isEmtyString check to avoid IndexOutOfBoundException
  Nancy fx work (swagger-api#4107)
  ...
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
* Fixed deprecated usage -[JSONKeyMapper initWithDictionary:]

* Petstore regenerated

* Change minimal required version of JSONModel
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.

2 participants