{"repo":"jakecoffman/crud","free":true,"listed":false,"github":"https://github.com/jakecoffman/crud","clone":"git clone https://github.com/jakecoffman/crud.git","description":"OpenAPI v2 builder and input validation for Go APIs, with Swagger UI","language":"Go","stars":44,"topics":["swagger","swagger-ui","go","server","rest-api","validation","openapi","api","golang","rest"],"license":"Apache-2.0","category":"api-integrations-sdks","readme_excerpt":"crud An OpenAPI v2 builder and validation library for building HTTP/REST APIs. No additional dependencies besides the router you choose. Status Version 1.0 is stable, version 2 will support OpenAPI v3. Why OpenAPI is great, but up until now your options to use it are: 1. Write YAML by hand and then make your server match your spec. 2. Write YAML by hand and generate your server. 3. Generate YAML from comments in your code. None of these options seems like a great idea. This project takes another approach: make a specification in Go code using type-safe builders where possible. The OpenAPI spec is generated from this and validation is done before your handler gets called. This reduces boilerplate that you have to write and gives you nice documentation too! Examples - ServeMux Example - Gin-Gonic Example - Echo Example - Gorilla Mux Example Getting started Check the example directory under the adapters for a simple example. Start by getting the package go get github.com/jakecoffman/crud Then in your main.go : 1. Create a router with NewRouter , use an adapter from the adapters sub-package or write you own. 2. Add routes with Add . 3. Then call Serve . Routes are specifications that look like this: This will add a route /widgets/:id that responds to the PATCH method. It generates swagger and serves it at the root of the web application. It validates that the ID in the path is a number, so you don't have to. It also validates that the body is an object and has an \"owner\" property","default_branch":null,"files":null,"tree":[],"storefront":"/r/jakecoffman","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jakecoffman/crud/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}