@backstage/backend-openapi-utils 0.4.1 → 0.5.0-next.1
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 +34 -0
- package/dist/index.cjs.js +0 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -23
- package/dist/testUtils.d.ts +24 -0
- package/package.json +33 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @backstage/backend-openapi-utils
|
|
2
2
|
|
|
3
|
+
## 0.5.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 700d32b: **BREAKING**: The `wrapInOpenApiTestServer` and `wrapServer` functions are now exported via `/testUtils` subpath. If you were importing these functions directly from the root of the package, you will need to update your imports to use the `/testUtils` subpath:
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
- import { wrapInOpenApiTestServer } from '@backstage/backend-openapi-utils';
|
|
11
|
+
+ import { wrapInOpenApiTestServer } from '@backstage/backend-openapi-utils/testUtils';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
or
|
|
15
|
+
|
|
16
|
+
```diff
|
|
17
|
+
- import { wrapServer } from '@backstage/backend-openapi-utils';
|
|
18
|
+
+ import { wrapServer } from '@backstage/backend-openapi-utils/testUtils';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/backend-plugin-api@1.2.0-next.0
|
|
25
|
+
- @backstage/errors@1.2.7
|
|
26
|
+
- @backstage/types@1.2.1
|
|
27
|
+
|
|
28
|
+
## 0.4.2-next.0
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
- @backstage/backend-plugin-api@1.2.0-next.0
|
|
34
|
+
- @backstage/errors@1.2.7
|
|
35
|
+
- @backstage/types@1.2.1
|
|
36
|
+
|
|
3
37
|
## 0.4.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./types/index.cjs.js');
|
|
4
|
-
var testUtils = require('./testUtils.cjs.js');
|
|
5
4
|
var stub = require('./stub.cjs.js');
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
exports.internal = index;
|
|
10
|
-
exports.wrapInOpenApiTestServer = testUtils.wrapInOpenApiTestServer;
|
|
11
|
-
exports.wrapServer = testUtils.wrapServer;
|
|
12
9
|
exports.createValidatedOpenApiRouter = stub.createValidatedOpenApiRouter;
|
|
13
10
|
exports.createValidatedOpenApiRouterFromGeneratedEndpointMap = stub.createValidatedOpenApiRouterFromGeneratedEndpointMap;
|
|
14
11
|
exports.getOpenApiSpecRoute = stub.getOpenApiSpecRoute;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { JSONSchema, FromSchema } from 'json-schema-to-ts';
|
|
3
2
|
import { ReferenceObject, OpenAPIObject, ContentObject, RequestBodyObject, ResponseObject, ParameterObject, SchemaObject } from 'openapi3-ts';
|
|
4
3
|
import core from 'express-serve-static-core';
|
|
5
|
-
import { Router,
|
|
6
|
-
import { Server } from 'http';
|
|
4
|
+
import { Router, RequestHandler } from 'express';
|
|
7
5
|
import { middleware } from 'express-openapi-validator';
|
|
8
6
|
|
|
9
7
|
/**
|
|
@@ -611,25 +609,6 @@ interface TypedRouter<GeneratedEndpointMap extends EndpointMap> extends Router {
|
|
|
611
609
|
delete: EndpointMapRequestMatcher<GeneratedEndpointMap, this, '_delete'>;
|
|
612
610
|
}
|
|
613
611
|
|
|
614
|
-
/**
|
|
615
|
-
* !!! THIS CURRENTLY ONLY SUPPORTS SUPERTEST !!!
|
|
616
|
-
* Setup a server with a custom OpenAPI proxy. This proxy will capture all requests and responses and make sure they
|
|
617
|
-
* conform to the spec.
|
|
618
|
-
* @param app - express server, needed to ensure we have the correct ports for the proxy.
|
|
619
|
-
* @returns - a configured HTTP server that should be used with supertest.
|
|
620
|
-
* @public
|
|
621
|
-
*/
|
|
622
|
-
declare function wrapServer(app: Express): Promise<Server>;
|
|
623
|
-
/**
|
|
624
|
-
* !!! THIS CURRENTLY ONLY SUPPORTS SUPERTEST !!!
|
|
625
|
-
* Running against supertest, we need some way to hit the optic proxy. This ensures that
|
|
626
|
-
* that happens at runtime when in the context of a `yarn optic capture` command.
|
|
627
|
-
* @param app - Express router that would be passed to supertest's `request`.
|
|
628
|
-
* @returns A wrapper around the express router (or the router untouched) that still works with supertest.
|
|
629
|
-
* @public
|
|
630
|
-
*/
|
|
631
|
-
declare const wrapInOpenApiTestServer: (app: Express) => Server | Express;
|
|
632
|
-
|
|
633
612
|
/**
|
|
634
613
|
* Given a base url for a plugin, find the given OpenAPI spec for that plugin.
|
|
635
614
|
* @param baseUrl - Plugin base url.
|
|
@@ -660,4 +639,4 @@ declare function createValidatedOpenApiRouterFromGeneratedEndpointMap<T extends
|
|
|
660
639
|
middleware?: RequestHandler[];
|
|
661
640
|
}): TypedRouter<T>;
|
|
662
641
|
|
|
663
|
-
export { type ApiRouter, type CookieParameters, type HeaderParameters, type PathParameters, type PathTemplate, type QueryParameters, type Request, type Response, type TypedRouter, createValidatedOpenApiRouter, createValidatedOpenApiRouterFromGeneratedEndpointMap, getOpenApiSpecRoute, index_d as internal
|
|
642
|
+
export { type ApiRouter, type CookieParameters, type HeaderParameters, type PathParameters, type PathTemplate, type QueryParameters, type Request, type Response, type TypedRouter, createValidatedOpenApiRouter, createValidatedOpenApiRouterFromGeneratedEndpointMap, getOpenApiSpecRoute, index_d as internal };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Express } from 'express';
|
|
3
|
+
import { Server } from 'http';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* !!! THIS CURRENTLY ONLY SUPPORTS SUPERTEST !!!
|
|
7
|
+
* Setup a server with a custom OpenAPI proxy. This proxy will capture all requests and responses and make sure they
|
|
8
|
+
* conform to the spec.
|
|
9
|
+
* @param app - express server, needed to ensure we have the correct ports for the proxy.
|
|
10
|
+
* @returns - a configured HTTP server that should be used with supertest.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
declare function wrapServer(app: Express): Promise<Server>;
|
|
14
|
+
/**
|
|
15
|
+
* !!! THIS CURRENTLY ONLY SUPPORTS SUPERTEST !!!
|
|
16
|
+
* Running against supertest, we need some way to hit the optic proxy. This ensures that
|
|
17
|
+
* that happens at runtime when in the context of a `yarn optic capture` command.
|
|
18
|
+
* @param app - Express router that would be passed to supertest's `request`.
|
|
19
|
+
* @returns A wrapper around the express router (or the router untouched) that still works with supertest.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
declare const wrapInOpenApiTestServer: (app: Express) => Server | Express;
|
|
23
|
+
|
|
24
|
+
export { wrapInOpenApiTestServer, wrapServer };
|
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-openapi-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-next.1",
|
|
4
4
|
"description": "OpenAPI typescript support.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
7
7
|
},
|
|
8
8
|
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
10
|
-
"main": "dist/index.cjs.js",
|
|
11
|
-
"module": "dist/index.esm.js",
|
|
12
|
-
"types": "dist/index.d.ts"
|
|
9
|
+
"access": "public"
|
|
13
10
|
},
|
|
14
11
|
"homepage": "https://backstage.io",
|
|
15
12
|
"repository": {
|
|
@@ -18,8 +15,31 @@
|
|
|
18
15
|
"directory": "packages/backend-openapi-utils"
|
|
19
16
|
},
|
|
20
17
|
"license": "Apache-2.0",
|
|
21
|
-
"
|
|
22
|
-
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"require": "./dist/index.cjs.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.cjs.js"
|
|
23
|
+
},
|
|
24
|
+
"./testUtils": {
|
|
25
|
+
"require": "./dist/testUtils.cjs.js",
|
|
26
|
+
"types": "./dist/testUtils.d.ts",
|
|
27
|
+
"default": "./dist/testUtils.cjs.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.cjs.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"typesVersions": {
|
|
34
|
+
"*": {
|
|
35
|
+
"index": [
|
|
36
|
+
"dist/index.d.ts"
|
|
37
|
+
],
|
|
38
|
+
"testUtils": [
|
|
39
|
+
"dist/testUtils.d.ts"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
23
43
|
"files": [
|
|
24
44
|
"dist"
|
|
25
45
|
],
|
|
@@ -34,9 +54,9 @@
|
|
|
34
54
|
},
|
|
35
55
|
"dependencies": {
|
|
36
56
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
37
|
-
"@backstage/backend-plugin-api": "
|
|
38
|
-
"@backstage/errors": "
|
|
39
|
-
"@backstage/types": "
|
|
57
|
+
"@backstage/backend-plugin-api": "1.2.0-next.0",
|
|
58
|
+
"@backstage/errors": "1.2.7",
|
|
59
|
+
"@backstage/types": "1.2.1",
|
|
40
60
|
"@types/express": "^4.17.6",
|
|
41
61
|
"@types/express-serve-static-core": "^4.17.5",
|
|
42
62
|
"ajv": "^8.16.0",
|
|
@@ -51,17 +71,9 @@
|
|
|
51
71
|
"openapi3-ts": "^3.1.2"
|
|
52
72
|
},
|
|
53
73
|
"devDependencies": {
|
|
54
|
-
"@backstage/cli": "
|
|
55
|
-
"@backstage/test-utils": "
|
|
74
|
+
"@backstage/cli": "0.30.0-next.1",
|
|
75
|
+
"@backstage/test-utils": "1.7.5-next.0",
|
|
56
76
|
"msw": "^1.0.0",
|
|
57
77
|
"supertest": "^7.0.0"
|
|
58
|
-
}
|
|
59
|
-
"typesVersions": {
|
|
60
|
-
"*": {
|
|
61
|
-
"index": [
|
|
62
|
-
"dist/index.d.ts"
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"module": "dist/index.esm.js"
|
|
78
|
+
}
|
|
67
79
|
}
|