|
17 | 17 | * |
18 | 18 | * @link https://github.com/OAI/OpenAPI-Specification/blob/3.0.2/versions/3.0.2.md#schemaObject |
19 | 19 | * |
| 20 | + * @property-read string $title |
| 21 | + * @property-read int|float $multipleOf |
| 22 | + * @property-read int|float $maximum |
| 23 | + * @property-read int|float $exclusiveMaximum |
| 24 | + * @property-read int|float $minimum |
| 25 | + * @property-read int|float $exclusiveMinimum |
| 26 | + * @property-read int $maxLength |
| 27 | + * @property-read int $minLength |
| 28 | + * @property-read string $pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression dialect](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5)) |
| 29 | + * @property-read int $maxItems |
| 30 | + * @property-read int $minItems |
| 31 | + * @property-read bool $uniqueItems |
| 32 | + * @property-read int $maxProperties |
| 33 | + * @property-read int $minProperties |
| 34 | + * @property-read string[] $required list of required properties |
| 35 | + * @property-read array $enum |
| 36 | + * |
| 37 | + * @property-read string $type |
| 38 | + * @property-read Schema[] $allOf |
| 39 | + * @property-read Schema[] $oneOf |
| 40 | + * @property-read Schema[] $anyOf |
| 41 | + * @property-read Schema|null $not |
| 42 | + * @property-read Schema|null $items |
| 43 | + * @property-read Schema[] $properties |
| 44 | + * @property-read string $description |
| 45 | + * @property-read string $format |
| 46 | + * @property-read mixed $default |
| 47 | + * |
| 48 | + * @property-read bool $nullable |
| 49 | + * @property-read Discriminator|null $discriminator |
| 50 | + * @property-read bool $readOnly |
| 51 | + * @property-read bool $writeOnly |
| 52 | + * @property-read Xml|null $xml |
| 53 | + * @property-read ExternalDocumentation|null $externalDocs |
| 54 | + * @property-read mixed $example |
| 55 | + * @property-read bool $deprecated |
| 56 | + * |
20 | 57 | * @author Carsten Brandt <mail@cebe.cc> |
21 | 58 | */ |
22 | | -class Schema |
| 59 | +class Schema extends SpecBaseObject |
23 | 60 | { |
24 | | - // TODO implement |
| 61 | + /** |
| 62 | + * @return array array of attributes available in this object. |
| 63 | + */ |
| 64 | + protected function attributes(): array |
| 65 | + { |
| 66 | + return [ |
| 67 | + 'type' => 'string', |
| 68 | + 'allOf' => [Schema::class], // TODO allow reference |
| 69 | + 'oneOf' => [Schema::class], |
| 70 | + 'anyOf' => [Schema::class], |
| 71 | + 'not' => Schema::class, |
| 72 | + 'items' => Schema::class, |
| 73 | + 'properties' => ['string', Schema::class], |
| 74 | + //'additionalProperties' => 'boolean' | ['string', Schema::class], // TODO can be bool? |
| 75 | + 'description' => 'string', |
| 76 | + 'format' => 'string', |
| 77 | + 'default' => 'any', |
| 78 | + |
| 79 | + 'nullable' => 'boolean', |
| 80 | + 'discriminator' => Discriminator::class, |
| 81 | + 'readOnly' => 'boolean', |
| 82 | + 'writeOnly' => 'boolean', |
| 83 | + 'xml' => Xml::class, |
| 84 | + 'externalDocs' => ExternalDocumentation::class, |
| 85 | + 'example' => 'any', |
| 86 | + 'deprecated' => 'boolean', |
| 87 | + ]; |
| 88 | + } |
25 | 89 |
|
| 90 | + /** |
| 91 | + * Perform validation on this object, check data against OpenAPI Specification rules. |
| 92 | + * |
| 93 | + * Call `addError()` in case of validation errors. |
| 94 | + */ |
| 95 | + protected function performValidation() |
| 96 | + { |
| 97 | + // TODO: Implement performValidation() method. |
| 98 | + } |
26 | 99 | } |
0 commit comments