openapi-fastify
    Preparing search index...

    Type Alias RouterOptions

    type RouterOptions = {
        autoValidate?: {
            request?: {
                errorResponse?: {
                    payload:
                        | Record<string, any>
                        | ((errors: ErrorObject<any>[]) => Record<string, any>);
                    status: number;
                };
                validate?: boolean;
            };
            response?: {
                errorResponse?: {
                    payload: | Record<string, any>
                    | ((errors: ErrorObject<any>[]) => Record<string, any>);
                    status: number;
                };
                validate?: boolean;
            };
        };
        specModifier?: (spec: OpenAPI.Operator) => OpenAPI.Operator;
    }
    Index

    Properties

    autoValidate?: {
        request?: {
            errorResponse?: {
                payload:
                    | Record<string, any>
                    | ((errors: ErrorObject<any>[]) => Record<string, any>);
                status: number;
            };
            validate?: boolean;
        };
        response?: {
            errorResponse?: {
                payload: | Record<string, any>
                | ((errors: ErrorObject<any>[]) => Record<string, any>);
                status: number;
            };
            validate?: boolean;
        };
    }

    Type Declaration

    • Optionalrequest?: {
          errorResponse?: {
              payload:
                  | Record<string, any>
                  | ((errors: ErrorObject<any>[]) => Record<string, any>);
              status: number;
          };
          validate?: boolean;
      }
      • Whether to automatically validate the request body.
      • If true, the request body will be validated against the schema via the preValidation hook.

      {validate: true, errorResponse: {status: 400, payload: {error: "Invalid Request Body", errors: Ajv.Errors[]}}}

    • Optionalresponse?: {
          errorResponse?: {
              payload:
                  | Record<string, any>
                  | ((errors: ErrorObject<any>[]) => Record<string, any>);
              status: number;
          };
          validate?: boolean;
      }
      • Whether to automatically validate the response.
      • If true, the response will be validated against the schema via the preSerialization hook.

      {validate: true, errorResponse: {status: 500, payload: {error: "Invalid Response", errors: Ajv.Errors[]}}}

    • Whether to automatically validate the request body and response.
    specModifier?: (spec: OpenAPI.Operator) => OpenAPI.Operator

    A function that modifies the OpenAPI specification.

    Type Declaration