简体   繁体   中英

Restler not requiring required properties

I have this for my object class and API class. I'm able to call post without sending a task_list_id or display_order . As long as I just pass title it's calling the method.

class BaseTaskObj
{   
  /// @var int    $task_list_id   The SQL ident of the Task List to use for the Task. {@min 1}{@required true}
  public $task_list_id;
}

class PostTaskObj extends BaseTaskObj
{
  /// @var int    $assigned_id    The SQL ident of the Person who this task is assigned to {@min 1}{@required false}
  public $assigned_id;
}

class MyTaskAPI {
  /**
   * Creates a new Task associated with an existing task list.
   *
   * @param PostTaskObj $info The details of the Task object to create. {@required title, display_order}
   *
   * @status 201
   *
   * @return int The SQL ident of the newly created Task
   */
   function post(PostTaskObj $info) {
   }  
}

task_list_id and assigned_id currently do not have valid phpdoc comments. They do not have any assigned value as well. This makes them the required parameters for the api call.

But then you have {@required title, display_order} which overwrites the required list with invalid parameters thus making them not required

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM