public function validate(SchemaDescriptor $schema)
    {
        if ($prevSchema = SchemaStore::getPreviousSchema($schema->getId())) {
            if (!$prevSchema instanceof SchemaDescriptor) {
                throw new \RuntimeException(sprintf(
                    'Un-parsed schema "%s".',
                    $prevSchema['id']
                ));
            }

            /** @var \Gdbots\Pbjc\Validator\Constraint $constraint */
            foreach ($this->constraints as $constraint) {
                $constraint->validate($prevSchema, $schema);
            }
        }

        $constraint = new Constraint\SchemaDependencyVersion();
        $constraint->validate($schema, $schema);

        $constraint = new Constraint\SchemaInheritanceFields();
        $constraint->validate($schema, $schema);

        $constraint = new Constraint\FieldValidEnumValue();
        $constraint->validate($schema, $schema);
    }
public function validate(SchemaDescriptor $schema)
    {
        if ($prevSchema = SchemaStore::getPreviousSchema($schema->getId())) {
            if (!$prevSchema instanceof SchemaDescriptor) {
                throw new \RuntimeException(sprintf(
                    'Un-parsed schema "%s".',
                    $prevSchema['id']
                ));
            }

            /** @var \Gdbots\Pbjc\Validator\Constraint $constraint */
            foreach ($this->constraints as $constraint) {
                $constraint->validate($prevSchema, $schema);
            }
        }

        $constraint = new Constraint\SchemaDependencyVersion();
        $constraint->validate($schema, $schema);

        $constraint = new Constraint\SchemaInheritanceFields();
        $constraint->validate($schema, $schema);

        $constraint = new Constraint\FieldValidEnumValue();
        $constraint->validate($schema, $schema);
    }
public function validate ( SchemaDescriptor $ schema ) { if ( $ prevSchema = SchemaStore :: getPreviousSchema ( $ schema -> getId ( ) ) ) { if ( ! $ prevSchema instanceof SchemaDescriptor ) { throw new \ RuntimeException ( sprintf ( 'Un-parsed schema "%s".' , $ prevSchema [ 'id' ] ) ) ; } /** @var \Gdbots\Pbjc\Validator\Constraint $constraint */ foreach ( $ this -> constraints as $ constraint ) { $ constraint -> validate ( $ prevSchema , $ schema ) ; } } $ constraint = new Constraint \ SchemaDependencyVersion ( ) ; $ constraint -> validate ( $ schema , $ schema ) ; $ constraint = new Constraint \ SchemaInheritanceFields ( ) ; $ constraint -> validate ( $ schema , $ schema ) ; $ constraint = new Constraint \ FieldValidEnumValue ( ) ; $ constraint -> validate ( $ schema , $ schema ) ; }
Validates a single schema against previous version.

@param SchemaDescriptor $schema

@throws \RuntimeException
Validates a single schema against previous version .