File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -139,9 +139,11 @@ protected function populateServers()
139
139
{
140
140
if (config ('l5-swagger.paths.base ' ) !== null ) {
141
141
if ($ this ->isOpenApi ()) {
142
- $ this ->swagger ->servers = [
143
- new \OpenApi \Annotations \Server (['url ' => config ('l5-swagger.paths.base ' )]),
144
- ];
142
+ if (! is_array ($ this ->swagger ->servers )) {
143
+ $ this ->swagger ->servers = [];
144
+ }
145
+
146
+ $ this ->swagger ->servers [] = new \OpenApi \Annotations \Server (['url ' => config ('l5-swagger.paths.base ' )]);
145
147
}
146
148
147
149
if (! $ this ->isOpenApi ()) {
Original file line number Diff line number Diff line change @@ -91,11 +91,13 @@ public function canGenerateApiJsonFileWithChangedBaseServer()
91
91
92
92
$ this ->get (route ('l5-swagger.docs ' ))
93
93
->assertSee ('https://test-server.url ' )
94
+ ->assertSee ('https://projects.dev/api/v1 ' )
94
95
->assertDontSee ('basePath ' )
95
96
->assertStatus (200 );
96
97
97
98
$ this ->get (route ('l5-swagger.docs ' , ['jsonFile ' => config ('l5-swagger.paths.docs_yaml ' )]))
98
99
->assertSee ('https://test-server.url ' )
100
+ ->assertSee ('https://projects.dev/api/v1 ' )
99
101
->assertDontSee ('basePath ' )
100
102
->assertStatus (200 );
101
103
}
You can’t perform that action at this time.
0 commit comments