@backstage/backend-openapi-utils 0.0.1 → 0.0.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +7 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,18 +8,18 @@ This package is meant to provide a typed Express router for an OpenAPI spec. Bas
|
|
|
8
8
|
|
|
9
9
|
### Configuration
|
|
10
10
|
|
|
11
|
-
1. Run `yarn --cwd <package-dir> backstage-cli package schema:openapi:generate` to translate your `src/schema/openapi.yaml` to a new Typescript file in `src/schema/openapi.ts`.
|
|
11
|
+
1. Run `yarn --cwd <package-dir> backstage-cli package schema:openapi:generate` to translate your `src/schema/openapi.yaml` to a new Typescript file in `src/schema/openapi.generated.ts`. The command will try to execute both a lint and prettier step on the generated file, where applicable.
|
|
12
12
|
|
|
13
13
|
2. In your plugin's `src/service/createRouter.ts`,
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import {ApiRouter} from `@backstage/backend-openapi-utils`;
|
|
17
|
-
import spec from '../schema/openapi'
|
|
18
|
-
...
|
|
19
|
-
|
|
20
|
-
export function createRouter(){
|
|
16
|
+
import { ApiRouter } from `@backstage/backend-openapi-utils`;
|
|
17
|
+
import spec from '../schema/openapi.generated';
|
|
18
|
+
// ...
|
|
19
|
+
export function createRouter() {
|
|
21
20
|
const router = Router() as ApiRouter<typeof spec>;
|
|
22
|
-
...
|
|
21
|
+
// ...
|
|
22
|
+
return router;
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-openapi-utils",
|
|
3
3
|
"description": "OpenAPI typescript support.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2-next.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"postpack": "backstage-cli package postpack"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@backstage/cli": "^0.22.
|
|
27
|
+
"@backstage/cli": "^0.22.7-next.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|