From 57187ea9c0fab26dcadc883b8432cd65838c2990 Mon Sep 17 00:00:00 2001 From: kooksee Date: Fri, 8 Mar 2024 11:25:17 +0800 Subject: [PATCH] fix: 2024-03-08 11:25:16 --- internal/examples/main.go | 13 ++++++------- internal/examples/openapi.yaml | 20 ++++++++++++++++++++ templates/swagger.html | 26 ++++++++++++++------------ 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/internal/examples/main.go b/internal/examples/main.go index 92de3e1..a71b1c6 100644 --- a/internal/examples/main.go +++ b/internal/examples/main.go @@ -1,12 +1,11 @@ package main import ( - "os" - "github.com/pubgo/funk/assert" "github.com/pubgo/funk/recovery" "github.com/pubgo/opendoc/opendoc" "github.com/pubgo/opendoc/security" + "net/http" ) type TestQueryReqAAA struct { @@ -64,10 +63,10 @@ func main() { }) }) - data := assert.Must1(doc.MarshalYAML()) - assert.Exit(os.WriteFile("openapi.yaml", data, 0644)) + //data := assert.Must1(doc.MarshalYAML()) + //assert.Exit(os.WriteFile("openapi.yaml", data, 0644)) - //var app = fiber.New() - //doc.InitRouter(app) - //assert.Exit(app.Listen("localhost:8080")) + var app = http.NewServeMux() + doc.InitRouter(app) + assert.Exit(http.ListenAndServe("localhost:8080", app)) } diff --git a/internal/examples/openapi.yaml b/internal/examples/openapi.yaml index 7a7a96a..75aada2 100644 --- a/internal/examples/openapi.yaml +++ b/internal/examples/openapi.yaml @@ -163,6 +163,26 @@ paths: - req type: object description: OK + Test: + content: + application/json: + schema: + properties: + name: + default: test + description: name of model validate:required + nullable: true + type: string + name1: + default: test + description: name1 of model validate:required + nullable: true + type: string + required: + - name + - name1 + type: object + description: Test default: content: application/json: diff --git a/templates/swagger.html b/templates/swagger.html index 3dd2d90..a10a9a8 100644 --- a/templates/swagger.html +++ b/templates/swagger.html @@ -3,22 +3,24 @@ {{ .title }} - Swagger UI - - + + +
\ No newline at end of file