1

I have yet to see any libraries in existence that support OpenAPI request validation. Or to that matter any projects that are under active-development that does as such.

Would very much like to write middleware in my microservices to validate based on OpenAPI 3 specs instead of Swagger/OpenAPI 2 specs.

Examples

https://www.npmjs.com/package/swagger-express

https://www.npmjs.com/package/swagger-koa

Don't see anything listed - https://github.com/Mermade/awesome-openapi3

2 Answers 2

1

express-openapi-validator validates API requests, responses, and securities against an OpenAPI 3 specification.

new OpenApiValidator({ 
  apiSpec: './openapi-spec.yaml', 
  validateRequests: true,
  validateResponses: true,
}).install(app);
Sign up to request clarification or add additional context in comments.

Comments

0

I found a temporary solution is converting the OpenAPI 3 spec to a Swagger 2 spec, and then using a popular middleware tool for Swagger 2 Koa / etc to validate requests.

Here are a couple libraries I went with.

https://github.com/LucyBot-Inc/api-spec-converter https://github.com/carlansley/swagger2-koa

1 Comment

Take a look at this npm-module. It looks like what you're looking for. github.com/isa-group/oas-tools#readme

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.