Skip to content

Commit 484910d

Browse files
chore: add support for new error response (#731)
1 parent bafea0c commit 484910d

File tree

6 files changed

+288
-6
lines changed

6 files changed

+288
-6
lines changed
Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
openapi: 3.1.0
2+
info:
3+
title: AllOf Test Service
4+
description: Test specification for various allOf scenarios
5+
version: 1.0.0
6+
contact:
7+
name: 'AllOf Test Service'
8+
license:
9+
name: Apache 2.0
10+
url: https://www.apache.org/licenses/LICENSE-2.0.html
11+
x-twilio:
12+
apiStandards: v1.0
13+
servers:
14+
- url: https://allof.test.com
15+
paths:
16+
/v1/basic-allof:
17+
post:
18+
operationId: CreateBasicAllOf
19+
summary: Test basic allOf with multiple schemas
20+
requestBody:
21+
required: true
22+
content:
23+
application/json:
24+
schema:
25+
allOf:
26+
- type: object
27+
required: [ id ]
28+
properties:
29+
id:
30+
type: string
31+
example: "123"
32+
- type: object
33+
required: [ name ]
34+
properties:
35+
name:
36+
type: string
37+
example: "Test Entity"
38+
- type: object
39+
properties:
40+
timestamp:
41+
type: string
42+
format: date-time
43+
responses:
44+
'200':
45+
description: Success
46+
content:
47+
application/json:
48+
schema:
49+
$ref: '#/components/schemas/BasicAllOf'
50+
51+
/v1/nested-allof:
52+
post:
53+
operationId: CreateNestedAllOf
54+
summary: Test nested allOf
55+
requestBody:
56+
required: true
57+
content:
58+
application/json:
59+
schema:
60+
$ref: '#/components/schemas/NestedAllOf'
61+
responses:
62+
'200':
63+
description: Success
64+
65+
/v1/allof-with-refs:
66+
post:
67+
operationId: CreateAllOfWithRefs
68+
summary: Test allOf with schema references
69+
requestBody:
70+
required: true
71+
content:
72+
application/json:
73+
schema:
74+
$ref: '#/components/schemas/AllOfWithRefs'
75+
responses:
76+
'200':
77+
description: Success
78+
content:
79+
application/json:
80+
schema:
81+
$ref: '#/components/schemas/AllOfWithRefs'
82+
83+
/v1/allof-inline-and-ref:
84+
post:
85+
operationId: CreateMixedAllOf
86+
summary: Test allOf mixing inline schemas and refs
87+
requestBody:
88+
required: true
89+
content:
90+
application/json:
91+
schema:
92+
allOf:
93+
- $ref: '#/components/schemas/BaseEntity'
94+
- type: object
95+
required: [ specificField ]
96+
properties:
97+
specificField:
98+
type: string
99+
extraData:
100+
type: object
101+
responses:
102+
'200':
103+
description: Success
104+
105+
/v1/allof-with-oneof:
106+
post:
107+
operationId: CreateAllOfWithOneOf
108+
summary: Test allOf combined with oneOf
109+
requestBody:
110+
required: true
111+
content:
112+
application/json:
113+
schema:
114+
$ref: '#/components/schemas/AllOfWithOneOf'
115+
responses:
116+
'200':
117+
description: Success
118+
119+
components:
120+
schemas:
121+
# Basic allOf with refs
122+
BasicAllOf:
123+
allOf:
124+
- $ref: '#/components/schemas/Identifiable'
125+
- $ref: '#/components/schemas/Nameable'
126+
- $ref: '#/components/schemas/Timestamped'
127+
128+
# Nested allOf
129+
NestedAllOf:
130+
allOf:
131+
- type: object
132+
properties:
133+
outerField:
134+
type: string
135+
- allOf:
136+
- $ref: '#/components/schemas/BaseEntity'
137+
- type: object
138+
properties:
139+
nestedField:
140+
type: string
141+
142+
# AllOf with multiple schema refs
143+
AllOfWithRefs:
144+
allOf:
145+
- $ref: '#/components/schemas/BaseEntity'
146+
- $ref: '#/components/schemas/Auditable'
147+
- $ref: '#/components/schemas/Versioned'
148+
149+
# AllOf combined with oneOf
150+
AllOfWithOneOf:
151+
allOf:
152+
- type: object
153+
required: [ entityType ]
154+
properties:
155+
entityType:
156+
type: string
157+
commonField:
158+
type: string
159+
- oneOf:
160+
- $ref: '#/components/schemas/TypeA'
161+
- $ref: '#/components/schemas/TypeB'
162+
163+
# AllOf with additionalProperties
164+
AllOfWithAdditionalProps:
165+
allOf:
166+
- $ref: '#/components/schemas/BaseEntity'
167+
- type: object
168+
properties:
169+
knownField:
170+
type: string
171+
additionalProperties:
172+
type: string
173+
174+
# AllOf with discriminator
175+
AllOfWithDiscriminator:
176+
allOf:
177+
- type: object
178+
required: [ objectType ]
179+
properties:
180+
objectType:
181+
type: string
182+
discriminator:
183+
propertyName: objectType
184+
mapping:
185+
cat: '#/components/schemas/Cat'
186+
dog: '#/components/schemas/Dog'
187+
- oneOf:
188+
- $ref: '#/components/schemas/Cat'
189+
- $ref: '#/components/schemas/Dog'
190+
191+
# Base schemas
192+
Identifiable:
193+
type: object
194+
required: [ id ]
195+
properties:
196+
id:
197+
type: string
198+
199+
Nameable:
200+
type: object
201+
required: [ name ]
202+
properties:
203+
name:
204+
type: string
205+
206+
Timestamped:
207+
type: object
208+
properties:
209+
createdAt:
210+
type: string
211+
format: date-time
212+
updatedAt:
213+
type: string
214+
format: date-time
215+
216+
BaseEntity:
217+
type: object
218+
required: [ id, createdAt ]
219+
properties:
220+
id:
221+
type: string
222+
createdAt:
223+
type: string
224+
format: date-time
225+
226+
Auditable:
227+
type: object
228+
properties:
229+
createdBy:
230+
type: string
231+
modifiedBy:
232+
type: string
233+
234+
Versioned:
235+
type: object
236+
properties:
237+
version:
238+
type: integer
239+
240+
TypeA:
241+
type: object
242+
required: [ fieldA ]
243+
properties:
244+
fieldA:
245+
type: string
246+
dataA:
247+
type: integer
248+
249+
TypeB:
250+
type: object
251+
required: [ fieldB ]
252+
properties:
253+
fieldB:
254+
type: boolean
255+
dataB:
256+
type: array
257+
items:
258+
type: string
259+
260+
Cat:
261+
type: object
262+
properties:
263+
objectType:
264+
type: string
265+
enum: [cat]
266+
meow:
267+
type: boolean
268+
269+
Dog:
270+
type: object
271+
properties:
272+
objectType:
273+
type: string
274+
enum: [dog]
275+
bark:
276+
type: boolean

src/main/resources/twilio-php/context.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class {{apiName}}Context extends InstanceContext
4949
Version $version{{#requiredPathParams}},
5050
${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}{{/requiredPathParams}}
5151
) {
52-
parent::__construct($version);
52+
{{^isApiV1}}parent::__construct($version);{{/isApiV1}}{{#isApiV1}}$apiV1Version = new ApiV1Version($version->getDomain(), $version->version);
53+
parent::__construct($apiV1Version);{{/isApiV1}}
5354

5455
// Path Solution
5556
$this->solution = [{{#requiredPathParams}}

src/main/resources/twilio-php/imports.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use Twilio\Options;
55
use Twilio\Stream;
66
use Twilio\Values;
77
use Twilio\Version;
8+
use Twilio\ApiV1Version;
89
use Twilio\InstanceContext;
910
use Twilio\Deserialize;
1011
use Twilio\Serialize;
@@ -14,4 +15,4 @@ use Twilio\Rest\{{domainName}}\{{apiVersionClass}}\{{parent}}List;
1415
{{/metaProperties.listImportProperties}}
1516
{{#metaProperties.contextImportProperties}}
1617
use Twilio\Rest\{{domainName}}\{{apiVersionClass}}\{{parent}}List;
17-
{{/metaProperties.contextImportProperties}}
18+
{{/metaProperties.contextImportProperties}}

src/main/resources/twilio-php/instance.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class {{apiName}}Instance extends InstanceResource
3333
*/
3434
public function __construct(Version $version, array $payload{{#requiredPathParams}}{{#vendorExtensions.x-is-parent-param}}, {{{dataType}}} ${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}{{/vendorExtensions.x-is-parent-param}}{{^vendorExtensions.x-is-parent-param}}, ?{{{dataType}}} ${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}} = null{{/vendorExtensions.x-is-parent-param}}{{/requiredPathParams}})
3535
{
36-
parent::__construct($version);
36+
{{^isApiV1}}parent::__construct($version);{{/isApiV1}}{{#isApiV1}}$apiV1Version = new ApiV1Version($version->getDomain(), $version->version);
37+
parent::__construct($apiV1Version);{{/isApiV1}}
3738

3839
{{#responseModels.0}}
3940
// Marshaled Properties

src/main/resources/twilio-php/list.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class {{apiName}}List extends ListResource
5050
Version $version{{#requiredPathParams}}{{#vendorExtensions.x-is-parent-param}},
5151
{{{dataType}}} ${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}{{/vendorExtensions.x-is-parent-param}}{{/requiredPathParams}}
5252
) {
53-
parent::__construct($version);
53+
{{^isApiV1}}parent::__construct($version);{{/isApiV1}}{{#isApiV1}}$apiV1Version = new ApiV1Version($version->getDomain(), $version->version);
54+
parent::__construct($apiV1Version);{{/isApiV1}}
5455

5556
// Path Solution
5657
$this->solution = [{{#requiredPathParams}}{{#vendorExtensions.x-is-parent-param}}

src/main/resources/twilio-php/page.mustache

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ namespace Twilio\Rest\{{domainName}}\{{version}}{{namespaceSubPart}};
55

66
use Twilio\Http\Response;
77
use Twilio\Page;{{#isApiV1}}
8-
use Twilio\TokenPaginationPage;{{/isApiV1}}
8+
use Twilio\TokenPaginationPage;
9+
use Twilio\ApiV1Version;{{/isApiV1}}
910
use Twilio\Version;
1011

1112
class {{apiName}}Page extends {{#isApiV1}}TokenPaginationPage{{/isApiV1}}{{^isApiV1}}Page{{/isApiV1}}
@@ -17,7 +18,8 @@ class {{apiName}}Page extends {{#isApiV1}}TokenPaginationPage{{/isApiV1}}{{^isAp
1718
*/
1819
public function __construct(Version $version, Response $response, array $solution)
1920
{
20-
parent::__construct($version, $response);
21+
{{^isApiV1}}parent::__construct($version, $response);{{/isApiV1}}{{#isApiV1}}$apiV1Version = new ApiV1Version($version->getDomain(), $version->version);
22+
parent::__construct($apiV1Version, $response);{{/isApiV1}}
2123

2224
// Path Solution
2325
$this->solution = $solution;

0 commit comments

Comments
 (0)