Skip to content

Commit

Permalink
OpenAPI generation improvements and alternate path exts (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
irees authored Oct 10, 2024
1 parent b4e5254 commit d9878a6
Show file tree
Hide file tree
Showing 13 changed files with 10,606 additions and 54 deletions.
1 change: 1 addition & 0 deletions docs/openapi/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func GenerateOpenAPI() (*oa.T, error) {
&rest.RouteRequest{},
&rest.TripRequest{},
&rest.StopRequest{},
&rest.StopDepartureRequest{},
}
for _, handler := range handlers {
requestInfo := handler.RequestInfo()
Expand Down
9 changes: 6 additions & 3 deletions docs/openapi/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package openapi
import (
"context"
"encoding/json"
"fmt"
"os"
"testing"

oa "github.com/getkin/kin-openapi/openapi3"
Expand All @@ -16,7 +16,6 @@ func TestGenerateOpenAPI(t *testing.T) {
}
// Write output
jj, _ := json.MarshalIndent(outdoc, "", " ")
fmt.Println(string(jj))

// Validate output
schema, err := oa.NewLoader().LoadFromData(jj)
Expand All @@ -27,5 +26,9 @@ func TestGenerateOpenAPI(t *testing.T) {
if err := schema.Validate(context.Background(), validationOpts...); err != nil {
t.Fatal(err)
}

outf, err := os.Create("rest.json")
if err != nil {
t.Fatal(err)
}
outf.Write(jj)
}
Loading

0 comments on commit d9878a6

Please sign in to comment.