File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
test/suite/functional/Input Expand file tree Collapse file tree 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.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
66
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+
711## [ 10.9.1] - 2024.12.29
812### Fixed
913- 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
3434 return $ this ->openApi ->info ->title ;
3535 }
3636
37+ public function getVersion (): string
38+ {
39+ return $ this ->openApi ->info ->version ;
40+ }
41+
3742 public function hasLicense (): bool
3843 {
3944 $ license = $ this ->openApi ->info ->license ;
Original file line number Diff line number Diff line change @@ -236,6 +236,39 @@ public function contentTypesTestProvider(): array
236236 ];
237237 }
238238
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+
239272 protected function setUp (): void
240273 {
241274 $ container = $ this ->getContainerWith (ConfigurationBuilder::fake ()->build ());
You can’t perform that action at this time.
0 commit comments