go-chi / chi

lightweight, idiomatic and composable router for building Go HTTP services
https://go-chi.io
MIT License
18.11k stars 975 forks source link

OpenAPI Spec Validation Feature or Guidance #946

Open Renizmy opened 3 weeks ago

Renizmy commented 3 weeks ago

I am working on a project that uses the Go-Chi router, and I want to validate incoming requests against an OpenAPI specification before any processing. While I appreciate the flexibility and performance of Go-Chi, I couldn't find any built-in support or clear guidance on how to perform OpenAPI spec validation.

If there are any best practices, existing libraries, or middleware that can be used in conjunction with Go-Chi to achieve OpenAPI spec validation, could you please provide documentation or examples ?

If there's interest or an existing plan for this feature, I'd be happy to contribute or help with testing and documentation.

pkieltyka commented 3 weeks ago

chi is a minimal library, what you’re describing is best suited to be built on top and independently of chi.

For example see https://github.com/webrpc/webrpc and https://github.com/webrpc/gen-openapi

Renizmy commented 3 weeks ago

Thank you for the information. From what I understand, the idea would be to build a middleware ? I think I will try something based on https://github.com/getkin/kin-openapi