Skip to content

Commit

Permalink
Generate swagger.json (#451)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Oct 6, 2019
1 parent b862382 commit d3ef169
Show file tree
Hide file tree
Showing 647 changed files with 153,347 additions and 29 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ endif
### These variables should not need tweaking.
###

SRC_DIRS := apis client pkg # directories which hold app source (not vendored)
SRC_DIRS := apis client pkg hack/gencrd # directories which hold app source (not vendored)

DOCKER_PLATFORMS := linux/amd64 linux/arm linux/arm64
BIN_PLATFORMS := $(DOCKER_PLATFORMS) windows/amd64 darwin/amd64
Expand Down Expand Up @@ -124,6 +124,17 @@ clientset:
# Generate openapi schema
.PHONY: openapi
openapi: $(addprefix openapi-, $(subst :,_, $(API_GROUPS)))
@echo "Generating api/openapi-spec/swagger.json"
@docker run --rm -ti \
-u $$(id -u):$$(id -g) \
-v /tmp:/.cache \
-v $$(pwd):$(DOCKER_REPO_ROOT) \
-w $(DOCKER_REPO_ROOT) \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
$(BUILD_IMAGE) \
go run hack/gencrd/main.go

openapi-%:
@echo "Generating openapi schema for $(subst _,/,$*)"
@mkdir -p api/api-rules
Expand All @@ -138,7 +149,7 @@ openapi-%:
openapi-gen \
--v 1 --logtostderr \
--go-header-file "./hack/boilerplate.go.txt" \
--input-dirs "$(GO_PKG)/$(REPO)/apis/$(subst _,/,$*),k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr,k8s.io/apimachinery/pkg/version,k8s.io/api/core/v1,k8s.io/api/apps/v1,kmodules.xyz/offshoot-api/api/v1,github.com/appscode/go/encoding/json/types,kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1,kmodules.xyz/monitoring-agent-api/api/v1,k8s.io/api/rbac/v1" \
--input-dirs "$(GO_PKG)/$(REPO)/apis/$(subst _,/,$*),k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr,k8s.io/apimachinery/pkg/version,k8s.io/api/core/v1,k8s.io/api/apps/v1,kmodules.xyz/offshoot-api/api/v1,github.com/appscode/go/encoding/json/types,kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1,kmodules.xyz/monitoring-agent-api/api/v1,k8s.io/api/rbac/v1,kmodules.xyz/objectstore-api/api/v1" \
--output-package "$(GO_PKG)/$(REPO)/apis/$(subst _,/,$*)" \
--report-filename api/api-rules/violation_exceptions.list

Expand Down
26,270 changes: 26,270 additions & 0 deletions api/openapi-spec/swagger.json

Large diffs are not rendered by default.

427 changes: 426 additions & 1 deletion apis/catalog/v1alpha1/openapi_generated.go

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions apis/catalog/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func Resource(resource string) schema.GroupResource {
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&PostgresVersion{},
&PostgresVersionList{},
&ElasticsearchVersion{},
&ElasticsearchVersionList{},
&EtcdVersion{},
&EtcdVersionList{},
&MemcachedVersion{},
&MemcachedVersionList{},
&MongoDBVersion{},
Expand All @@ -49,12 +49,12 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&MySQLVersionList{},
&PerconaXtraDBVersion{},
&PerconaXtraDBVersionList{},
&RedisVersion{},
&RedisVersionList{},
&EtcdVersion{},
&EtcdVersionList{},
&PostgresVersion{},
&PostgresVersionList{},
&ProxySQLVersion{},
&ProxySQLVersionList{},
&RedisVersion{},
&RedisVersionList{},
)

scheme.AddKnownTypes(SchemeGroupVersion,
Expand Down
Loading

0 comments on commit d3ef169

Please sign in to comment.