Skip to content

Commit

Permalink
updated doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Nov 8, 2023
1 parent 552e87b commit d9bf5a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
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

0 comments on commit d9bf5a5

Please sign in to comment.