@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-openapi-utils': minor
|
||||
---
|
||||
|
||||
Fixed a Typescript error when trying to use the new OpenAPI server-side generated code.
|
||||
@@ -30,7 +30,7 @@ export type {
|
||||
CookieParameters,
|
||||
PathParameters,
|
||||
} from './utility';
|
||||
export type { ApiRouter } from './router';
|
||||
export type { ApiRouter, TypedRouter } from './router';
|
||||
export type { PathTemplate } from './types/common';
|
||||
export { wrapInOpenApiTestServer, wrapServer } from './testUtils';
|
||||
export {
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Router } from 'express';
|
||||
import { DocRequestMatcher, RequiredDoc } from './types';
|
||||
import {
|
||||
DocRequestMatcher,
|
||||
EndpointMap,
|
||||
EndpointMapRequestMatcher,
|
||||
RequiredDoc,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* Typed Express router based on an OpenAPI 3.1 spec.
|
||||
@@ -37,3 +42,14 @@ export interface ApiRouter<Doc extends RequiredDoc> extends Router {
|
||||
|
||||
head: DocRequestMatcher<Doc, this, 'head'>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface TypedRouter<GeneratedEndpointMap extends EndpointMap>
|
||||
extends Router {
|
||||
get: EndpointMapRequestMatcher<GeneratedEndpointMap, this, 'get'>;
|
||||
post: EndpointMapRequestMatcher<GeneratedEndpointMap, this, 'post'>;
|
||||
put: EndpointMapRequestMatcher<GeneratedEndpointMap, this, 'put'>;
|
||||
delete: EndpointMapRequestMatcher<GeneratedEndpointMap, this, '_delete'>;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Router } from 'express';
|
||||
import type core from 'express-serve-static-core';
|
||||
import { PathTemplate, ValueOf } from './common';
|
||||
|
||||
@@ -209,14 +208,3 @@ export interface EndpointMapRequestMatcher<
|
||||
>
|
||||
): T;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface TypedRouter<GeneratedEndpointMap extends EndpointMap>
|
||||
extends Router {
|
||||
get: EndpointMapRequestMatcher<GeneratedEndpointMap, this, 'get'>;
|
||||
post: EndpointMapRequestMatcher<GeneratedEndpointMap, this, 'post'>;
|
||||
put: EndpointMapRequestMatcher<GeneratedEndpointMap, this, 'put'>;
|
||||
delete: EndpointMapRequestMatcher<GeneratedEndpointMap, this, '_delete'>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user