File tree Expand file tree Collapse file tree 1 file changed +108
-0
lines changed Expand file tree Collapse file tree 1 file changed +108
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,114 @@ public function testSymfonyYamlBugHunt()
128128 $ this ->assertEquals ($ expectedArray , $ inlineYamlExample );
129129 }
130130
131+ public function testGetRawSpecData ()
132+ {
133+ $ spec = <<<YML
134+ openapi: "3.0.0"
135+ info:
136+ version: 1.0.0
137+ title: Check storage of raw spec data
138+
139+ paths:
140+ /:
141+ get:
142+ summary: List
143+ operationId: list
144+ responses:
145+ '200':
146+ description: The information
147+
148+ components:
149+ schemas:
150+ User:
151+ type: object
152+ properties:
153+ id:
154+ type: integer
155+ name:
156+ type: string
157+
158+ Post:
159+ type: object
160+ properties:
161+ id:
162+ type: integer
163+ title:
164+ type: string
165+ user:
166+ \$ref: "#/components/schemas/User"
167+
168+ YML ;
169+
170+ $ openapi = \cebe \openapi \Reader::readFromYaml ($ spec );
171+ $ this ->assertSame ($ openapi ->getRawSpecData (), [
172+ 'openapi ' => '3.0.0 ' ,
173+ 'info ' => [
174+ 'version ' => '1.0.0 ' ,
175+ 'title ' => 'Check storage of raw spec data ' ,
176+ ],
177+ 'paths ' => [
178+ '/ ' => [
179+ 'get ' => [
180+ 'summary ' => 'List ' ,
181+ 'operationId ' => 'list ' ,
182+ 'responses ' => [
183+ '200 ' => [
184+ 'description ' => 'The information ' ,
185+ ]
186+ ]
187+ ]
188+ ]
189+ ],
190+ 'components ' => [
191+ 'schemas ' => [
192+ 'User ' => [
193+ 'type ' => 'object ' ,
194+ 'properties ' => [
195+ 'id ' => [
196+ 'type ' => 'integer ' ,
197+ ],
198+ 'name ' => [
199+ 'type ' => 'string ' ,
200+ ]
201+ ]
202+ ],
203+ 'Post ' => [
204+ 'type ' => 'object ' ,
205+ 'properties ' => [
206+ 'id ' => [
207+ 'type ' => 'integer ' ,
208+ ],
209+ 'title ' => [
210+ 'type ' => 'string ' ,
211+ ],
212+ 'user ' => [
213+ '$ref ' => '#/components/schemas/User ' ,
214+ ]
215+ ]
216+ ]
217+ ]
218+ ]
219+ ]);
220+
221+ $ this ->assertSame ($ openapi ->components ->schemas ['User ' ]->getRawSpecData (), [
222+ 'type ' => 'object ' ,
223+ 'properties ' => [
224+ 'id ' => [
225+ 'type ' => 'integer ' ,
226+ ],
227+ 'name ' => [
228+ 'type ' => 'string ' ,
229+ ]
230+ ]
231+ ]);
232+
233+ $ this ->assertSame ($ openapi ->components ->schemas ['Post ' ]->properties ['user ' ]->getRawSpecData (), [
234+ '$ref ' => '#/components/schemas/User ' ,
235+ ]);
236+
237+ }
238+
131239
132240 // TODO test invalid JSON
133241 // TODO test invalid YAML
You can’t perform that action at this time.
0 commit comments