How to use openapi-jsonschema-parameters - 1 common examples

To help you get started, we’ve selected a few openapi-jsonschema-parameters examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kogosoftwarellc / open-api / packages / openapi-request-validator / index.ts View on Github external
const errorTransformer =
      typeof args.errorTransformer === 'function' && args.errorTransformer;
    const errorMapper = errorTransformer
      ? extendedErrorMapper(errorTransformer)
      : toOpenapiValidationError;
    let bodyValidationSchema;
    let bodySchema;
    let headersSchema;
    let formDataSchema;
    let pathSchema;
    let querySchema;
    let isBodyRequired;

    if (args.parameters !== undefined) {
      if (Array.isArray(args.parameters)) {
        const schemas = convertParametersToJSONSchema(args.parameters);
        bodySchema = schemas.body;
        headersSchema = lowercasedHeaders(schemas.headers);
        formDataSchema = schemas.formData;
        pathSchema = schemas.path;
        querySchema = schemas.query;
        isBodyRequired =
          // @ts-ignore
          args.parameters.filter(byRequiredBodyParameters).length > 0;
      } else {
        throw new Error(`${loggingKey}args.parameters must be an Array`);
      }
    }

    const v = new Ajv({
      useDefaults: true,
      allErrors: true,

openapi-jsonschema-parameters

Converts openapi parameters to a jsonschema format.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular openapi-jsonschema-parameters functions