Errors
1 year ago
Exceptions
1 year ago
Filters
1 year ago
Formats
1 year ago
Info
1 year ago
KeywordValidators
1 year ago
Keywords
1 year ago
Parsers
1 year ago
Pragmas
1 year ago
Resolvers
1 year ago
Schemas
1 year ago
Variables
1 year ago
CompliantValidator.php
1 year ago
ContentEncoding.php
1 year ago
ContentMediaType.php
1 year ago
Filter.php
1 year ago
Format.php
1 year ago
Helper.php
1 year ago
JsonPointer.php
1 year ago
Keyword.php
1 year ago
KeywordValidator.php
1 year ago
Pragma.php
1 year ago
Schema.php
1 year ago
SchemaLoader.php
7 months ago
SchemaValidator.php
1 year ago
Uri.php
1 year ago
ValidationContext.php
7 months ago
ValidationResult.php
1 year ago
Validator.php
1 year ago
Variables.php
1 year ago
CompliantValidator.php
56 lines
| 1 | <?php |
| 2 | /* ============================================================================ |
| 3 | * Copyright 2021 Zindex Software |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * ============================================================================ */ |
| 17 | |
| 18 | namespace Opis\JsonSchema; |
| 19 | |
| 20 | class CompliantValidator extends Validator |
| 21 | { |
| 22 | protected const COMPLIANT_OPTIONS = [ |
| 23 | 'allowFilters' => false, |
| 24 | 'allowFormats' => true, |
| 25 | 'allowMappers' => false, |
| 26 | 'allowTemplates' => false, |
| 27 | 'allowGlobals' => false, |
| 28 | 'allowDefaults' => false, |
| 29 | 'allowSlots' => false, |
| 30 | 'allowKeywordValidators' => false, |
| 31 | 'allowPragmas' => false, |
| 32 | 'allowDataKeyword' => false, |
| 33 | 'allowKeywordsAlongsideRef' => false, |
| 34 | 'allowUnevaluated' => true, |
| 35 | 'allowRelativeJsonPointerInRef' => false, |
| 36 | 'allowExclusiveMinMaxAsBool' => false, |
| 37 | 'keepDependenciesKeyword' => false, |
| 38 | 'keepAdditionalItemsKeyword' => false, |
| 39 | ]; |
| 40 | |
| 41 | public function __construct( |
| 42 | ?SchemaLoader $loader = null, |
| 43 | int $max_errors = 1, |
| 44 | bool $stop_at_first_error = true |
| 45 | ) |
| 46 | { |
| 47 | parent::__construct($loader, $max_errors, $stop_at_first_error); |
| 48 | |
| 49 | // Set parser options |
| 50 | $parser = $this->parser(); |
| 51 | foreach (static::COMPLIANT_OPTIONS as $name => $value) { |
| 52 | $parser->setOption($name, $value); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 |