Merge pull request #28578 from backstage/fix-openapi-utils-tests-exports
openapi exports test utils under a different subpath
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
---
|
||||
'@backstage/backend-openapi-utils': minor
|
||||
---
|
||||
|
||||
**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:
|
||||
|
||||
```diff
|
||||
- import { wrapInOpenApiTestServer } from '@backstage/backend-openapi-utils';
|
||||
+ import { wrapInOpenApiTestServer } from '@backstage/backend-openapi-utils/testUtils';
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```diff
|
||||
- import { wrapServer } from '@backstage/backend-openapi-utils';
|
||||
+ import { wrapServer } from '@backstage/backend-openapi-utils/testUtils';
|
||||
```
|
||||
@@ -97,7 +97,7 @@ For more information, see [the docs](./generate-client.md).
|
||||
Add the following lines to your `createRouter.test.ts` or `router.test.ts` file,
|
||||
|
||||
```diff
|
||||
+ import { wrapInOpenApiTestServer } from '@backstage/backend-openapi-utils';
|
||||
+ import { wrapInOpenApiTestServer } from '@backstage/backend-openapi-utils/testUtils';
|
||||
+ import { Server } from 'http';
|
||||
|
||||
...
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
"role": "node-library"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.esm.js",
|
||||
"types": "dist/index.d.ts"
|
||||
"access": "public"
|
||||
},
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
@@ -18,8 +15,23 @@
|
||||
"directory": "packages/backend-openapi-utils"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./testUtils": "./src/testUtils.ts",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"testUtils": [
|
||||
"src/testUtils.ts"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
## API Report File for "@backstage/backend-openapi-utils"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Express as Express_2 } from 'express';
|
||||
import { Server } from 'http';
|
||||
|
||||
// @public
|
||||
export const wrapInOpenApiTestServer: (app: Express_2) => Server | Express_2;
|
||||
|
||||
// @public
|
||||
export function wrapServer(app: Express_2): Promise<Server>;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -3,11 +3,8 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import type { ContentObject } from 'openapi3-ts';
|
||||
import type core from 'express-serve-static-core';
|
||||
import { Express as Express_2 } from 'express';
|
||||
import { FromSchema } from 'json-schema-to-ts';
|
||||
import { JSONSchema } from 'json-schema-to-ts';
|
||||
import { middleware } from 'express-openapi-validator';
|
||||
@@ -19,7 +16,6 @@ import { RequestHandler } from 'express';
|
||||
import type { ResponseObject } from 'openapi3-ts';
|
||||
import { Router } from 'express';
|
||||
import type { SchemaObject } from 'openapi3-ts';
|
||||
import { Server } from 'http';
|
||||
|
||||
// @public
|
||||
export interface ApiRouter<Doc extends RequiredDoc> extends Router {
|
||||
@@ -925,10 +921,4 @@ type UnknownIfNever<P> = [P] extends [never] ? unknown : P;
|
||||
|
||||
// @public
|
||||
type ValueOf<T> = T[keyof T];
|
||||
|
||||
// @public
|
||||
export const wrapInOpenApiTestServer: (app: Express_2) => Server | Express_2;
|
||||
|
||||
// @public
|
||||
export function wrapServer(app: Express_2): Promise<Server>;
|
||||
```
|
||||
|
||||
@@ -32,7 +32,6 @@ export type {
|
||||
} from './utility';
|
||||
export type { ApiRouter, TypedRouter } from './router';
|
||||
export type { PathTemplate } from './types/common';
|
||||
export { wrapInOpenApiTestServer, wrapServer } from './testUtils';
|
||||
export {
|
||||
createValidatedOpenApiRouter,
|
||||
getOpenApiSpecRoute,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
|
||||
import { wrapServer } from '@backstage/backend-openapi-utils';
|
||||
import { wrapServer } from '@backstage/backend-openapi-utils/testUtils';
|
||||
import { mockCredentials, mockServices } from '@backstage/backend-test-utils';
|
||||
import type { Location } from '@backstage/catalog-client';
|
||||
import {
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { createRouter } from './router';
|
||||
import { wrapServer } from '@backstage/backend-openapi-utils';
|
||||
import { wrapServer } from '@backstage/backend-openapi-utils/testUtils';
|
||||
import { Server } from 'http';
|
||||
import {
|
||||
mockCredentials,
|
||||
|
||||
Reference in New Issue
Block a user