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

Fix expected response on groups endpoint specification and some tooling #73

Merged
merged 2 commits into from
Jun 30, 2020
Merged
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: default clean build fmt lint vet cyclo ineffassign shellcheck errcheck goconst gosec abcgo json-check style run test cover integration_tests rest_api_tests rules_content sqlite_db license before_commit help
.PHONY: default clean build fmt lint vet cyclo ineffassign shellcheck errcheck goconst gosec abcgo json-check style run test cover integration_tests rest_api_tests rules_content sqlite_db license before_commit openapi-check help

SOURCES:=$(shell find . -name '*.go')
BINARY:=insights-results-smart-proxy
Expand Down Expand Up @@ -85,3 +85,6 @@ docs/packages/%.html: %.go
docgo -outdir $(dir $@) $^

godoc: ${DOCFILES}

openapi-check:
./check_openapi.sh
24 changes: 24 additions & 0 deletions check_openapi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Copyright 2020 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

echo "Testing OpenAPI specifications file"
# shellcheck disable=2181

if docker run --rm -v "${PWD}":/local/:Z openapitools/openapi-generator-cli validate -i ./local/openapi.json; then
echo "OpenAPI spec file is OK"
else
echo "OpenAPI spec file validation failed"
exit 1
fi
39 changes: 36 additions & 3 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,45 @@
"summary": "Get all rule groups and their relevant information",
"description": "This simply redirects to an endpoint of the same name of a service called insights-operator-service",
"parameters": [],
"tags": [
"prod"
],
"operationId": "getRuleGroups",
"responses": {
"302": {
"description": "Found redirect: response containing all rule groups",
"200": {
joselsegura marked this conversation as resolved.
Show resolved Hide resolved
"description": "A JSON array of groups.",
"content": {
"text/plain": {}
"application/json": {
"schema": {
"type": "object",
"properties": {
"groups": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "strings"
},
"description": {
"type": "strings"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"status": {
"type": "string",
"example": "ok"
}
}
}
}
}
},
"503": {
Expand Down