Skip to content

Commit 048573b

Browse files
committed
feat: api versioning
This commit adds versioning to our API endpoints, with the current version as `v1`. Under this scheme, each API version lives under separate packages and is served under separate top-level prefixes, e.g. `/v1` for the current version. This necessitated a small refactor to make it easier to modularize the initialization logic. NOTE: you will need to update your restish configuration to add the `/v1` prefix to each server. See the development doc diffs for more details. Remember to run `restish api control-plane-local-<1,2,3> sync` after updating the restish config. PLAT-86
1 parent b10d80f commit 048573b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+327
-222
lines changed

api/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
include ../tools.mk
22

3+
.PHONY: generate-v1
4+
generate-v1:
5+
goa gen github.com/pgEdge/control-plane/api/v1/design -o v1
6+
37
.PHONY: generate
4-
generate:
5-
goa gen github.com/pgEdge/control-plane/api/design
8+
generate: generate-v1

api/gen/http/openapi.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

api/gen/http/openapi3.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ import (
55
"net/http"
66

77
g "goa.design/goa/v3/dsl"
8-
)
98

10-
//go:embed version.txt
11-
var version string
9+
"github.com/pgEdge/control-plane/api"
10+
)
1211

1312
var _ = g.API("control-plane", func() {
14-
g.Title("pgEdge Control Plane API")
15-
g.Version(version)
13+
g.Title("pgEdge Control Plane v1 API")
14+
g.Version(api.Version)
1615
g.Description("Service for creating, modifying, and operating pgEdge databases.")
1716
g.Server("control-plane", func() {
1817
g.Host("localhost", func() {
19-
g.URI("http://localhost:3000")
18+
g.URI("http://localhost:3000/v1")
2019
})
2120
})
2221
g.Meta("openapi:operationId", "{method}")

0 commit comments

Comments
 (0)