File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
# OpenAPI Definitions
2
2
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()
27
27
28
28
$ generator = new OpenApiGenerator ();
29
29
30
+ $ definition = $ generator ->generate ($ api );
31
+
30
32
$ this ->assertArraySubset (
31
33
[
32
34
'openapi ' => '3.1.0 ' ,
@@ -85,7 +87,7 @@ public function test_generates_openapi_spec()
85
87
'url ' => 'https://jsonapi.org/format/1.1/ ' ,
86
88
],
87
89
],
88
- $ generator -> generate ( $ api ) ,
90
+ $ definition ,
89
91
);
90
92
}
91
93
}
You can’t perform that action at this time.
0 commit comments