Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HTTP] Update doc comments on versioned router from experimental to public or internal #170887

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import type {

export type Method = Exclude<RouteMethod, 'options'>;

/** @experimental */
/** @internal */
export interface VersionedRouterRoute {
/** @experimental */
/** @internal */
method: string;
/** @experimental */
/** @internal */
path: string;
/** @experimental */
/** @internal */
options: VersionedRouteConfig<RouteMethod>;
/** @experimental */
/** @internal */
handlers: Array<{
fn: RequestHandler;
options: AddVersionOpts<unknown, unknown, unknown>;
Expand Down
38 changes: 19 additions & 19 deletions packages/core/http/core-http-server/src/versioning/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type { ApiVersion };

/**
* Configuration for a versioned route
* @experimental
* @public
*/
export type VersionedRouteConfig<Method extends RouteMethod> = Omit<
RouteConfig<unknown, unknown, unknown, Method>,
Expand All @@ -49,7 +49,7 @@ export type VersionedRouteConfig<Method extends RouteMethod> = Omit<
* @note When enabled `apiVersion` is a reserved query parameter and will not
* be passed to the route handler or handler validation.
* @note `apiVersion` is a reserved query parameter, avoid using it
* @experimental
* @public
* @default false
*/
enableQueryVersion?: boolean;
Expand All @@ -60,7 +60,7 @@ export type VersionedRouteConfig<Method extends RouteMethod> = Omit<
*
* @param config - The route configuration
* @returns A versioned route
* @experimental
* @public
*/
export type VersionedRouteRegistrar<Method extends RouteMethod, Ctx extends RqCtx = RqCtx> = (
config: VersionedRouteConfig<Method>
Expand Down Expand Up @@ -155,85 +155,85 @@ export type VersionedRouteRegistrar<Method extends RouteMethod, Ctx extends RqCt
* }
* );

* @experimental
* @public
*/
export interface VersionedRouter<Ctx extends RqCtx = RqCtx> {
/**
* @experimental
* @public
* @track-adoption
*/
get: VersionedRouteRegistrar<'get', Ctx>;
/**
* @experimental
* @public
* @track-adoption
*/
put: VersionedRouteRegistrar<'put', Ctx>;
/**
* @experimental
* @public
* @track-adoption
*/
post: VersionedRouteRegistrar<'post', Ctx>;
/**
* @experimental
* @public
* @track-adoption
*/
patch: VersionedRouteRegistrar<'patch', Ctx>;
/**
* @experimental
* @public
* @track-adoption
*/
delete: VersionedRouteRegistrar<'delete', Ctx>;
}

/** @experimental */
/** @public */
export type VersionedRouteRequestValidation<P, Q, B> = RouteValidatorFullConfig<P, Q, B>;

/** @experimental */
/** @public */
export interface VersionedRouteResponseValidation {
[statusCode: number]: { body: RouteValidationFunction<unknown> | Type<unknown> };
unsafe?: { body?: boolean };
}

/**
* Versioned route validation
* @experimental
* @public
*/
export interface FullValidationConfig<P, Q, B> {
/**
* Validation to run against route inputs: params, query and body
* @experimental
* @public
*/
request?: VersionedRouteRequestValidation<P, Q, B>;
/**
* Validation to run against route output
* @note This validation is only intended to run in development. Do not use this
* for setting default values!
* @experimental
* @public
*/
response?: VersionedRouteResponseValidation;
}

/**
* Options for a versioned route. Probably needs a lot more options like sunsetting
* of an endpoint etc.
* @experimental
* @public
*/
export interface AddVersionOpts<P, Q, B> {
/**
* Version to assign to this route
* @experimental
* @public
*/
version: ApiVersion;
/**
* Validation for this version of a route
* @experimental
* @public
*/
validate: false | FullValidationConfig<P, Q, B>;
}

/**
* A versioned route
* @experimental
* @public
*/
export interface VersionedRoute<
Method extends RouteMethod = RouteMethod,
Expand All @@ -244,7 +244,7 @@ export interface VersionedRoute<
* @param opts {@link AddVersionOpts | Options} for this version of a route
* @param handler The request handler for this version of a route
* @returns A versioned route, allows for fluent chaining of version declarations
* @experimental
* @public
*/
addVersion<P = unknown, Q = unknown, B = unknown>(
options: AddVersionOpts<P, Q, B>,
Expand Down
Loading