|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @file ATTENTION!!! The code below was carefully crafted by a mean machine. |
|
4
|
|
|
* Please consider to NOT put any emotional human-generated modifications as AI will throw them away with no mercy. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Swaggest\JsonSchema\SwaggerSchema; |
|
8
|
|
|
|
|
9
|
|
|
use Swaggest\JsonSchema\Constraint\Properties; |
|
10
|
|
|
use Swaggest\JsonSchema\Schema as Schema1; |
|
11
|
|
|
use Swaggest\JsonSchema\Structure\ClassStructure; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
class BodyParameter extends ClassStructure { |
|
15
|
|
|
/** @var string A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. */ |
|
16
|
|
|
public $description; |
|
17
|
|
|
|
|
18
|
|
|
/** @var string The name of the parameter. */ |
|
19
|
|
|
public $name; |
|
20
|
|
|
|
|
21
|
|
|
/** @var string Determines the location of the parameter. */ |
|
22
|
|
|
public $in; |
|
23
|
|
|
|
|
24
|
|
|
/** @var bool Determines whether or not this parameter is required or optional. */ |
|
25
|
|
|
public $required; |
|
26
|
|
|
|
|
27
|
|
|
/** @var Schema A deterministic version of a JSON Schema object. */ |
|
28
|
|
|
public $schema; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @param Properties|static $properties |
|
32
|
|
|
* @param Schema1 $ownerSchema |
|
33
|
|
|
*/ |
|
34
|
|
|
public static function setUpProperties($properties, Schema1 $ownerSchema) |
|
35
|
|
|
{ |
|
36
|
|
|
$properties->description = Schema1::string(); |
|
37
|
|
|
$properties->description->description = 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.'; |
|
|
|
|
|
|
38
|
|
|
$properties->name = Schema1::string(); |
|
39
|
|
|
$properties->name->description = 'The name of the parameter.'; |
|
|
|
|
|
|
40
|
|
|
$properties->in = Schema1::string(); |
|
41
|
|
|
$properties->in->description = 'Determines the location of the parameter.'; |
|
|
|
|
|
|
42
|
|
|
$properties->in->enum = array ( |
|
43
|
|
|
0 => 'body', |
|
44
|
|
|
); |
|
45
|
|
|
$properties->required = Schema1::boolean(); |
|
46
|
|
|
$properties->required->description = 'Determines whether or not this parameter is required or optional.'; |
|
|
|
|
|
|
47
|
|
|
$properties->required->default = false; |
|
|
|
|
|
|
48
|
|
|
$properties->schema = Schema::schema(); |
|
49
|
|
|
$ownerSchema->type = 'object'; |
|
|
|
|
|
|
50
|
|
|
$ownerSchema->additionalProperties = false; |
|
51
|
|
|
$ownerSchema->patternProperties['^x-'] = new Schema1(); |
|
52
|
|
|
$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
|
|
|
|
|
|
53
|
|
|
$ownerSchema->required = array ( |
|
54
|
|
|
0 => 'name', |
|
55
|
|
|
1 => 'in', |
|
56
|
|
|
2 => 'schema', |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
|
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.