Skip to content

Commit 9bb1743

Browse files
Add /openapi.yaml endpoint to serve the OpenAPI specification (observatorium#869)
* change: bundle the OpenAPI spec into a single file This commit bundles the OpenAPI specification into a single file which makes it possible to be used by online OpenAPI editors. The YAML file has been generated by the `bundle` command of the Redocly tool (https://redocly.com/docs/cli). Signed-off-by: Simon Pasquier <spasquie@redhat.com> * feat: add an OpenAPI endpoint This commit adds a new `/openapi.yaml` endpoint which serves the current OpenAPI specification which is read from the static YAML definition (thanks to the `embed` standard library). Signed-off-by: Simon Pasquier <spasquie@redhat.com> --------- Signed-off-by: Simon Pasquier <spasquie@redhat.com>
1 parent 9709b1e commit 9bb1743

12 files changed

Lines changed: 2454 additions & 2506 deletions

File tree

Makefile

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,7 @@ rules/rules.go: $(OAPI_CODEGEN) rules/spec.yaml
297297
$(OAPI_CODEGEN) -generate types,client,chi-server -package rules rules/spec.yaml | sed 's|gopkg.in/yaml.v2|github.com/ghodss/yaml|g' | gofmt -s > $@
298298

299299
client/client.gen.go: $(OAPI_CODEGEN) client/spec.yaml
300-
$(OAPI_CODEGEN) -generate types,client -import-mapping="./parameters/parameters.yaml:github.com/observatorium/api/client/parameters,./models/models.yaml:github.com/observatorium/api/client/models,./responses/responses.yaml:github.com/observatorium/api/client/responses" -package client client/spec.yaml | sed 's|gopkg.in/yaml.v2|github.com/ghodss/yaml|g' | gofmt -s > $@
300+
$(OAPI_CODEGEN) -generate types,client -package client client/spec.yaml | sed 's|gopkg.in/yaml.v2|github.com/ghodss/yaml|g' | gofmt -s > $@
301301

302-
client/parameters/parameters.gen.go: $(OAPI_CODEGEN) client/parameters/parameters.yaml
303-
$(OAPI_CODEGEN) -generate types,skip-prune -package parameters client/parameters/parameters.yaml | sed 's|gopkg.in/yaml.v2|github.com/ghodss/yaml|g' | gofmt -s > $@
304-
305-
client/models/models.gen.go: $(OAPI_CODEGEN) client/models/models.yaml
306-
$(OAPI_CODEGEN) -generate types,skip-prune -package models client/models/models.yaml | sed 's|gopkg.in/yaml.v2|github.com/ghodss/yaml|g' | gofmt -s > $@
307-
308-
client/responses/responses.gen.go: $(OAPI_CODEGEN) client/responses/responses.yaml
309-
$(OAPI_CODEGEN) -generate types,skip-prune -import-mapping="../models/models.yaml:github.com/observatorium/api/client/models" -package responses client/responses/responses.yaml | sed 's|gopkg.in/yaml.v2|github.com/ghodss/yaml|g' | gofmt -s > $@
310-
311-
gen-oapi-client:
312-
$(MAKE) client/parameters/parameters.gen.go
313-
$(MAKE) client/models/models.gen.go
314-
$(MAKE) client/responses/responses.gen.go
315-
$(MAKE) client/client.gen.go
302+
.PHONY: gen-oapi-client
303+
gen-oapi-client: client/client.gen.go

0 commit comments

Comments
 (0)