# cdimascio/express-openapi-validator

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/cdimascio-express-openapi-validator).**

1,002 stars · 236 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/cdimascio/express-openapi-validator
- awesome-repositories: https://awesome-repositories.com/repository/cdimascio-express-openapi-validator.md

## Topics

`connect-middleware` `express` `express-middleware` `expressjs` `hacktoberfest` `middleware` `nodejs` `openapi` `openapi-validator` `openapi3` `request-validation` `rest-api`

## Description

Express-openapi-validator is an ExpressJS middleware that enforces API contract compliance by validating incoming requests and outgoing responses against OpenAPI 3.0 and 3.1 specifications. It acts as a gatekeeper for web services, ensuring that all traffic adheres to defined schemas before reaching application logic.

The framework distinguishes itself by automating data integrity tasks, including the automatic coercion of request parameters and body content into typed objects. It provides comprehensive security enforcement by validating authentication and authorization headers against defined security schemes, and it supports complex API structures through automatic schema reference resolution and dereferencing.

Beyond core validation, the tool manages the full request lifecycle by handling multipart file uploads, mapping API paths to specific handlers, and providing structured error formatting for schema violations. Developers can extend the framework's capabilities by registering custom validation logic for unique data types or by configuring the strictness of format checks to suit specific project requirements.

## Tags

### Web Development

- [Request Interception Middleware](https://awesome-repositories.com/f/web-development/request-interception-middleware.md) — Acts as an ExpressJS middleware that intercepts incoming HTTP traffic for schema validation and data coercion.
- [ExpressJS Request Validators](https://awesome-repositories.com/f/web-development/request-validation-middleware/expressjs-request-validators.md) — Provides ExpressJS middleware that enforces API contract compliance by validating request parameters, headers, and bodies against defined schemas.
- [Parameter Coercion and Validation](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/query-parameter-validations/parameter-coercion-and-validation.md) — Automatically coerces and transforms incoming request parameters and body content into typed objects based on schema definitions. ([source](https://github.com/cdimascio/express-openapi-validator/tree/lerna-fastify/packages/koa-openapi-validator))
- [Schema-Based Request and Response Validation](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/request-body-validations/schema-based-request-and-response-validation.md) — Validates outgoing server responses against defined schemas to ensure strict adherence to the API contract.
- [API Validation Middlewares](https://awesome-repositories.com/f/web-development/expressjs-integrations/api-validation-middlewares.md) — Streamlines ExpressJS API development by automatically mapping routes and validating inputs against API documentation.
- [Type-Safe Request Parsing](https://awesome-repositories.com/f/web-development/request-body-handling/request-body-alterations/request-body-parsing/type-safe-request-parsing.md) — Parses incoming request parameters and bodies into strongly-typed data structures to simplify application logic. ([source](https://github.com/cdimascio/express-openapi-validator/search))
- [Traffic Integrity Auditors](https://awesome-repositories.com/f/web-development/rest-apis/api-response-validation/traffic-integrity-auditors.md) — Provides bidirectional traffic validation against OpenAPI schemas to ensure data integrity for incoming requests and outgoing responses. ([source](https://github.com/cdimascio/express-openapi-validator/blob/master/secrets.zip.enc))
- [Validation Middleware](https://awesome-repositories.com/f/web-development/form-data-support/multipart-uploads/validation-middleware.md) — Checking uploaded files and form data against schema constraints to ensure that incoming attachments meet your specific application requirements.

### Data & Databases

- [Data Type Coercion](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/data-transformation/data-parsing-extraction/typed-data-extraction/data-type-coercion.md) — Applies automatic type casting and formatting rules defined in the API specification to incoming request inputs.
- [API Contract Validation](https://awesome-repositories.com/f/data-databases/json-schema-modeling/schema-validators/api-contract-validation.md) — Enforces API contracts by validating traffic and coercing request data to ensure strict adherence to defined specifications.

### Software Engineering & Architecture

- [Runtime Contract Enforcement](https://awesome-repositories.com/f/software-engineering-architecture/api-contract-definitions/runtime-contract-enforcement.md) — Enforces API contracts by verifying that request and response traffic matches the defined specification.
- [Runtime OpenAPI Request Validators](https://awesome-repositories.com/f/software-engineering-architecture/specification-validation-schemas/openapi-specification-validators/runtime-openapi-request-validators.md) — Validates incoming HTTP request data against OpenAPI specifications at runtime to ensure compliance before reaching application logic.
- [Schema Reference Resolution](https://awesome-repositories.com/f/software-engineering-architecture/api-reference-resolution/schema-reference-resolution.md) — Resolves internal and external schema references to support modular and complex API specifications. ([source](https://github.com/cdimascio/express-openapi-validator/tree/lerna-fastify/packages/koa-openapi-validator))
- [Security Compliance Automations](https://awesome-repositories.com/f/software-engineering-architecture/automated-risk-scanning/security-compliance-automations.md) — Automates the verification of security headers to ensure compliance with defined API security schemes.
- [Operation-to-Handler Mappings](https://awesome-repositories.com/f/software-engineering-architecture/operation-to-handler-mappings.md) — Automatically maps API paths defined in specifications to specific application handler functions. ([source](https://github.com/cdimascio/express-openapi-validator#readme))
- [OpenAPI Specification Validators](https://awesome-repositories.com/f/software-engineering-architecture/specification-validation-schemas/openapi-specification-validators.md) — Dereferences OpenAPI specifications to unify modular and multi-file API definitions.

### Security & Cryptography

- [Security Scheme Validators](https://awesome-repositories.com/f/security-cryptography/authentication-clients/credential-authentication/remote-credential-validations/security-scheme-validators.md) — Verifies authentication and authorization headers against defined security schemes to ensure only authorized traffic reaches protected endpoints. ([source](https://github.com/cdimascio/express-openapi-validator#readme))
- [Security Scheme Header Validators](https://awesome-repositories.com/f/security-cryptography/node-js-api-security/security-header-configurations/security-scheme-header-validators.md) — Verifies authentication and authorization headers against defined security schemes to protect API endpoints from unauthorized access.
