PHP Class Scalr\Tests\Functional\Api\V2\SpecSchema\Constraint\Validator

Validate SpecObject created form swagger specification with api response
Since: 5.11 (03.12.2015)
Author: Andrii Penchuk ([email protected])
Mostra file Open project: scalr/scalr Class Usage Examples

Protected Properties

Property Type Description
$errors array List of errors
$ignoreDiscriminatorValues array Mark test incomplete this discriminator not yet implemented
$ignoreEnumVal array List of ignore enum values in test
$ignoreRequiredVal array List of ignore required values This values is required but will not be included in response. Example privateKey in cloud credentials key based on object name in Api definitions

Public Methods

Method Description
appendError ( string $property, string $message ) Add errors to this validator
check ( mixed $value, AbstractSpecObject $schema ) Invokes the validation of an element
getErrors ( ) : array
isValid ( ) : boolean

Protected Methods

Method Description
checkItems ( stdClass $element, AbstractSpecObject $schema ) Check each items in element
checkObject ( stdClass $element, AbstractSpecObject $schema ) Validates an object
checkProperty ( mixed $element, Property $schema ) Check property form spec object
checkRequired ( stdClass $element, ObjectEntity $schema ) Check required element
checkSample ( stdClass $element, Property $schema ) Check each sample element
getConcreteTypes ( AbstractSpecObject $schema, string $objectName ) : boolean | AbstractSpecObject if element has concrete type return schema this element

Method Details

appendError() public method

Add errors to this validator
public appendError ( string $property, string $message )
$property string error property
$message string error message

check() public method

Invokes the validation of an element
public check ( mixed $value, AbstractSpecObject $schema )
$value mixed value what we should check
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\AbstractSpecObject schema value generated of api specification

checkItems() protected method

Check each items in element
protected checkItems ( stdClass $element, AbstractSpecObject $schema )
$element stdClass the list of items
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\AbstractSpecObject items schema generated of api specification

checkObject() protected method

Validates an object
protected checkObject ( stdClass $element, AbstractSpecObject $schema )
$element stdClass object properties
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\AbstractSpecObject schema this object generated of api specification

checkProperty() protected method

Check property form spec object
protected checkProperty ( mixed $element, Property $schema )
$element mixed property value
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\Property property schema generated of api specification

checkRequired() protected method

Check required element
protected checkRequired ( stdClass $element, ObjectEntity $schema )
$element stdClass object with required element
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\ObjectEntity schema value generated of api specification

checkSample() protected method

Check each sample element
protected checkSample ( stdClass $element, Property $schema )
$element stdClass sample element not described in properties
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\Property schema each sample element generated of api specification

getConcreteTypes() protected method

if element has concrete type return schema this element
protected getConcreteTypes ( AbstractSpecObject $schema, string $objectName ) : boolean | AbstractSpecObject
$schema Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\AbstractSpecObject schema value generated of api specification
$objectName string concrete type name
return boolean | Scalr\Tests\Functional\Api\V2\SpecSchema\DataTypes\AbstractSpecObject

getErrors() public method

public getErrors ( ) : array
return array

isValid() public method

public isValid ( ) : boolean
return boolean

Property Details

$errors protected_oe property

List of errors
protected array $errors
return array

$ignoreDiscriminatorValues protected_oe static_oe property

Mark test incomplete this discriminator not yet implemented
protected static array $ignoreDiscriminatorValues
return array

$ignoreEnumVal protected_oe static_oe property

List of ignore enum values in test
protected static array $ignoreEnumVal
return array

$ignoreRequiredVal protected_oe static_oe property

List of ignore required values This values is required but will not be included in response. Example privateKey in cloud credentials key based on object name in Api definitions
protected static array $ignoreRequiredVal
return array