Skip to content

Commit

Permalink
Merge 50a4c3f into a1827e9
Browse files Browse the repository at this point in the history
  • Loading branch information
threez committed Nov 25, 2020
2 parents a1827e9 + 50a4c3f commit 7b020b2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 24 deletions.
1 change: 1 addition & 0 deletions backend/objstore/health_objstore_test.go
Expand Up @@ -26,6 +26,7 @@ func TestIntegrationHealthCheck(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
RegisterHealthchecks()
resp := setup()
if resp.StatusCode != 200 {
t.Errorf("Expected /health/check to respond with 200, got: %d", resp.StatusCode)
Expand Down
11 changes: 7 additions & 4 deletions http/jsonapi/generator/generate_handler.go
Expand Up @@ -353,18 +353,21 @@ func (g *Generator) buildRouter(routes []*route, schema *openapi3.Swagger) error
routeStmts[startInd] = jen.Id("router").Op(":=").Qual(pkgGorillaMux, "NewRouter").Call()

// Note: we don't restrict host, scheme and port to ease development
paths := make(map[string]struct{})
pathsIdx := make(map[string]struct{})
var paths []string
for _, server := range schema.Servers {
serverUrl, err := url.Parse(server.URL)
if err != nil {
return err
}
paths[serverUrl.Path] = struct{}{}
if _, ok := pathsIdx[serverUrl.Path]; !ok {
paths = append(paths, serverUrl.Path)
}
pathsIdx[serverUrl.Path] = struct{}{}
}

// but generate subrouters for each server
i := 0
for path := range paths {
for i, path := range paths {
subrouterID := fmt.Sprintf("s%d", i+1)

// init and return the router
Expand Down
15 changes: 9 additions & 6 deletions http/jsonapi/generator/internal/fueling/open-api.json
Expand Up @@ -10,14 +10,17 @@
},
"servers": [
{
"url": "https://api.pace.cloud/fueling"
"url": "https://api.pace.cloud/fueling/beta/"
},
{
"url": "https://localhost/fueling"
"url": "https://api.pace.cloud/fueling/v1/"
},
{
"url": "https://localhost/fueling/beta/"
}
],
"paths": {
"/beta/gas-stations/{gasStationId}/approaching": {
"/gas-stations/{gasStationId}/approaching": {
"post": {
"tags": [
"Fueling"
Expand Down Expand Up @@ -258,7 +261,7 @@
}
}
},
"/beta/gas-stations/{gasStationId}/pumps/{pumpId}": {
"/gas-stations/{gasStationId}/pumps/{pumpId}": {
"get": {
"tags": [
"Fueling"
Expand Down Expand Up @@ -316,7 +319,7 @@
}
}
},
"/beta/gas-stations/{gasStationId}/pumps/{pumpId}/wait-for-status-change": {
"/gas-stations/{gasStationId}/pumps/{pumpId}/wait-for-status-change": {
"get": {
"tags": [
"Fueling"
Expand Down Expand Up @@ -412,7 +415,7 @@
}
}
},
"/beta/gas-station/{gasStationId}/payment": {
"/gas-station/{gasStationId}/payment": {
"post": {
"tags": [
"Fueling"
Expand Down
34 changes: 20 additions & 14 deletions http/jsonapi/generator/internal/fueling/open-api_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b020b2

Please sign in to comment.