Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add openapi spec #161

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ jobs:
- name: Lint code
run: make lint

- name: Check docs
run: make docs

- name: Run unit tests
env:
TEST_SCHEMA_URI: "./etc/ecs-8.2.0.tar.gz"
Expand Down
2 changes: 2 additions & 0 deletions .license_ignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ requirements.txt
runtime.txt
setup.cfg

docs/api-spec.html

scripts/generate-alerts.sh
scripts/generate-network-events.sh

Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ define embed-python
endef
endif

REDOCLY := npx -y @redocly/cli

rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))

all: lint tests
Expand All @@ -32,6 +34,7 @@ prereq-go: prereq-py
lint:
$(PYTHON) -m black -q --check geneve tests || ($(PYTHON) -m black geneve tests; false)
$(PYTHON) -m isort -q --check geneve tests || ($(PYTHON) -m isort geneve tests; false)
$(REDOCLY) lint docs/api-spec.yaml

license-check:
bash scripts/license_check.sh
Expand Down Expand Up @@ -92,6 +95,11 @@ package: pkg-build
$(MAKE) pkg-install VENV=$(VENV)
rm -rf $(VENV)

docs/api-spec.html: docs/api-spec.yaml
$(REDOCLY) build-docs --output $@ $<

docs: docs/api-spec.html

CREDS_FILE=credentials-cloud-stack.json

cloud-stack-up:
Expand Down Expand Up @@ -135,4 +143,4 @@ override TEST_STACK_VERSION := $(shell \
)
endif

.PHONY: lint tests online_tests run up down
.PHONY: docs lint tests online_tests run up down
2 changes: 1 addition & 1 deletion cmd/internal/utils/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func DecodeRequestBody(w http.ResponseWriter, req *http.Request, data any, known
}

switch content_type[0] {
case "application/yaml":
case "application/yaml", "text/yaml":
dec := yaml.NewDecoder(req.Body)
dec.KnownFields(knownFields)
err := dec.Decode(data)
Expand Down
Loading