This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add Swagger comments - Add test to verify swagger comments respect standard
- Loading branch information
1 parent
8080135
commit 8254133
Showing
8 changed files
with
547 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Copyright 2017 Intel Corporation | ||
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. | ||
*/ | ||
|
||
// Snap API version 2 | ||
// | ||
// Snap is an open telemetry framework designed to simplify the collection, processing and publishing of system data through a single API. | ||
// | ||
// Terms Of Service: | ||
// | ||
// there are no TOS at this moment. | ||
// | ||
// Schemes: http, https | ||
// Host: localhost | ||
// BasePath: /v2 | ||
// Version: 2.0.0 | ||
// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt | ||
// Contact: Snap maintainers <[email protected]> https://intelsdi-x.herokuapp.com | ||
// | ||
// Consumes: | ||
// - application/json | ||
// | ||
// Produces: | ||
// - application/json | ||
// | ||
// | ||
// swagger:meta | ||
package v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// +build small | ||
|
||
/* | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Copyright 2017 Intel Corporation | ||
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. | ||
*/ | ||
|
||
package v2 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-openapi/loads" | ||
"github.com/go-openapi/strfmt" | ||
"github.com/go-openapi/validate" | ||
"github.com/go-swagger/go-swagger/scan" | ||
. "github.com/smartystreets/goconvey/convey" | ||
) | ||
|
||
func TestSpec(t *testing.T) { | ||
Convey("Swagger spec validation", t, func() { | ||
doc, err := loads.Spec("swagger.json") | ||
Convey("Open current swagger.json", func() { | ||
So(err, ShouldBeNil) | ||
So(doc, ShouldNotBeNil) | ||
}) | ||
err = validate.Spec(doc, strfmt.Default) | ||
Convey("Validate local spec", func() { | ||
So(err, ShouldBeNil) | ||
}) | ||
|
||
opts := scan.Opts{ | ||
BasePath: ".", | ||
} | ||
spec, err := scan.Application(opts) | ||
Convey("Generate spec on the current project", func() { | ||
So(err, ShouldBeNil) | ||
So(spec, ShouldNotBeNil) | ||
}) | ||
|
||
json, err := doc.Spec().MarshalJSON() | ||
json2, err2 := spec.MarshalJSON() | ||
Convey("Compare local spec with generated spec", func() { | ||
So(err, ShouldBeNil) | ||
So(err2, ShouldBeNil) | ||
So(string(json), ShouldEqual, string(json2)) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.