Defect #20788

REST API with JSON content missing attributes with false values

Added by 邵 岸 about 3 years ago. Updated 17 days ago.

Status:ClosedStart date:
Priority:LowDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:REST API
Target version:3.3.9
Resolution:Fixed Affected version:2.6.7

Description

if an issue IS NOT private,using "GET /issues/<this_issue_id>.xml" can get "<is_private>false</is_private>" in the response;but if using "GET /issues/<this_issue_id>.json", there is no "is_private" key fonud in the response.

and the similar:
if a project IS NOT public,using "GET /projects/<this_project_id>.xml" can get "<is_public>false</is_public>" in the response;but if using "GET /issues/<this_project_id>.json", there is no "is_public" key fonud in the response.

Environment:
Redmine version 2.6.6.stable
Ruby version 2.0.0-p645 (2015-04-13) [x86_64-linux]
Rails version 3.2.22
Environment production
Database adapter Mysql2
SCM:
Subversion 1.7.10
Filesystem
Redmine plugins:
redmine_cas 1.2.1

20788-missing-jsonvalue-false.patch Magnifier (1.19 KB) Yuichi HARADA, 2018-11-21 03:30

Associated revisions

Revision 17643
Added by Jean-Philippe Lang 18 days ago

REST API with JSON content missing false values (#20788).

Patch by Yuichi HARADA.

Revision 17650
Added by Jean-Philippe Lang 17 days ago

Merged r17643 to 3.4-stable (#20788).

Revision 17651
Added by Jean-Philippe Lang 17 days ago

Merged r17643 to 3.3-stable (#20788).

History

#1 Updated by Go MAEDA over 2 years ago

  • Target version set to Candidate for next minor release

#2 Updated by Yuichi HARADA 26 days ago

JSON result was missing value of false or nil.

The reason is that we assume as 'true' the result of [false].any? . However actual this result is 'false'.
https://ruby-doc.org/core/Enumerable.html#method-i-any-3F

I made a patch, and attach it.

#3 Updated by Go MAEDA 26 days ago

  • Target version changed from Candidate for next minor release to 3.3.9

LGTM. Setting the target version to 3.3.9.

#4 Updated by Jean-Philippe Lang 18 days ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Committed, thanks.

#5 Updated by Jean-Philippe Lang 18 days ago

  • Subject changed from REST API with JSON content missing some keys to REST API with JSON content missing attributes with false values

#6 Updated by Jean-Philippe Lang 17 days ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF