Bug #7261

Top level object hash marked as optional, not required in POST/create APIs

Added by Dominic Cleal over 3 years ago. Updated about 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Shlomi Zadok
Category:API
Target version:Sprint 28
Difficulty: Bugzilla link:1133799
Found in release: Pull request:https://github.com/theforeman/foreman/pull/1730
Story points-
Velocity based estimate-
Release1.6.1Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1133799
Description of problem:
API documentation of POST /api/users says:
user / optional , nil allowed

Version-Release number of selected component (if applicable):
Satellite-6.0.4-RHEL-6-20140823.0-Satellite-x86_64

How reproducible:
always

Steps to Reproduce:
1. Check the API documentation of POST /api/users
https://<sat6-hostname>/apidoc/v2/users/create.html

Actual results:
The 1st parameter user
is
optional , nil allowed

Expected results:
It does not make sense to allow nil for (or not to include) the user parameter at user creation. What user should be created?

Additional info:
curl "$(hostname)/api/users" -u admin:changeme -H "Accept: application/json" -H "Content-Type: application/json" -d '{"user":nil}' {"status":400,"error":"There was a problem in the JSON you submitted: 784: unexpected token at '{\"user\":nil}'"}
The API documentation does not match with the behavior.

Associated revisions

Revision fb5ac616
Added by Joseph Magen about 3 years ago

Fixes #7261 - API v2 - mark wrapped params hash for POST/PUT as required instead of optional

Revision 05999053
Added by Joseph Magen about 3 years ago

Fixes #7261 - API v2 - mark wrapped params hash for POST/PUT as required instead of optional

(cherry picked from commit fb5ac6168beaad3e205a113a92361066e14355f3)

History

#1 Updated by Dominic Cleal over 3 years ago

  • Subject changed from nil allowed as user parameter at user creation to Top level object hash marked as optional, not required in POST/create APIs
  • Category set to API
  • Assigned To deleted (Bryan Kearney)

#2 Updated by Joseph Magen about 3 years ago

  • Status changed from New to Assigned
  • Assigned To set to Joseph Magen
  • Target version set to Sprint 28

#3 Updated by Shlomi Zadok about 3 years ago

  • Assigned To changed from Joseph Magen to Shlomi Zadok

#4 Updated by The Foreman Bot about 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1730 added

#5 Updated by Joseph Magen about 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Dominic Cleal about 3 years ago

  • Release set to 1.6.1

Also available in: Atom PDF