How to use api-schema-builder - 2 common examples

To help you get started, we’ve selected a few api-schema-builder 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 Zooz / express-ajv-swagger-validation / src / middleware.js View on Github external
function init(swaggerPath, options) {
    middlewareOptions = options || {};
    const frameworkToLoad = allowedFrameworks.find((frameworkName) => {
        return middlewareOptions.framework === frameworkName;
    });

    framework = frameworkToLoad ? require(`./frameworks/${frameworkToLoad}`) : require('./frameworks/express');
    schemaEndpointResolver = new SchemaEndpointResolver();

    // build schema for requests only
    let schemaBuilderOptions = Object.assign({}, options, { buildRequests: true, buildResponses: false });
    schemas = apiSchemaBuilder.buildSchemaSync(swaggerPath, schemaBuilderOptions);
}
github PayU / api-contract-validator / lib / helpers / schema-utils.js View on Github external
return (filePath, schemaBuilderOpts) => {
    const encodedFilePath = base64.encode(filePath);

    if (!schemas[encodedFilePath]) {
      schemas[encodedFilePath] = apiSchemaBuilder.buildSchemaSync(filePath, schemaBuilderOpts);
    }
    return schemas[encodedFilePath];
  };
})();

api-schema-builder

build schema with validators for each endpoint

Apache-2.0
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis

Popular api-schema-builder functions