diff options
author | Dan Duvall <dduvall@wikimedia.org> | 2018-09-19 11:06:46 -0700 |
---|---|---|
committer | Dan Duvall <dduvall@wikimedia.org> | 2018-12-12 15:02:22 -0800 |
commit | 4df63a83c93ba0f591eb78110e184bfef0f76535 (patch) | |
tree | 9a0c97f54432cf7ecb30ff910d5f514b51f02ed9 /cmd/blubberoid/openapi_test.go | |
parent | 3da9f201cad3b09b4e7d70dcaf023c70b4bcc026 (diff) | |
download | blubber-4df63a83c93ba0f591eb78110e184bfef0f76535.tar.gz |
Provide OpenAPI spec for Blubberoid
Wrote an OpenAPI 3.0 spec for Blubberoid that provides `x-amples`
entries compatible with service-checker.
The written spec includes basic schema for Blubber config objects that
may be later factored out for use in validation.
Note that OpenAPI 3.0 supports only the v4 draft of the JSON Schema
standard, so some parts of the configuration could not be fully
described. Specifically, v4 does not include the `patternProperties`
definition introduced in the JSON Schema v6 draft that would allow us to
describe `variants` and `runs.environment` and everything beneath.
Blubberoid was refactored slightly to incorporate the new spec as well
as assume JSON as the canonical and default configuration format. It was
also refactored to include a versioned namespace ("v1") after the server
endpoint.
Bug: T205920
Change-Id: I28a341aa503b8920d802715660d4c4d62be45475
Diffstat (limited to 'cmd/blubberoid/openapi_test.go')
-rw-r--r-- | cmd/blubberoid/openapi_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cmd/blubberoid/openapi_test.go b/cmd/blubberoid/openapi_test.go new file mode 100644 index 0000000..559f681 --- /dev/null +++ b/cmd/blubberoid/openapi_test.go @@ -0,0 +1,16 @@ +package main + +import ( + "io/ioutil" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBlubberoidOpenAPISpecTemplateMatchesFile(t *testing.T) { + specFile, err := ioutil.ReadFile("../../api/openapi-spec/blubberoid.yaml") + + if assert.NoError(t, err) { + assert.Equal(t, string(specFile), openAPISpecTemplate) + } +} |