mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
* Update go-gin-server templates to return a configurable library Before this change, the user would be required to make changes in the generated code. This makes it really hard to update the API and the documentation at the same time. With this change, the generated code can be imported as is and used. The user just needs to set the handler functions for each endpoint. * Use spaces instead of tabs for api files * Use space instead of tab for ApiHandleFunctions in go-gin-server * Update samples for go-gin-server
30 lines
578 B
Go
30 lines
578 B
Go
/*
|
|
* OpenAPI Petstore
|
|
*
|
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
*
|
|
* API version: 1.0.0
|
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
// WARNING!
|
|
// Pass --git-repo-id and --git-user-id properties when generating the code
|
|
//
|
|
sw "github.com/GIT_USER_ID/GIT_REPO_ID/go"
|
|
)
|
|
|
|
func main() {
|
|
routes := sw.ApiHandleFunctions{}
|
|
|
|
log.Printf("Server started")
|
|
|
|
router := sw.NewRouter(routes)
|
|
|
|
log.Fatal(router.Run(":8080"))
|
|
}
|