Inheritance: extends Schema
コード例 #1
0
ファイル: Operation.php プロジェクト: Lazybin/huisa
 public function validate()
 {
     if (count($this->_partials) !== 0) {
         return true;
     }
     if (empty($this->nickname)) {
         Logger::notice('Required field "nickname" is missing for "' . $this->identity() . '" in ' . $this->_context);
     }
     Swagger::checkDataType($this->type, $this->_context);
     foreach ($this->parameters as $parameter) {
         if ($parameter->validate() == false) {
             return false;
         }
     }
     Items::validateContainer($this);
     Produces::validateContainer($this);
     Consumes::validateContainer($this);
     return true;
 }
コード例 #2
0
ファイル: DataType.php プロジェクト: Lazybin/huisa
 public function validate()
 {
     if (is_string($this->required)) {
         $required = filter_var($this->required, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
         if ($required === null) {
             Logger::notice('Invalid `required="' . $this->required . '"` for ' . $this->identity() . ' expecting `required=true` or `required=false` in ' . $this->_context);
         } else {
             Logger::notice('Expecting a boolean, got a string `required="' . $this->required . '"` instead of `required=' . ($required ? 'true' : 'false') . '` for ' . $this->identity() . ' in ' . $this->_context);
             $this->required = $required;
         }
     }
     Items::validateContainer($this);
     return true;
 }