Skip to content

Commit 0c0c9de

Browse files
committed
Improve OpenAPI builder
1 parent a383b56 commit 0c0c9de

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

api.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -8175,17 +8175,13 @@ private function getServerUrl(): string
81758175
return sprintf('%s://%s%s/%s', $protocol, $host, $port, $path);
81768176
}
81778177

8178-
public function build() /*: void */
8178+
public function build(): OpenApiDefinition
81798179
{
81808180
$this->openapi->set("openapi", "3.0.0");
81818181
if (!$this->openapi->has("servers") && isset($_SERVER['REQUEST_URI'])) {
81828182
$this->openapi->set("servers|0|url", $this->getServerUrl());
81838183
}
81848184
$this->records->build();
8185-
}
8186-
8187-
public function getDefinition(): OpenApiDefinition
8188-
{
81898185
return $this->openapi;
81908186
}
81918187
}

src/Tqdev/PhpCrudApi/OpenApi/OpenApiBuilder.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,13 @@ private function getServerUrl(): string
2828
return sprintf('%s://%s%s/%s', $protocol, $host, $port, $path);
2929
}
3030

31-
public function build() /*: void */
31+
public function build(): OpenApiDefinition
3232
{
3333
$this->openapi->set("openapi", "3.0.0");
3434
if (!$this->openapi->has("servers") && isset($_SERVER['REQUEST_URI'])) {
3535
$this->openapi->set("servers|0|url", $this->getServerUrl());
3636
}
3737
$this->records->build();
38-
}
39-
40-
public function getDefinition(): OpenApiDefinition
41-
{
4238
return $this->openapi;
4339
}
4440
}

0 commit comments

Comments
 (0)