File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 11# OpenAPI Definitions
22
3- Coming soon...
3+ You can generate an OpenAPI 3.1.0 Definition for your API using the
4+ ` OpenApiGenerator ` class.
5+
6+ ``` php
7+ use Tobyz\JsonApiServer\JsonApi;
8+ use Tobyz\JsonApiServer\OpenApi\OpenApiGenerator;
9+
10+ $api = new JsonApi();
11+
12+ $definition = (new OpenApiGenerator())->generate($api);
13+ ```
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ public function test_generates_openapi_spec()
2727
2828 $ generator = new OpenApiGenerator ();
2929
30+ $ definition = $ generator ->generate ($ api );
31+
3032 $ this ->assertArraySubset (
3133 [
3234 'openapi ' => '3.1.0 ' ,
@@ -85,7 +87,7 @@ public function test_generates_openapi_spec()
8587 'url ' => 'https://jsonapi.org/format/1.1/ ' ,
8688 ],
8789 ],
88- $ generator -> generate ( $ api ) ,
90+ $ definition ,
8991 );
9092 }
9193}
You can’t perform that action at this time.
0 commit comments