File tree 3 files changed +42
-0
lines changed
test/suite/functional/Input
3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ 10.10.0] - 2025.02.12
8
+ ### Added
9
+ - ` Specification::getVersion() ` method, which optionally might be used in a composer.json.twig ` "version": "{{ specification.getVersion() }}" `
10
+
7
11
## [ 10.9.1] - 2024.12.29
8
12
### Fixed
9
13
- Array to string conversion in maxItems in minItems constraints
Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ public function getTitle(): string
34
34
return $ this ->openApi ->info ->title ;
35
35
}
36
36
37
+ public function getVersion (): string
38
+ {
39
+ return $ this ->openApi ->info ->version ;
40
+ }
41
+
37
42
public function hasLicense (): bool
38
43
{
39
44
$ license = $ this ->openApi ->info ->license ;
Original file line number Diff line number Diff line change @@ -236,6 +236,39 @@ public function contentTypesTestProvider(): array
236
236
];
237
237
}
238
238
239
+ public function testGetFromInfo (): void
240
+ {
241
+ $ data = [
242
+ 'openapi ' => '3.0.0 ' ,
243
+ 'info ' => [
244
+ 'title ' => 'Sample API ' ,
245
+ 'version ' => '1.2.3 ' ,
246
+ ],
247
+ 'paths ' => [
248
+ '/foo/bar ' => [
249
+ 'get ' => [
250
+ 'operationId ' => 'getFooBar ' ,
251
+ 'responses ' => [
252
+ '200 ' => [
253
+ 'description ' => 'Ge ' ,
254
+ ],
255
+ ],
256
+ ],
257
+ ],
258
+ ],
259
+ ];
260
+ $ specification = $ this ->sut ->parse ($ data , '/openapi.yaml ' );
261
+ static ::assertSame ('1.2.3 ' , $ specification ->getVersion ());
262
+ static ::assertSame ('Sample API ' , $ specification ->getTitle ());
263
+ static ::assertSame (false , $ specification ->hasLicense ());
264
+
265
+ $ data ['info ' ]['license ' ]['name ' ] = 'License name ' ;
266
+
267
+ $ specificationWithLicense = $ this ->sut ->parse ($ data , '/openapi.yaml ' );
268
+ static ::assertSame (true , $ specificationWithLicense ->hasLicense ());
269
+ static ::assertSame ('License name ' , $ specificationWithLicense ->getLicenseName ());
270
+ }
271
+
239
272
protected function setUp (): void
240
273
{
241
274
$ container = $ this ->getContainerWith (ConfigurationBuilder::fake ()->build ());
You can’t perform that action at this time.
0 commit comments