Skip to content

Commit 55fdb44

Browse files
committed
feat: add support for Schema.xml property
1 parent b678a53 commit 55fdb44

2 files changed

Lines changed: 62 additions & 1 deletion

File tree

src/Spec/v3/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class Schema extends AbstractObject
161161
* describe the XML representation of this property.
162162
*
163163
* @see https://swagger.io/specification/#xmlObject
164-
* @var array
164+
* @var Xml
165165
*/
166166
public $xml;
167167

src/Spec/v3/Xml.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
namespace erasys\OpenApi\Spec\v3;
4+
5+
/**
6+
* A metadata object that allows for more fine-tuned XML model definitions.
7+
* When using arrays, XML element names are not inferred (for singular/plural forms)
8+
* and the name property SHOULD be used to add that information.
9+
*
10+
* See examples for expected behavior.
11+
*
12+
* @see https://swagger.io/specification/#xmlObject
13+
*/
14+
class Xml extends AbstractObject
15+
{
16+
/**
17+
* Replaces the name of the element/attribute used for the described schema property.
18+
* When defined within items, it will affect the name of the individual XML elements within the list.
19+
* When defined alongside type being array (outside the items),
20+
* it will affect the wrapping element and only if wrapped is true.
21+
*
22+
* If wrapped is false, it will be ignored.
23+
*
24+
* @var string
25+
*/
26+
public $name;
27+
28+
/**
29+
* The URI of the namespace definition. Value MUST be in the form of an absolute URI.
30+
*
31+
* @var string
32+
*/
33+
public $namespace;
34+
35+
/**
36+
* The prefix to be used for the name.
37+
*
38+
* @var string
39+
*/
40+
public $prefix;
41+
42+
/**
43+
* Declares whether the property definition translates to an attribute instead of an element.
44+
*
45+
* Default value is false.
46+
*
47+
* @var bool
48+
*/
49+
public $attribute;
50+
51+
/**
52+
* MAY be used only for an array definition. Signifies whether the array is wrapped
53+
* (for example, <books><book/><book/></books>) or unwrapped (<book/><book/>).
54+
*
55+
* Default value is false. The definition takes effect only when defined alongside
56+
* type being array (outside the items).
57+
*
58+
* @var bool
59+
*/
60+
public $wrapped;
61+
}

0 commit comments

Comments
 (0)