Fix the dependency issue (#231)
This commit is contained in:
117
vendor/github.com/go-openapi/analysis/.github/CONTRIBUTING.md
generated
vendored
117
vendor/github.com/go-openapi/analysis/.github/CONTRIBUTING.md
generated
vendored
@@ -1,117 +0,0 @@
|
||||
## Contribution Guidelines
|
||||
|
||||
### Pull requests are always welcome
|
||||
|
||||
We are always thrilled to receive pull requests, and do our best to
|
||||
process them as fast as possible. Not sure if that typo is worth a pull
|
||||
request? Do it! We will appreciate it.
|
||||
|
||||
If your pull request is not accepted on the first try, don't be
|
||||
discouraged! If there's a problem with the implementation, hopefully you
|
||||
received feedback on what to improve.
|
||||
|
||||
We're trying very hard to keep go-swagger lean and focused. We don't want it
|
||||
to do everything for everybody. This means that we might decide against
|
||||
incorporating a new feature. However, there might be a way to implement
|
||||
that feature *on top of* go-swagger.
|
||||
|
||||
|
||||
### Conventions
|
||||
|
||||
Fork the repo and make changes on your fork in a feature branch:
|
||||
|
||||
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
|
||||
issue
|
||||
- If it's a feature branch, create an enhancement issue to announce your
|
||||
intentions, and name it XXX-something where XXX is the number of the issue.
|
||||
|
||||
Submit unit tests for your changes. Go has a great test framework built in; use
|
||||
it! Take a look at existing tests for inspiration. Run the full test suite on
|
||||
your branch before submitting a pull request.
|
||||
|
||||
Update the documentation when creating or modifying features. Test
|
||||
your documentation changes for clarity, concision, and correctness, as
|
||||
well as a clean documentation build. See ``docs/README.md`` for more
|
||||
information on building the docs and how docs get released.
|
||||
|
||||
Write clean code. Universally formatted code promotes ease of writing, reading,
|
||||
and maintenance. Always run `gofmt -s -w file.go` on each changed file before
|
||||
committing your changes. Most editors have plugins that do this automatically.
|
||||
|
||||
Pull requests descriptions should be as clear as possible and include a
|
||||
reference to all the issues that they address.
|
||||
|
||||
Pull requests must not contain commits from other users or branches.
|
||||
|
||||
Commit messages must start with a capitalized and short summary (max. 50
|
||||
chars) written in the imperative, followed by an optional, more detailed
|
||||
explanatory text which is separated from the summary by an empty line.
|
||||
|
||||
Code review comments may be added to your pull request. Discuss, then make the
|
||||
suggested modifications and push additional commits to your feature branch. Be
|
||||
sure to post a comment after pushing. The new commits will show up in the pull
|
||||
request automatically, but the reviewers will not be notified unless you
|
||||
comment.
|
||||
|
||||
Before the pull request is merged, make sure that you squash your commits into
|
||||
logical units of work using `git rebase -i` and `git push -f`. After every
|
||||
commit the test suite should be passing. Include documentation changes in the
|
||||
same commit so that a revert would remove all traces of the feature or fix.
|
||||
|
||||
Commits that fix or close an issue should include a reference like `Closes #XXX`
|
||||
or `Fixes #XXX`, which will automatically close the issue when merged.
|
||||
|
||||
### Sign your work
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to
|
||||
pass it on as an open-source patch. The rules are pretty simple: if you
|
||||
can certify the below (from
|
||||
[developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe@gmail.com>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
You can add the sign off when creating the git commit via `git commit -s`.
|
||||
3
vendor/github.com/go-openapi/analysis/.gitignore
generated
vendored
3
vendor/github.com/go-openapi/analysis/.gitignore
generated
vendored
@@ -1,3 +0,0 @@
|
||||
secrets.yml
|
||||
coverage.out
|
||||
.idea
|
||||
18
vendor/github.com/go-openapi/analysis/.travis.yml
generated
vendored
18
vendor/github.com/go-openapi/analysis/.travis.yml
generated
vendored
@@ -1,18 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.7
|
||||
install:
|
||||
- go get -u github.com/stretchr/testify/assert
|
||||
- go get -u gopkg.in/yaml.v2
|
||||
- go get -u github.com/go-openapi/swag
|
||||
- go get -u github.com/go-openapi/jsonpointer
|
||||
- go get -u github.com/go-openapi/spec
|
||||
- go get -u github.com/go-openapi/strfmt
|
||||
- go get -u github.com/go-openapi/loads/fmts
|
||||
script:
|
||||
- go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
notifications:
|
||||
slack:
|
||||
secure: Sf7kZf7ZGbnwWUMpffHwMu5A0cHkLK2MYY32LNTPj4+/3qC3Ghl7+9v4TSLOqOlCwdRNjOGblAq7s+GDJed6/xgRQl1JtCi1klzZNrYX4q01pgTPvvGcwbBkIYgeMaPeIRcK9OZnud7sRXdttozgTOpytps2U6Js32ip7uj5mHSg2ub0FwoSJwlS6dbezZ8+eDhoha0F/guY99BEwx8Bd+zROrT2TFGsSGOFGN6wFc7moCqTHO/YkWib13a2QNXqOxCCVBy/lt76Wp+JkeFppjHlzs/2lP3EAk13RIUAaesdEUHvIHrzCyNJEd3/+KO2DzsWOYfpktd+KBCvgaYOsoo7ubdT3IROeAegZdCgo/6xgCEsmFc9ZcqCfN5yNx2A+BZ2Vwmpws+bQ1E1+B5HDzzaiLcYfG4X2O210QVGVDLWsv1jqD+uPYeHY2WRfh5ZsIUFvaqgUEnwHwrK44/8REAhQavt1QAj5uJpsRd7CkRVPWRNK+yIky+wgbVUFEchRNmS55E7QWf+W4+4QZkQi7vUTMc9nbTUu2Es9NfvfudOpM2wZbn98fjpb/qq/nRv6Bk+ca+7XD5/IgNLMbWp2ouDdzbiHLCOfDUiHiDJhLfFZx9Bwo7ZwfzeOlbrQX66bx7xRKYmOe4DLrXhNcpbsMa8qbfxlZRCmYbubB/Y8h4=
|
||||
74
vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md
generated
vendored
74
vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md
generated
vendored
@@ -1,74 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
6
vendor/github.com/go-openapi/analysis/README.md
generated
vendored
6
vendor/github.com/go-openapi/analysis/README.md
generated
vendored
@@ -1,6 +0,0 @@
|
||||
# OpenAPI initiative analysis [](https://travis-ci.org/go-openapi/analysis) [](https://codecov.io/gh/go-openapi/analysis) [](https://slackin.goswagger.io)
|
||||
|
||||
[](https://raw.githubusercontent.com/go-openapi/analysis/master/LICENSE) [](http://godoc.org/github.com/go-openapi/analysis)
|
||||
|
||||
|
||||
A foundational library to analyze an OAI specification document for easier reasoning about the content.
|
||||
284
vendor/github.com/go-openapi/analysis/analyzer_test.go
generated
vendored
284
vendor/github.com/go-openapi/analysis/analyzer_test.go
generated
vendored
@@ -1,284 +0,0 @@
|
||||
// Copyright 2015 go-swagger maintainers
|
||||
//
|
||||
// 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 analysis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/go-openapi/loads/fmts"
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func schemeNames(schemes []SecurityRequirement) []string {
|
||||
var names []string
|
||||
for _, v := range schemes {
|
||||
names = append(names, v.Name)
|
||||
}
|
||||
sort.Sort(sort.StringSlice(names))
|
||||
return names
|
||||
}
|
||||
|
||||
func TestAnalyzer(t *testing.T) {
|
||||
formatParam := spec.QueryParam("format").Typed("string", "")
|
||||
|
||||
limitParam := spec.QueryParam("limit").Typed("integer", "int32")
|
||||
limitParam.Extensions = spec.Extensions(map[string]interface{}{})
|
||||
limitParam.Extensions.Add("go-name", "Limit")
|
||||
|
||||
skipParam := spec.QueryParam("skip").Typed("integer", "int32")
|
||||
pi := spec.PathItem{}
|
||||
pi.Parameters = []spec.Parameter{*limitParam}
|
||||
|
||||
op := &spec.Operation{}
|
||||
op.Consumes = []string{"application/x-yaml"}
|
||||
op.Produces = []string{"application/x-yaml"}
|
||||
op.Security = []map[string][]string{
|
||||
map[string][]string{"oauth2": []string{}},
|
||||
map[string][]string{"basic": nil},
|
||||
}
|
||||
op.ID = "someOperation"
|
||||
op.Parameters = []spec.Parameter{*skipParam}
|
||||
pi.Get = op
|
||||
|
||||
pi2 := spec.PathItem{}
|
||||
pi2.Parameters = []spec.Parameter{*limitParam}
|
||||
op2 := &spec.Operation{}
|
||||
op2.ID = "anotherOperation"
|
||||
op2.Parameters = []spec.Parameter{*skipParam}
|
||||
pi2.Get = op2
|
||||
|
||||
spec := &spec.Swagger{
|
||||
SwaggerProps: spec.SwaggerProps{
|
||||
Consumes: []string{"application/json"},
|
||||
Produces: []string{"application/json"},
|
||||
Security: []map[string][]string{
|
||||
map[string][]string{"apikey": nil},
|
||||
},
|
||||
SecurityDefinitions: map[string]*spec.SecurityScheme{
|
||||
"basic": spec.BasicAuth(),
|
||||
"apiKey": spec.APIKeyAuth("api_key", "query"),
|
||||
"oauth2": spec.OAuth2AccessToken("http://authorize.com", "http://token.com"),
|
||||
},
|
||||
Parameters: map[string]spec.Parameter{"format": *formatParam},
|
||||
Paths: &spec.Paths{
|
||||
Paths: map[string]spec.PathItem{
|
||||
"/": pi,
|
||||
"/items": pi2,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
analyzer := New(spec)
|
||||
|
||||
assert.Len(t, analyzer.consumes, 2)
|
||||
assert.Len(t, analyzer.produces, 2)
|
||||
assert.Len(t, analyzer.operations, 1)
|
||||
assert.Equal(t, analyzer.operations["GET"]["/"], spec.Paths.Paths["/"].Get)
|
||||
|
||||
expected := []string{"application/x-yaml"}
|
||||
sort.Sort(sort.StringSlice(expected))
|
||||
consumes := analyzer.ConsumesFor(spec.Paths.Paths["/"].Get)
|
||||
sort.Sort(sort.StringSlice(consumes))
|
||||
assert.Equal(t, expected, consumes)
|
||||
|
||||
produces := analyzer.ProducesFor(spec.Paths.Paths["/"].Get)
|
||||
sort.Sort(sort.StringSlice(produces))
|
||||
assert.Equal(t, expected, produces)
|
||||
|
||||
expected = []string{"application/json"}
|
||||
sort.Sort(sort.StringSlice(expected))
|
||||
consumes = analyzer.ConsumesFor(spec.Paths.Paths["/items"].Get)
|
||||
sort.Sort(sort.StringSlice(consumes))
|
||||
assert.Equal(t, expected, consumes)
|
||||
|
||||
produces = analyzer.ProducesFor(spec.Paths.Paths["/items"].Get)
|
||||
sort.Sort(sort.StringSlice(produces))
|
||||
assert.Equal(t, expected, produces)
|
||||
|
||||
expectedSchemes := []SecurityRequirement{SecurityRequirement{"oauth2", []string{}}, SecurityRequirement{"basic", nil}}
|
||||
schemes := analyzer.SecurityRequirementsFor(spec.Paths.Paths["/"].Get)
|
||||
assert.Equal(t, schemeNames(expectedSchemes), schemeNames(schemes))
|
||||
|
||||
securityDefinitions := analyzer.SecurityDefinitionsFor(spec.Paths.Paths["/"].Get)
|
||||
assert.Equal(t, securityDefinitions["basic"], *spec.SecurityDefinitions["basic"])
|
||||
assert.Equal(t, securityDefinitions["oauth2"], *spec.SecurityDefinitions["oauth2"])
|
||||
|
||||
parameters := analyzer.ParamsFor("GET", "/")
|
||||
assert.Len(t, parameters, 2)
|
||||
|
||||
operations := analyzer.OperationIDs()
|
||||
assert.Len(t, operations, 2)
|
||||
|
||||
producers := analyzer.RequiredProduces()
|
||||
assert.Len(t, producers, 2)
|
||||
consumers := analyzer.RequiredConsumes()
|
||||
assert.Len(t, consumers, 2)
|
||||
authSchemes := analyzer.RequiredSecuritySchemes()
|
||||
assert.Len(t, authSchemes, 3)
|
||||
|
||||
ops := analyzer.Operations()
|
||||
assert.Len(t, ops, 1)
|
||||
assert.Len(t, ops["GET"], 2)
|
||||
|
||||
op, ok := analyzer.OperationFor("get", "/")
|
||||
assert.True(t, ok)
|
||||
assert.NotNil(t, op)
|
||||
|
||||
op, ok = analyzer.OperationFor("delete", "/")
|
||||
assert.False(t, ok)
|
||||
assert.Nil(t, op)
|
||||
}
|
||||
|
||||
func TestDefinitionAnalysis(t *testing.T) {
|
||||
doc, err := loadSpec(filepath.Join("fixtures", "definitions.yml"))
|
||||
if assert.NoError(t, err) {
|
||||
analyzer := New(doc)
|
||||
definitions := analyzer.allSchemas
|
||||
// parameters
|
||||
assertSchemaRefExists(t, definitions, "#/parameters/someParam/schema")
|
||||
assertSchemaRefExists(t, definitions, "#/paths/~1some~1where~1{id}/parameters/1/schema")
|
||||
assertSchemaRefExists(t, definitions, "#/paths/~1some~1where~1{id}/get/parameters/1/schema")
|
||||
// responses
|
||||
assertSchemaRefExists(t, definitions, "#/responses/someResponse/schema")
|
||||
assertSchemaRefExists(t, definitions, "#/paths/~1some~1where~1{id}/get/responses/default/schema")
|
||||
assertSchemaRefExists(t, definitions, "#/paths/~1some~1where~1{id}/get/responses/200/schema")
|
||||
// definitions
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/tag")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/tag/properties/id")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/tag/properties/value")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/tag/definitions/category")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/tag/definitions/category/properties/id")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/tag/definitions/category/properties/value")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAdditionalProps")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAdditionalProps/additionalProperties")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAdditionalItems")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAdditionalItems/items/0")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAdditionalItems/items/1")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAdditionalItems/additionalItems")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withNot")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withNot/not")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAnyOf")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAnyOf/anyOf/0")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAnyOf/anyOf/1")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAllOf")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAllOf/allOf/0")
|
||||
assertSchemaRefExists(t, definitions, "#/definitions/withAllOf/allOf/1")
|
||||
allOfs := analyzer.allOfs
|
||||
assert.Len(t, allOfs, 1)
|
||||
assert.Contains(t, allOfs, "#/definitions/withAllOf")
|
||||
}
|
||||
}
|
||||
|
||||
func loadSpec(path string) (*spec.Swagger, error) {
|
||||
spec.PathLoader = func(path string) (json.RawMessage, error) {
|
||||
ext := filepath.Ext(path)
|
||||
if ext == ".yml" || ext == ".yaml" {
|
||||
return fmts.YAMLDoc(path)
|
||||
}
|
||||
data, err := swag.LoadFromFileOrHTTP(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return json.RawMessage(data), nil
|
||||
}
|
||||
data, err := fmts.YAMLDoc(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var sw spec.Swagger
|
||||
if err := json.Unmarshal(data, &sw); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &sw, nil
|
||||
}
|
||||
|
||||
func TestReferenceAnalysis(t *testing.T) {
|
||||
doc, err := loadSpec(filepath.Join("fixtures", "references.yml"))
|
||||
if assert.NoError(t, err) {
|
||||
definitions := New(doc).references
|
||||
|
||||
// parameters
|
||||
assertRefExists(t, definitions.parameters, "#/paths/~1some~1where~1{id}/parameters/0")
|
||||
assertRefExists(t, definitions.parameters, "#/paths/~1some~1where~1{id}/get/parameters/0")
|
||||
|
||||
// path items
|
||||
assertRefExists(t, definitions.pathItems, "#/paths/~1other~1place")
|
||||
|
||||
// responses
|
||||
assertRefExists(t, definitions.responses, "#/paths/~1some~1where~1{id}/get/responses/404")
|
||||
|
||||
// definitions
|
||||
assertRefExists(t, definitions.schemas, "#/responses/notFound/schema")
|
||||
assertRefExists(t, definitions.schemas, "#/paths/~1some~1where~1{id}/get/responses/200/schema")
|
||||
assertRefExists(t, definitions.schemas, "#/definitions/tag/properties/audit")
|
||||
|
||||
// items
|
||||
assertRefExists(t, definitions.allRefs, "#/paths/~1some~1where~1{id}/get/parameters/1/items")
|
||||
}
|
||||
}
|
||||
|
||||
func assertRefExists(t testing.TB, data map[string]spec.Ref, key string) bool {
|
||||
if _, ok := data[key]; !ok {
|
||||
return assert.Fail(t, fmt.Sprintf("expected %q to exist in the ref bag", key))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func assertSchemaRefExists(t testing.TB, data map[string]SchemaRef, key string) bool {
|
||||
if _, ok := data[key]; !ok {
|
||||
return assert.Fail(t, fmt.Sprintf("expected %q to exist in schema ref bag", key))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func TestPatternAnalysis(t *testing.T) {
|
||||
doc, err := loadSpec(filepath.Join("fixtures", "patterns.yml"))
|
||||
if assert.NoError(t, err) {
|
||||
pt := New(doc).patterns
|
||||
|
||||
// parameters
|
||||
assertPattern(t, pt.parameters, "#/parameters/idParam", "a[A-Za-Z0-9]+")
|
||||
assertPattern(t, pt.parameters, "#/paths/~1some~1where~1{id}/parameters/1", "b[A-Za-z0-9]+")
|
||||
assertPattern(t, pt.parameters, "#/paths/~1some~1where~1{id}/get/parameters/0", "[abc][0-9]+")
|
||||
|
||||
// responses
|
||||
assertPattern(t, pt.headers, "#/responses/notFound/headers/ContentLength", "[0-9]+")
|
||||
assertPattern(t, pt.headers, "#/paths/~1some~1where~1{id}/get/responses/200/headers/X-Request-Id", "d[A-Za-z0-9]+")
|
||||
|
||||
// definitions
|
||||
assertPattern(t, pt.schemas, "#/paths/~1other~1place/post/parameters/0/schema/properties/value", "e[A-Za-z0-9]+")
|
||||
assertPattern(t, pt.schemas, "#/paths/~1other~1place/post/responses/200/schema/properties/data", "[0-9]+[abd]")
|
||||
assertPattern(t, pt.schemas, "#/definitions/named", "f[A-Za-z0-9]+")
|
||||
assertPattern(t, pt.schemas, "#/definitions/tag/properties/value", "g[A-Za-z0-9]+")
|
||||
|
||||
// items
|
||||
assertPattern(t, pt.items, "#/paths/~1some~1where~1{id}/get/parameters/1/items", "c[A-Za-z0-9]+")
|
||||
assertPattern(t, pt.items, "#/paths/~1other~1place/post/responses/default/headers/Via/items", "[A-Za-z]+")
|
||||
}
|
||||
}
|
||||
|
||||
func assertPattern(t testing.TB, data map[string]string, key, pattern string) bool {
|
||||
if assert.Contains(t, data, key) {
|
||||
return assert.Equal(t, pattern, data[key])
|
||||
}
|
||||
return false
|
||||
}
|
||||
43
vendor/github.com/go-openapi/analysis/fixtures/allOf.yml
generated
vendored
43
vendor/github.com/go-openapi/analysis/fixtures/allOf.yml
generated
vendored
@@ -1,43 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: allOf analysis
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
type: integer
|
||||
format: int32
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
get:
|
||||
parameters:
|
||||
- name: limit
|
||||
in: query
|
||||
type: integer
|
||||
format: int32
|
||||
required: false
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
type: object
|
||||
200:
|
||||
schema:
|
||||
type: object
|
||||
definitions:
|
||||
tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
86
vendor/github.com/go-openapi/analysis/fixtures/definitions.yml
generated
vendored
86
vendor/github.com/go-openapi/analysis/fixtures/definitions.yml
generated
vendored
@@ -1,86 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: Definition analysis
|
||||
parameters:
|
||||
someParam:
|
||||
name: someParam
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
responses:
|
||||
someResponse:
|
||||
schema:
|
||||
type: object
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
type: integer
|
||||
format: int32
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
get:
|
||||
parameters:
|
||||
- name: limit
|
||||
in: query
|
||||
type: integer
|
||||
format: int32
|
||||
required: false
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
type: object
|
||||
200:
|
||||
schema:
|
||||
type: object
|
||||
definitions:
|
||||
tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
definitions:
|
||||
category:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
value:
|
||||
type: string
|
||||
withAdditionalProps:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
withAdditionalItems:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
- type: bool
|
||||
additionalItems:
|
||||
type: integer
|
||||
format: int32
|
||||
withNot:
|
||||
type: object
|
||||
not:
|
||||
$ref: "#/definitions/tag"
|
||||
withAnyOf:
|
||||
anyOf:
|
||||
- type: object
|
||||
- type: string
|
||||
withAllOf:
|
||||
allOf:
|
||||
- type: object
|
||||
- type: string
|
||||
50
vendor/github.com/go-openapi/analysis/fixtures/external/definitions.yml
generated
vendored
50
vendor/github.com/go-openapi/analysis/fixtures/external/definitions.yml
generated
vendored
@@ -1,50 +0,0 @@
|
||||
definitions:
|
||||
named:
|
||||
type: string
|
||||
tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
audit:
|
||||
$ref: "#/definitions/record"
|
||||
record:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
nestedThing:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
properties:
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
$ref: "definitions2.yml#/coordinate"
|
||||
9
vendor/github.com/go-openapi/analysis/fixtures/external/definitions2.yml
generated
vendored
9
vendor/github.com/go-openapi/analysis/fixtures/external/definitions2.yml
generated
vendored
@@ -1,9 +0,0 @@
|
||||
coordinate:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
13
vendor/github.com/go-openapi/analysis/fixtures/external/errors.yml
generated
vendored
13
vendor/github.com/go-openapi/analysis/fixtures/external/errors.yml
generated
vendored
@@ -1,13 +0,0 @@
|
||||
error:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- message
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
message:
|
||||
type: string
|
||||
readOnly: true
|
||||
35
vendor/github.com/go-openapi/analysis/fixtures/external/nestedParams.yml
generated
vendored
35
vendor/github.com/go-openapi/analysis/fixtures/external/nestedParams.yml
generated
vendored
@@ -1,35 +0,0 @@
|
||||
bodyParam:
|
||||
name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
32
vendor/github.com/go-openapi/analysis/fixtures/external/nestedResponses.yml
generated
vendored
32
vendor/github.com/go-openapi/analysis/fixtures/external/nestedResponses.yml
generated
vendored
@@ -1,32 +0,0 @@
|
||||
genericResponse:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
12
vendor/github.com/go-openapi/analysis/fixtures/external/parameters.yml
generated
vendored
12
vendor/github.com/go-openapi/analysis/fixtures/external/parameters.yml
generated
vendored
@@ -1,12 +0,0 @@
|
||||
parameters:
|
||||
idParam:
|
||||
name: id
|
||||
in: path
|
||||
type: integer
|
||||
format: int32
|
||||
limitParam:
|
||||
name: limit
|
||||
in: query
|
||||
type: integer
|
||||
format: int32
|
||||
required: false
|
||||
9
vendor/github.com/go-openapi/analysis/fixtures/external/pathItem.yml
generated
vendored
9
vendor/github.com/go-openapi/analysis/fixtures/external/pathItem.yml
generated
vendored
@@ -1,9 +0,0 @@
|
||||
get:
|
||||
operationId: modelOp
|
||||
summary: many model variations
|
||||
description: Used to see if a codegen can render all the possible parameter variations for a header param
|
||||
tags:
|
||||
- testcgen
|
||||
responses:
|
||||
default:
|
||||
description: Generic Out
|
||||
4
vendor/github.com/go-openapi/analysis/fixtures/external/responses.yml
generated
vendored
4
vendor/github.com/go-openapi/analysis/fixtures/external/responses.yml
generated
vendored
@@ -1,4 +0,0 @@
|
||||
responses:
|
||||
notFound:
|
||||
schema:
|
||||
$ref: "errors.yml#/error"
|
||||
95
vendor/github.com/go-openapi/analysis/fixtures/external_definitions.yml
generated
vendored
95
vendor/github.com/go-openapi/analysis/fixtures/external_definitions.yml
generated
vendored
@@ -1,95 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: reference analysis
|
||||
|
||||
parameters:
|
||||
someParam:
|
||||
name: someParam
|
||||
in: body
|
||||
schema:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
responses:
|
||||
someResponse:
|
||||
schema:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- $ref: "external/parameters.yml#/parameters/idParam"
|
||||
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
get:
|
||||
parameters:
|
||||
- $ref: "external/parameters.yml#/parameters/limitParam"
|
||||
- name: other
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
$ref: "external/definitions.yml#/definitions/named"
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
404:
|
||||
$ref: "external/responses.yml#/responses/notFound"
|
||||
200:
|
||||
schema:
|
||||
$ref: "external/definitions.yml#/definitions/tag"
|
||||
"/other/place":
|
||||
$ref: "external/pathItem.yml"
|
||||
|
||||
definitions:
|
||||
namedAgain:
|
||||
$ref: "external/definitions.yml#/definitions/named"
|
||||
|
||||
datedTag:
|
||||
allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- $ref: "external/definitions.yml#/definitions/tag"
|
||||
|
||||
records:
|
||||
type: array
|
||||
items:
|
||||
- $ref: "external/definitions.yml#/definitions/record"
|
||||
|
||||
datedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- $ref: "external/definitions.yml#/definitions/record"
|
||||
|
||||
datedTaggedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- $ref: "external/definitions.yml#/definitions/record"
|
||||
additionalItems:
|
||||
$ref: "external/definitions.yml#/definitions/tag"
|
||||
|
||||
otherRecords:
|
||||
type: array
|
||||
items:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
|
||||
tags:
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "external/definitions.yml#/definitions/tag"
|
||||
|
||||
namedThing:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
$ref: "external/definitions.yml#/definitions/named"
|
||||
85
vendor/github.com/go-openapi/analysis/fixtures/flatten.yml
generated
vendored
85
vendor/github.com/go-openapi/analysis/fixtures/flatten.yml
generated
vendored
@@ -1,85 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: reference analysis
|
||||
|
||||
parameters:
|
||||
someParam:
|
||||
name: some
|
||||
in: query
|
||||
type: string
|
||||
responses:
|
||||
notFound:
|
||||
description: "Not Found"
|
||||
schema:
|
||||
$ref: "external/errors.yml#/error"
|
||||
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- $ref: "external/parameters.yml#/parameters/idParam"
|
||||
|
||||
get:
|
||||
parameters:
|
||||
- $ref: "external/parameters.yml#/parameters/limitParam"
|
||||
- $ref: "#/parameters/someParam"
|
||||
- name: other
|
||||
in: query
|
||||
type: string
|
||||
- $ref: "external/nestedParams.yml#/bodyParam"
|
||||
|
||||
responses:
|
||||
default:
|
||||
$ref: "external/nestedResponses.yml#/genericResponse"
|
||||
404:
|
||||
$ref: "#/responses/notFound"
|
||||
200:
|
||||
description: "RecordHolder"
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
$ref: "external/definitions.yml#/definitions/nestedThing"
|
||||
"/other/place":
|
||||
$ref: "external/pathItem.yml"
|
||||
|
||||
definitions:
|
||||
namedAgain:
|
||||
$ref: "external/definitions.yml#/definitions/named"
|
||||
|
||||
datedTag:
|
||||
allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- $ref: "external/definitions.yml#/definitions/tag"
|
||||
|
||||
records:
|
||||
type: array
|
||||
items:
|
||||
- $ref: "external/definitions.yml#/definitions/record"
|
||||
|
||||
datedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- $ref: "external/definitions.yml#/definitions/record"
|
||||
|
||||
otherRecords:
|
||||
type: array
|
||||
items:
|
||||
$ref: "external/definitions.yml#/definitions/record"
|
||||
|
||||
tags:
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "external/definitions.yml#/definitions/tag"
|
||||
|
||||
namedThing:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
$ref: "external/definitions.yml#/definitions/named"
|
||||
namedAgain:
|
||||
$ref: "#/definitions/namedAgain"
|
||||
187
vendor/github.com/go-openapi/analysis/fixtures/inline_schemas.yml
generated
vendored
187
vendor/github.com/go-openapi/analysis/fixtures/inline_schemas.yml
generated
vendored
@@ -1,187 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: reference analysis
|
||||
|
||||
parameters:
|
||||
someParam:
|
||||
name: someParam
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
responses:
|
||||
someResponse:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
type: integer
|
||||
format: int32
|
||||
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
post:
|
||||
responses:
|
||||
default:
|
||||
description: all good
|
||||
get:
|
||||
parameters:
|
||||
- name: limit
|
||||
in: query
|
||||
type: integer
|
||||
format: int32
|
||||
required: false
|
||||
- name: other
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
404:
|
||||
schema:
|
||||
$ref: "errors.yml#/error"
|
||||
200:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
"/other/place":
|
||||
$ref: "external/pathItem.yml"
|
||||
|
||||
definitions:
|
||||
namedAgain:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
datedTag:
|
||||
allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
|
||||
records:
|
||||
type: array
|
||||
items:
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
datedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
datedTaggedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
additionalItems:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
|
||||
otherRecords:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
tags:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
|
||||
namedThing:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
# depth first should have this at the bottom, it's just a very long name
|
||||
pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism:
|
||||
type: object
|
||||
properties:
|
||||
floccinaucinihilipilificationCreatedAt:
|
||||
type: integer
|
||||
format: int64
|
||||
298
vendor/github.com/go-openapi/analysis/fixtures/nested_inline_schemas.yml
generated
vendored
298
vendor/github.com/go-openapi/analysis/fixtures/nested_inline_schemas.yml
generated
vendored
@@ -1,298 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: reference analysis
|
||||
|
||||
parameters:
|
||||
someParam:
|
||||
name: someParam
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
responses:
|
||||
someResponse:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
type: integer
|
||||
format: int32
|
||||
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
post:
|
||||
responses:
|
||||
default:
|
||||
description: all good
|
||||
get:
|
||||
parameters:
|
||||
- name: limit
|
||||
in: query
|
||||
type: integer
|
||||
format: int32
|
||||
required: false
|
||||
- name: other
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
404:
|
||||
schema:
|
||||
$ref: "errors.yml#/error"
|
||||
200:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
"/other/place":
|
||||
$ref: "external/pathItem.yml"
|
||||
|
||||
definitions:
|
||||
namedAgain:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
datedTag:
|
||||
allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
|
||||
records:
|
||||
type: array
|
||||
items:
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
datedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
datedTaggedRecords:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
additionalItems:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
|
||||
otherRecords:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
tags:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
|
||||
namedThing:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
nestedThing:
|
||||
type: object
|
||||
properties:
|
||||
record:
|
||||
type: array
|
||||
items:
|
||||
- type: string
|
||||
format: date-time
|
||||
- type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
- allOf:
|
||||
- type: string
|
||||
format: date
|
||||
- type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
name:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
124
vendor/github.com/go-openapi/analysis/fixtures/patterns.yml
generated
vendored
124
vendor/github.com/go-openapi/analysis/fixtures/patterns.yml
generated
vendored
@@ -1,124 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: reference analysis
|
||||
|
||||
parameters:
|
||||
idParam:
|
||||
name: id
|
||||
in: path
|
||||
type: string
|
||||
pattern: 'a[A-Za-Z0-9]+'
|
||||
|
||||
responses:
|
||||
notFound:
|
||||
headers:
|
||||
ContentLength:
|
||||
type: string
|
||||
pattern: '[0-9]+'
|
||||
schema:
|
||||
$ref: "#/definitions/error"
|
||||
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- $ref: "#/parameters/idParam"
|
||||
- name: name
|
||||
in: query
|
||||
pattern: 'b[A-Za-z0-9]+'
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
get:
|
||||
parameters:
|
||||
- name: filter
|
||||
in: query
|
||||
type: string
|
||||
pattern: "[abc][0-9]+"
|
||||
- name: other
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
pattern: 'c[A-Za-z0-9]+'
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
type: object
|
||||
404:
|
||||
$ref: "#/responses/notFound"
|
||||
200:
|
||||
headers:
|
||||
X-Request-Id:
|
||||
type: string
|
||||
pattern: 'd[A-Za-z0-9]+'
|
||||
schema:
|
||||
$ref: "#/definitions/tag"
|
||||
"/other/place":
|
||||
post:
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
value:
|
||||
type: string
|
||||
pattern: 'e[A-Za-z0-9]+'
|
||||
responses:
|
||||
default:
|
||||
headers:
|
||||
Via:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
pattern: '[A-Za-z]+'
|
||||
200:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: string
|
||||
pattern: "[0-9]+[abd]"
|
||||
|
||||
definitions:
|
||||
named:
|
||||
type: string
|
||||
pattern: 'f[A-Za-z0-9]+'
|
||||
tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
pattern: 'g[A-Za-z0-9]+'
|
||||
audit:
|
||||
$ref: "#/definitions/record"
|
||||
record:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
error:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- message
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
message:
|
||||
type: string
|
||||
readOnly: true
|
||||
89
vendor/github.com/go-openapi/analysis/fixtures/references.yml
generated
vendored
89
vendor/github.com/go-openapi/analysis/fixtures/references.yml
generated
vendored
@@ -1,89 +0,0 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: reference analysis
|
||||
|
||||
parameters:
|
||||
idParam:
|
||||
name: id
|
||||
in: path
|
||||
type: integer
|
||||
format: int32
|
||||
limitParam:
|
||||
name: limit
|
||||
in: query
|
||||
type: integer
|
||||
format: int32
|
||||
required: false
|
||||
|
||||
responses:
|
||||
notFound:
|
||||
schema:
|
||||
$ref: "#/definitions/error"
|
||||
|
||||
paths:
|
||||
"/some/where/{id}":
|
||||
parameters:
|
||||
- $ref: "#/parameters/idParam"
|
||||
|
||||
- name: bodyId
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
get:
|
||||
parameters:
|
||||
- $ref: "#/parameters/limitParam"
|
||||
- name: other
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/named"
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
type: object
|
||||
responses:
|
||||
default:
|
||||
schema:
|
||||
type: object
|
||||
404:
|
||||
$ref: "#/responses/notFound"
|
||||
200:
|
||||
schema:
|
||||
$ref: "#/definitions/tag"
|
||||
"/other/place":
|
||||
$ref: "#/x-shared-path/getItems"
|
||||
|
||||
definitions:
|
||||
named:
|
||||
type: string
|
||||
tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
value:
|
||||
type: string
|
||||
audit:
|
||||
$ref: "#/definitions/record"
|
||||
record:
|
||||
type: object
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
error:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- message
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
message:
|
||||
type: string
|
||||
readOnly: true
|
||||
805
vendor/github.com/go-openapi/analysis/flatten_test.go
generated
vendored
805
vendor/github.com/go-openapi/analysis/flatten_test.go
generated
vendored
@@ -1,805 +0,0 @@
|
||||
package analysis
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/go-openapi/jsonpointer"
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSaveDefinition(t *testing.T) {
|
||||
sp := &spec.Swagger{}
|
||||
saveSchema(sp, "theName", spec.StringProperty())
|
||||
assert.Contains(t, sp.Definitions, "theName")
|
||||
}
|
||||
|
||||
func TestNameFromRef(t *testing.T) {
|
||||
values := []struct{ Source, Expected string }{
|
||||
{"#/definitions/errorModel", "errorModel"},
|
||||
{"http://somewhere.com/definitions/errorModel", "errorModel"},
|
||||
{"http://somewhere.com/definitions/errorModel.json", "errorModel"},
|
||||
{"/definitions/errorModel", "errorModel"},
|
||||
{"/definitions/errorModel.json", "errorModel"},
|
||||
{"http://somewhere.com", "somewhereCom"},
|
||||
{"#", ""},
|
||||
}
|
||||
|
||||
for _, v := range values {
|
||||
assert.Equal(t, v.Expected, nameFromRef(spec.MustCreateRef(v.Source)))
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefinitionName(t *testing.T) {
|
||||
values := []struct {
|
||||
Source, Expected string
|
||||
Definitions spec.Definitions
|
||||
}{
|
||||
{"#/definitions/errorModel", "errorModel", map[string]spec.Schema(nil)},
|
||||
{"http://somewhere.com/definitions/errorModel", "errorModel", map[string]spec.Schema(nil)},
|
||||
{"#/definitions/errorModel", "errorModel", map[string]spec.Schema{"apples": *spec.StringProperty()}},
|
||||
{"#/definitions/errorModel", "errorModelOAIGen", map[string]spec.Schema{"errorModel": *spec.StringProperty()}},
|
||||
{"#/definitions/errorModel", "errorModelOAIGen1", map[string]spec.Schema{"errorModel": *spec.StringProperty(), "errorModelOAIGen": *spec.StringProperty()}},
|
||||
{"#", "oaiGen", nil},
|
||||
}
|
||||
|
||||
for _, v := range values {
|
||||
assert.Equal(t, v.Expected, uniqifyName(v.Definitions, nameFromRef(spec.MustCreateRef(v.Source))))
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateRef(t *testing.T) {
|
||||
bp := filepath.Join("fixtures", "external_definitions.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
if assert.NoError(t, err) {
|
||||
|
||||
values := []struct {
|
||||
Key string
|
||||
Ref spec.Ref
|
||||
}{
|
||||
{"#/parameters/someParam/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/parameters/1/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/responses/someResponse/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/namedAgain", spec.MustCreateRef("#/definitions/named")},
|
||||
{"#/definitions/datedTag/allOf/1", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/datedRecords/items/1", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/datedTaggedRecords/items/1", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/datedTaggedRecords/additionalItems", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/otherRecords/items", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/tags/additionalProperties", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/namedThing/properties/name", spec.MustCreateRef("#/definitions/named")},
|
||||
}
|
||||
|
||||
for _, v := range values {
|
||||
err := updateRef(sp, v.Key, v.Ref)
|
||||
if assert.NoError(t, err) {
|
||||
ptr, err := jsonpointer.New(v.Key[1:])
|
||||
if assert.NoError(t, err) {
|
||||
vv, _, err := ptr.Get(sp)
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
switch tv := vv.(type) {
|
||||
case *spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String())
|
||||
case spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String())
|
||||
case *spec.SchemaOrBool:
|
||||
assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String())
|
||||
case *spec.SchemaOrArray:
|
||||
assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String())
|
||||
default:
|
||||
assert.Fail(t, "unknown type", "got %T", vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportExternalReferences(t *testing.T) {
|
||||
bp := filepath.Join(".", "fixtures", "external_definitions.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
if assert.NoError(t, err) {
|
||||
|
||||
values := []struct {
|
||||
Key string
|
||||
Ref spec.Ref
|
||||
}{
|
||||
{"#/parameters/someParam/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/parameters/1/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/responses/someResponse/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/namedAgain", spec.MustCreateRef("#/definitions/named")},
|
||||
{"#/definitions/datedTag/allOf/1", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/datedRecords/items/1", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/datedTaggedRecords/items/1", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/datedTaggedRecords/additionalItems", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/otherRecords/items", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/tags/additionalProperties", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/namedThing/properties/name", spec.MustCreateRef("#/definitions/named")},
|
||||
}
|
||||
for _, v := range values {
|
||||
// technically not necessary to run for each value, but if things go right
|
||||
// this is idempotent, so having it repeat shouldn't matter
|
||||
// this validates that behavior
|
||||
err := importExternalReferences(&FlattenOpts{
|
||||
Spec: New(sp),
|
||||
BasePath: bp,
|
||||
})
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
|
||||
ptr, err := jsonpointer.New(v.Key[1:])
|
||||
if assert.NoError(t, err) {
|
||||
vv, _, err := ptr.Get(sp)
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
switch tv := vv.(type) {
|
||||
case *spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key)
|
||||
case spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key)
|
||||
case *spec.SchemaOrBool:
|
||||
assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key)
|
||||
case *spec.SchemaOrArray:
|
||||
assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key)
|
||||
default:
|
||||
assert.Fail(t, "unknown type", "got %T", vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.Len(t, sp.Definitions, 11)
|
||||
assert.Contains(t, sp.Definitions, "tag")
|
||||
assert.Contains(t, sp.Definitions, "named")
|
||||
assert.Contains(t, sp.Definitions, "record")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRewriteSchemaRef(t *testing.T) {
|
||||
bp := filepath.Join("fixtures", "inline_schemas.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
if assert.NoError(t, err) {
|
||||
|
||||
values := []struct {
|
||||
Key string
|
||||
Ref spec.Ref
|
||||
}{
|
||||
{"#/parameters/someParam/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/parameters/1/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/responses/someResponse/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/namedAgain", spec.MustCreateRef("#/definitions/named")},
|
||||
{"#/definitions/datedTag/allOf/1", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/datedRecords/items/1", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/datedTaggedRecords/items/1", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/datedTaggedRecords/additionalItems", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/otherRecords/items", spec.MustCreateRef("#/definitions/record")},
|
||||
{"#/definitions/tags/additionalProperties", spec.MustCreateRef("#/definitions/tag")},
|
||||
{"#/definitions/namedThing/properties/name", spec.MustCreateRef("#/definitions/named")},
|
||||
}
|
||||
|
||||
for i, v := range values {
|
||||
err := rewriteSchemaToRef(sp, v.Key, v.Ref)
|
||||
if assert.NoError(t, err) {
|
||||
ptr, err := jsonpointer.New(v.Key[1:])
|
||||
if assert.NoError(t, err) {
|
||||
vv, _, err := ptr.Get(sp)
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
switch tv := vv.(type) {
|
||||
case *spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case *spec.SchemaOrBool:
|
||||
assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case *spec.SchemaOrArray:
|
||||
assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key)
|
||||
default:
|
||||
assert.Fail(t, "unknown type", "got %T", vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitKey(t *testing.T) {
|
||||
|
||||
type KeyFlag uint64
|
||||
|
||||
const (
|
||||
isOperation KeyFlag = 1 << iota
|
||||
isDefinition
|
||||
isSharedOperationParam
|
||||
isOperationParam
|
||||
isOperationResponse
|
||||
isDefaultResponse
|
||||
isStatusCodeResponse
|
||||
)
|
||||
|
||||
values := []struct {
|
||||
Key string
|
||||
Flags KeyFlag
|
||||
PathItemRef spec.Ref
|
||||
PathRef spec.Ref
|
||||
Name string
|
||||
}{
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/parameters/1/schema",
|
||||
isOperation | isSharedOperationParam,
|
||||
spec.Ref{},
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/2/schema",
|
||||
isOperation | isOperationParam,
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}/GET"),
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/responses/default/schema",
|
||||
isOperation | isOperationResponse | isDefaultResponse,
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}/GET"),
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}"),
|
||||
"Default",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/responses/200/schema",
|
||||
isOperation | isOperationResponse | isStatusCodeResponse,
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}/GET"),
|
||||
spec.MustCreateRef("#/paths/~1some~1where~1{id}"),
|
||||
"OK",
|
||||
},
|
||||
{
|
||||
"#/definitions/namedAgain",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"namedAgain",
|
||||
},
|
||||
{
|
||||
"#/definitions/datedRecords/items/1",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"datedRecords",
|
||||
},
|
||||
{
|
||||
"#/definitions/datedRecords/items/1",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"datedRecords",
|
||||
},
|
||||
{
|
||||
"#/definitions/datedTaggedRecords/items/1",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"datedTaggedRecords",
|
||||
},
|
||||
{
|
||||
"#/definitions/datedTaggedRecords/additionalItems",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"datedTaggedRecords",
|
||||
},
|
||||
{
|
||||
"#/definitions/otherRecords/items",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"otherRecords",
|
||||
},
|
||||
{
|
||||
"#/definitions/tags/additionalProperties",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"tags",
|
||||
},
|
||||
{
|
||||
"#/definitions/namedThing/properties/name",
|
||||
isDefinition,
|
||||
spec.Ref{},
|
||||
spec.Ref{},
|
||||
"namedThing",
|
||||
},
|
||||
}
|
||||
|
||||
for i, v := range values {
|
||||
parts := keyParts(v.Key)
|
||||
pref := parts.PathRef()
|
||||
piref := parts.PathItemRef()
|
||||
assert.Equal(t, v.PathRef.String(), pref.String(), "pathRef: %s at %d", v.Key, i)
|
||||
assert.Equal(t, v.PathItemRef.String(), piref.String(), "pathItemRef: %s at %d", v.Key, i)
|
||||
|
||||
if v.Flags&isOperation != 0 {
|
||||
assert.True(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i)
|
||||
}
|
||||
if v.Flags&isDefinition != 0 {
|
||||
assert.True(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i)
|
||||
assert.Equal(t, v.Name, parts.DefinitionName(), "definition name: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i)
|
||||
if v.Name != "" {
|
||||
assert.Equal(t, v.Name, parts.ResponseName(), "response name: %s at %d", v.Key, i)
|
||||
}
|
||||
}
|
||||
if v.Flags&isOperationParam != 0 {
|
||||
assert.True(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i)
|
||||
}
|
||||
if v.Flags&isSharedOperationParam != 0 {
|
||||
assert.True(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i)
|
||||
}
|
||||
if v.Flags&isOperationResponse != 0 {
|
||||
assert.True(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i)
|
||||
}
|
||||
if v.Flags&isDefaultResponse != 0 {
|
||||
assert.True(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i)
|
||||
}
|
||||
if v.Flags&isStatusCodeResponse != 0 {
|
||||
assert.True(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i)
|
||||
} else {
|
||||
assert.False(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func definitionPtr(key string) string {
|
||||
if !strings.HasPrefix(key, "#/definitions") {
|
||||
return key
|
||||
}
|
||||
return strings.Join(strings.Split(key, "/")[:3], "/")
|
||||
}
|
||||
|
||||
func TestNamesFromKey(t *testing.T) {
|
||||
bp := filepath.Join("fixtures", "inline_schemas.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
if assert.NoError(t, err) {
|
||||
|
||||
values := []struct {
|
||||
Key string
|
||||
Names []string
|
||||
}{
|
||||
{"#/paths/~1some~1where~1{id}/parameters/1/schema", []string{"GetSomeWhereID params body", "PostSomeWhereID params body"}},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema", []string{"GetSomeWhereID params body"}},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema", []string{"GetSomeWhereID Default body"}},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema", []string{"GetSomeWhereID OK body"}},
|
||||
{"#/definitions/namedAgain", []string{"namedAgain"}},
|
||||
{"#/definitions/datedTag/allOf/1", []string{"datedTag allOf 1"}},
|
||||
{"#/definitions/datedRecords/items/1", []string{"datedRecords tuple 1"}},
|
||||
{"#/definitions/datedTaggedRecords/items/1", []string{"datedTaggedRecords tuple 1"}},
|
||||
{"#/definitions/datedTaggedRecords/additionalItems", []string{"datedTaggedRecords tuple additionalItems"}},
|
||||
{"#/definitions/otherRecords/items", []string{"otherRecords items"}},
|
||||
{"#/definitions/tags/additionalProperties", []string{"tags additionalProperties"}},
|
||||
{"#/definitions/namedThing/properties/name", []string{"namedThing name"}},
|
||||
}
|
||||
|
||||
for i, v := range values {
|
||||
ptr, err := jsonpointer.New(definitionPtr(v.Key)[1:])
|
||||
if assert.NoError(t, err) {
|
||||
vv, _, err := ptr.Get(sp)
|
||||
if assert.NoError(t, err) {
|
||||
switch tv := vv.(type) {
|
||||
case *spec.Schema:
|
||||
aschema, err := Schema(SchemaOpts{Schema: tv, Root: sp, BasePath: bp})
|
||||
if assert.NoError(t, err) {
|
||||
names := namesFromKey(keyParts(v.Key), aschema, opRefsByRef(gatherOperations(New(sp), nil)))
|
||||
assert.Equal(t, v.Names, names, "for %s at %d", v.Key, i)
|
||||
}
|
||||
case spec.Schema:
|
||||
aschema, err := Schema(SchemaOpts{Schema: &tv, Root: sp, BasePath: bp})
|
||||
if assert.NoError(t, err) {
|
||||
names := namesFromKey(keyParts(v.Key), aschema, opRefsByRef(gatherOperations(New(sp), nil)))
|
||||
assert.Equal(t, v.Names, names, "for %s at %d", v.Key, i)
|
||||
}
|
||||
default:
|
||||
assert.Fail(t, "unknown type", "got %T", vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDepthFirstSort(t *testing.T) {
|
||||
bp := filepath.Join("fixtures", "inline_schemas.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
values := []string{
|
||||
"#/paths/~1some~1where~1{id}/parameters/1/schema/properties/createdAt",
|
||||
"#/paths/~1some~1where~1{id}/parameters/1/schema",
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/createdAt",
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/2/schema",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/id",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/value",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/200/schema",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/404/schema",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/createdAt",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/default/schema",
|
||||
"#/definitions/datedRecords/items/1/properties/createdAt",
|
||||
"#/definitions/datedTaggedRecords/items/1/properties/createdAt",
|
||||
"#/definitions/namedThing/properties/name/properties/id",
|
||||
"#/definitions/records/items/0/properties/createdAt",
|
||||
"#/definitions/datedTaggedRecords/additionalItems/properties/id",
|
||||
"#/definitions/datedTaggedRecords/additionalItems/properties/value",
|
||||
"#/definitions/otherRecords/items/properties/createdAt",
|
||||
"#/definitions/tags/additionalProperties/properties/id",
|
||||
"#/definitions/tags/additionalProperties/properties/value",
|
||||
"#/definitions/datedRecords/items/0",
|
||||
"#/definitions/datedRecords/items/1",
|
||||
"#/definitions/datedTag/allOf/0",
|
||||
"#/definitions/datedTag/allOf/1",
|
||||
"#/definitions/datedTag/properties/id",
|
||||
"#/definitions/datedTag/properties/value",
|
||||
"#/definitions/datedTaggedRecords/items/0",
|
||||
"#/definitions/datedTaggedRecords/items/1",
|
||||
"#/definitions/namedAgain/properties/id",
|
||||
"#/definitions/namedThing/properties/name",
|
||||
"#/definitions/pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism/properties/floccinaucinihilipilificationCreatedAt",
|
||||
"#/definitions/records/items/0",
|
||||
"#/definitions/datedTaggedRecords/additionalItems",
|
||||
"#/definitions/otherRecords/items",
|
||||
"#/definitions/tags/additionalProperties",
|
||||
"#/definitions/datedRecords",
|
||||
"#/definitions/datedTag",
|
||||
"#/definitions/datedTaggedRecords",
|
||||
"#/definitions/namedAgain",
|
||||
"#/definitions/namedThing",
|
||||
"#/definitions/otherRecords",
|
||||
"#/definitions/pneumonoultramicroscopicsilicovolcanoconiosisAntidisestablishmentarianism",
|
||||
"#/definitions/records",
|
||||
"#/definitions/tags",
|
||||
}
|
||||
if assert.NoError(t, err) {
|
||||
a := New(sp)
|
||||
result := sortDepthFirst(a.allSchemas)
|
||||
assert.Equal(t, values, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNameInlinedSchemas(t *testing.T) {
|
||||
bp := filepath.Join(".", "fixtures", "nested_inline_schemas.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
values := []struct {
|
||||
Key string
|
||||
Location string
|
||||
Ref spec.Ref
|
||||
}{
|
||||
{"#/paths/~1some~1where~1{id}/parameters/1/schema/items", "#/definitions/postSomeWhereIdParamsBody/items", spec.MustCreateRef("#/definitions/postSomeWhereIdParamsBodyItems")},
|
||||
{"#/paths/~1some~1where~1{id}/parameters/1/schema", "#/paths/~1some~1where~1{id}/parameters/1/schema", spec.MustCreateRef("#/definitions/postSomeWhereIdParamsBody")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record/items/2/properties/name", "#/definitions/getSomeWhereIdParamsBodyRecordItems2/properties/name", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2Name")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record/items/1", "#/definitions/getSomeWhereIdParamsBodyRecord/items/1", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems1")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record/items/2", "#/definitions/getSomeWhereIdParamsBodyRecord/items/2", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema/properties/record", "#/definitions/getSomeWhereIdParamsBodyOAIGen/properties/record", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecord")},
|
||||
{"#/paths/~1some~1where~1{id}/get/parameters/2/schema", "#/paths/~1some~1where~1{id}/get/parameters/2/schema", spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyOAIGen")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record/items/2/properties/name", "#/definitions/getSomeWhereIdOKBodyRecordItems2/properties/name", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecordItems2Name")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record/items/1", "#/definitions/getSomeWhereIdOKBodyRecord/items/1", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecordItems1")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record/items/2", "#/definitions/getSomeWhereIdOKBodyRecord/items/2", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecordItems2")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema/properties/record", "#/definitions/getSomeWhereIdOKBody/properties/record", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBodyRecord")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/200/schema", "#/paths/~1some~1where~1{id}/get/responses/200/schema", spec.MustCreateRef("#/definitions/getSomeWhereIdOKBody")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record/items/2/properties/name", "#/definitions/getSomeWhereIdDefaultBodyRecordItems2/properties/name", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecordItems2Name")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record/items/1", "#/definitions/getSomeWhereIdDefaultBodyRecord/items/1", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecordItems1")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record/items/2", "#/definitions/getSomeWhereIdDefaultBodyRecord/items/2", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecordItems2")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema/properties/record", "#/definitions/getSomeWhereIdDefaultBody/properties/record", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBodyRecord")},
|
||||
{"#/paths/~1some~1where~1{id}/get/responses/default/schema", "#/paths/~1some~1where~1{id}/get/responses/default/schema", spec.MustCreateRef("#/definitions/getSomeWhereIdDefaultBody")},
|
||||
{"#/definitions/nestedThing/properties/record/items/2/allOf/1/additionalProperties", "#/definitions/nestedThingRecordItems2AllOf1/additionalProperties", spec.MustCreateRef("#/definitions/nestedThingRecordItems2AllOf1AdditionalProperties")},
|
||||
{"#/definitions/nestedThing/properties/record/items/2/allOf/1", "#/definitions/nestedThingRecordItems2/allOf/1", spec.MustCreateRef("#/definitions/nestedThingRecordItems2AllOf1")},
|
||||
{"#/definitions/nestedThing/properties/record/items/2/properties/name", "#/definitions/nestedThingRecordItems2/properties/name", spec.MustCreateRef("#/definitions/nestedThingRecordItems2Name")},
|
||||
{"#/definitions/nestedThing/properties/record/items/1", "#/definitions/nestedThingRecord/items/1", spec.MustCreateRef("#/definitions/nestedThingRecordItems1")},
|
||||
{"#/definitions/nestedThing/properties/record/items/2", "#/definitions/nestedThingRecord/items/2", spec.MustCreateRef("#/definitions/nestedThingRecordItems2")},
|
||||
{"#/definitions/datedRecords/items/1", "#/definitions/datedRecords/items/1", spec.MustCreateRef("#/definitions/datedRecordsItems1")},
|
||||
{"#/definitions/datedTaggedRecords/items/1", "#/definitions/datedTaggedRecords/items/1", spec.MustCreateRef("#/definitions/datedTaggedRecordsItems1")},
|
||||
{"#/definitions/namedThing/properties/name", "#/definitions/namedThing/properties/name", spec.MustCreateRef("#/definitions/namedThingName")},
|
||||
{"#/definitions/nestedThing/properties/record", "#/definitions/nestedThing/properties/record", spec.MustCreateRef("#/definitions/nestedThingRecord")},
|
||||
{"#/definitions/records/items/0", "#/definitions/records/items/0", spec.MustCreateRef("#/definitions/recordsItems0")},
|
||||
{"#/definitions/datedTaggedRecords/additionalItems", "#/definitions/datedTaggedRecords/additionalItems", spec.MustCreateRef("#/definitions/datedTaggedRecordsItemsAdditionalItems")},
|
||||
{"#/definitions/otherRecords/items", "#/definitions/otherRecords/items", spec.MustCreateRef("#/definitions/otherRecordsItems")},
|
||||
{"#/definitions/tags/additionalProperties", "#/definitions/tags/additionalProperties", spec.MustCreateRef("#/definitions/tagsAdditionalProperties")},
|
||||
}
|
||||
if assert.NoError(t, err) {
|
||||
err := nameInlinedSchemas(&FlattenOpts{
|
||||
Spec: New(sp),
|
||||
BasePath: bp,
|
||||
})
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
for i, v := range values {
|
||||
ptr, err := jsonpointer.New(v.Location[1:])
|
||||
if assert.NoError(t, err, "at %d for %s", i, v.Key) {
|
||||
vv, _, err := ptr.Get(sp)
|
||||
|
||||
if assert.NoError(t, err, "at %d for %s", i, v.Key) {
|
||||
switch tv := vv.(type) {
|
||||
case *spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case *spec.SchemaOrBool:
|
||||
var sRef spec.Ref
|
||||
if tv != nil && tv.Schema != nil {
|
||||
sRef = tv.Schema.Ref
|
||||
}
|
||||
assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key)
|
||||
case *spec.SchemaOrArray:
|
||||
var sRef spec.Ref
|
||||
if tv != nil && tv.Schema != nil {
|
||||
sRef = tv.Schema.Ref
|
||||
}
|
||||
assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key)
|
||||
default:
|
||||
assert.Fail(t, "unknown type", "got %T", vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for k, rr := range New(sp).allSchemas {
|
||||
if !strings.HasPrefix(k, "#/responses") && !strings.HasPrefix(k, "#/parameters") {
|
||||
if rr.Schema != nil && rr.Schema.Ref.String() == "" && !rr.TopLevel {
|
||||
asch, err := Schema(SchemaOpts{Schema: rr.Schema, Root: sp, BasePath: bp})
|
||||
if assert.NoError(t, err, "for key: %s", k) {
|
||||
if !asch.IsSimpleSchema {
|
||||
assert.Fail(t, "not a top level schema", "for key: %s", k)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFlatten(t *testing.T) {
|
||||
bp := filepath.Join(".", "fixtures", "flatten.yml")
|
||||
sp, err := loadSpec(bp)
|
||||
values := []struct {
|
||||
Key string
|
||||
Location string
|
||||
Ref spec.Ref
|
||||
Expected interface{}
|
||||
}{
|
||||
{
|
||||
"#/responses/notFound/schema",
|
||||
"#/responses/notFound/schema",
|
||||
spec.MustCreateRef("#/definitions/error"),
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/parameters/0",
|
||||
"#/paths/~1some~1where~1{id}/parameters/0/name",
|
||||
spec.Ref{},
|
||||
"id",
|
||||
},
|
||||
{
|
||||
"#/paths/~1other~1place",
|
||||
"#/paths/~1other~1place/get/operationId",
|
||||
spec.Ref{},
|
||||
"modelOp",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/0",
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/0/name",
|
||||
spec.Ref{},
|
||||
"limit",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/1",
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/1/name",
|
||||
spec.Ref{},
|
||||
"some",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/2",
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/2/name",
|
||||
spec.Ref{},
|
||||
"other",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/3",
|
||||
"#/paths/~1some~1where~1{id}/get/parameters/3/schema",
|
||||
spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBody"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/paths/~1some~1where~1{id}/get/responses/200",
|
||||
"#/paths/~1some~1where~1{id}/get/responses/200/schema",
|
||||
spec.MustCreateRef("#/definitions/getSomeWhereIdOKBody"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/namedAgain",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/named"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/namedThing/properties/name",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/named"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/namedThing/properties/namedAgain",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/namedAgain"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/datedRecords/items/1",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/record"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/otherRecords/items",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/record"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/tags/additionalProperties",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/tag"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/datedTag/allOf/1",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/tag"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/nestedThingRecordItems2/allOf/1",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/nestedThingRecordItems2AllOf1"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/nestedThingRecord/items/1",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/nestedThingRecordItems1"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/nestedThingRecord/items/2",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/nestedThingRecordItems2"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/nestedThing/properties/record",
|
||||
"",
|
||||
spec.MustCreateRef("#/definitions/nestedThingRecord"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"#/definitions/named",
|
||||
"#/definitions/named/type",
|
||||
spec.Ref{},
|
||||
spec.StringOrArray{"string"},
|
||||
},
|
||||
{
|
||||
"#/definitions/error",
|
||||
"#/definitions/error/properties/id/type",
|
||||
spec.Ref{},
|
||||
spec.StringOrArray{"integer"},
|
||||
},
|
||||
{
|
||||
"#/definitions/record",
|
||||
"#/definitions/record/properties/createdAt/format",
|
||||
spec.Ref{},
|
||||
"date-time",
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdOKBody",
|
||||
"#/definitions/getSomeWhereIdOKBody/properties/record",
|
||||
spec.MustCreateRef("#/definitions/nestedThing"),
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdParamsBody",
|
||||
"#/definitions/getSomeWhereIdParamsBody/properties/record",
|
||||
spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecord"),
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecord",
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecord/items/1",
|
||||
spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems1"),
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecord",
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecord/items/2",
|
||||
spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2"),
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecordItems2",
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecordItems2/allOf/0/format",
|
||||
spec.Ref{},
|
||||
"date",
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecordItems2Name",
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecordItems2Name/properties/createdAt/format",
|
||||
spec.Ref{},
|
||||
"date-time",
|
||||
},
|
||||
{
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecordItems2",
|
||||
"#/definitions/getSomeWhereIdParamsBodyRecordItems2/properties/name",
|
||||
spec.MustCreateRef("#/definitions/getSomeWhereIdParamsBodyRecordItems2Name"),
|
||||
"date",
|
||||
},
|
||||
}
|
||||
if assert.NoError(t, err) {
|
||||
err := Flatten(FlattenOpts{Spec: New(sp), BasePath: bp})
|
||||
if assert.NoError(t, err) {
|
||||
for i, v := range values {
|
||||
pk := v.Key[1:]
|
||||
if v.Location != "" {
|
||||
pk = v.Location[1:]
|
||||
}
|
||||
ptr, err := jsonpointer.New(pk)
|
||||
if assert.NoError(t, err, "at %d for %s", i, v.Key) {
|
||||
d, _, err := ptr.Get(sp)
|
||||
if assert.NoError(t, err) {
|
||||
if v.Ref.String() != "" {
|
||||
switch s := d.(type) {
|
||||
case *spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case spec.Schema:
|
||||
assert.Equal(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key)
|
||||
case *spec.SchemaOrArray:
|
||||
var sRef spec.Ref
|
||||
if s != nil && s.Schema != nil {
|
||||
sRef = s.Schema.Ref
|
||||
}
|
||||
assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key)
|
||||
case *spec.SchemaOrBool:
|
||||
var sRef spec.Ref
|
||||
if s != nil && s.Schema != nil {
|
||||
sRef = s.Schema.Ref
|
||||
}
|
||||
assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key)
|
||||
default:
|
||||
assert.Fail(t, "unknown type", "got %T at %d for %s", d, i, v.Key)
|
||||
}
|
||||
} else {
|
||||
assert.Equal(t, v.Expected, d)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
266
vendor/github.com/go-openapi/analysis/schema_test.go
generated
vendored
266
vendor/github.com/go-openapi/analysis/schema_test.go
generated
vendored
@@ -1,266 +0,0 @@
|
||||
package analysis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var knownSchemas = []*spec.Schema{
|
||||
spec.BoolProperty(), // 0
|
||||
spec.StringProperty(), // 1
|
||||
spec.Int8Property(), // 2
|
||||
spec.Int16Property(), // 3
|
||||
spec.Int32Property(), // 4
|
||||
spec.Int64Property(), // 5
|
||||
spec.Float32Property(), // 6
|
||||
spec.Float64Property(), // 7
|
||||
spec.DateProperty(), // 8
|
||||
spec.DateTimeProperty(), // 9
|
||||
(&spec.Schema{}), // 10
|
||||
(&spec.Schema{}).Typed("object", ""), // 11
|
||||
(&spec.Schema{}).Typed("", ""), // 12
|
||||
(&spec.Schema{}).Typed("", "uuid"), // 13
|
||||
}
|
||||
|
||||
func newCObj() *spec.Schema {
|
||||
return (&spec.Schema{}).Typed("object", "").SetProperty("id", *spec.Int64Property())
|
||||
}
|
||||
|
||||
var complexObject = newCObj()
|
||||
|
||||
var complexSchemas = []*spec.Schema{
|
||||
complexObject,
|
||||
spec.ArrayProperty(complexObject),
|
||||
spec.MapProperty(complexObject),
|
||||
}
|
||||
|
||||
func knownRefs(base string) []spec.Ref {
|
||||
urls := []string{"bool", "string", "integer", "float", "date", "object", "format"}
|
||||
|
||||
var result []spec.Ref
|
||||
for _, u := range urls {
|
||||
result = append(result, spec.MustCreateRef(fmt.Sprintf("%s/%s", base, path.Join("known", u))))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func complexRefs(base string) []spec.Ref {
|
||||
urls := []string{"object", "array", "map"}
|
||||
|
||||
var result []spec.Ref
|
||||
for _, u := range urls {
|
||||
result = append(result, spec.MustCreateRef(fmt.Sprintf("%s/%s", base, path.Join("complex", u))))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func refServer() *httptest.Server {
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/known/bool", schemaHandler(knownSchemas[0]))
|
||||
mux.Handle("/known/string", schemaHandler(knownSchemas[1]))
|
||||
mux.Handle("/known/integer", schemaHandler(knownSchemas[5]))
|
||||
mux.Handle("/known/float", schemaHandler(knownSchemas[6]))
|
||||
mux.Handle("/known/date", schemaHandler(knownSchemas[8]))
|
||||
mux.Handle("/known/object", schemaHandler(knownSchemas[11]))
|
||||
mux.Handle("/known/format", schemaHandler(knownSchemas[13]))
|
||||
|
||||
mux.Handle("/complex/object", schemaHandler(complexSchemas[0]))
|
||||
mux.Handle("/complex/array", schemaHandler(complexSchemas[1]))
|
||||
mux.Handle("/complex/map", schemaHandler(complexSchemas[2]))
|
||||
|
||||
return httptest.NewServer(mux)
|
||||
}
|
||||
|
||||
func refSchema(ref spec.Ref) *spec.Schema {
|
||||
return &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}}
|
||||
}
|
||||
|
||||
func schemaHandler(schema *spec.Schema) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, schema)
|
||||
})
|
||||
}
|
||||
|
||||
func writeJSON(w http.ResponseWriter, data interface{}) {
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
enc := json.NewEncoder(w)
|
||||
if err := enc.Encode(data); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_KnownTypes(t *testing.T) {
|
||||
for i, v := range knownSchemas {
|
||||
sch, err := Schema(SchemaOpts{Schema: v})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsKnownType, "item at %d should be a known type", i)
|
||||
}
|
||||
}
|
||||
for i, v := range complexSchemas {
|
||||
sch, err := Schema(SchemaOpts{Schema: v})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.False(t, sch.IsKnownType, "item at %d should not be a known type", i)
|
||||
}
|
||||
}
|
||||
|
||||
serv := refServer()
|
||||
defer serv.Close()
|
||||
|
||||
for i, ref := range knownRefs(serv.URL) {
|
||||
sch, err := Schema(SchemaOpts{Schema: refSchema(ref)})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsKnownType, "item at %d should be a known type", i)
|
||||
}
|
||||
}
|
||||
for i, ref := range complexRefs(serv.URL) {
|
||||
sch, err := Schema(SchemaOpts{Schema: refSchema(ref)})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.False(t, sch.IsKnownType, "item at %d should not be a known type", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_Array(t *testing.T) {
|
||||
for i, v := range append(knownSchemas, (&spec.Schema{}).Typed("array", "")) {
|
||||
sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsArray, "item at %d should be an array type", i)
|
||||
assert.True(t, sch.IsSimpleArray, "item at %d should be a simple array type", i)
|
||||
}
|
||||
}
|
||||
|
||||
for i, v := range complexSchemas {
|
||||
sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsArray, "item at %d should be an array type", i)
|
||||
assert.False(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i)
|
||||
}
|
||||
}
|
||||
|
||||
serv := refServer()
|
||||
defer serv.Close()
|
||||
|
||||
for i, ref := range knownRefs(serv.URL) {
|
||||
sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(refSchema(ref))})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsArray, "item at %d should be an array type", i)
|
||||
assert.True(t, sch.IsSimpleArray, "item at %d should be a simple array type", i)
|
||||
}
|
||||
}
|
||||
for i, ref := range complexRefs(serv.URL) {
|
||||
sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(refSchema(ref))})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.False(t, sch.IsKnownType, "item at %d should not be a known type", i)
|
||||
assert.True(t, sch.IsArray, "item at %d should be an array type", i)
|
||||
assert.False(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_Map(t *testing.T) {
|
||||
for i, v := range append(knownSchemas, spec.MapProperty(nil)) {
|
||||
sch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsMap, "item at %d should be a map type", i)
|
||||
assert.True(t, sch.IsSimpleMap, "item at %d should be a simple map type", i)
|
||||
}
|
||||
}
|
||||
|
||||
for i, v := range complexSchemas {
|
||||
sch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsMap, "item at %d should be a map type", i)
|
||||
assert.False(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_ExtendedObject(t *testing.T) {
|
||||
for i, v := range knownSchemas {
|
||||
wex := spec.MapProperty(v).SetProperty("name", *spec.StringProperty())
|
||||
sch, err := Schema(SchemaOpts{Schema: wex})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsExtendedObject, "item at %d should be an extended map object type", i)
|
||||
assert.False(t, sch.IsMap, "item at %d should not be a map type", i)
|
||||
assert.False(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_Tuple(t *testing.T) {
|
||||
at := spec.ArrayProperty(nil)
|
||||
at.Items = &spec.SchemaOrArray{}
|
||||
at.Items.Schemas = append(at.Items.Schemas, *spec.StringProperty(), *spec.Int64Property())
|
||||
|
||||
sch, err := Schema(SchemaOpts{Schema: at})
|
||||
if assert.NoError(t, err) {
|
||||
assert.True(t, sch.IsTuple)
|
||||
assert.False(t, sch.IsTupleWithExtra)
|
||||
assert.False(t, sch.IsKnownType)
|
||||
assert.False(t, sch.IsSimpleSchema)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_TupleWithExtra(t *testing.T) {
|
||||
at := spec.ArrayProperty(nil)
|
||||
at.Items = &spec.SchemaOrArray{}
|
||||
at.Items.Schemas = append(at.Items.Schemas, *spec.StringProperty(), *spec.Int64Property())
|
||||
at.AdditionalItems = &spec.SchemaOrBool{Allows: true}
|
||||
at.AdditionalItems.Schema = spec.Int32Property()
|
||||
|
||||
sch, err := Schema(SchemaOpts{Schema: at})
|
||||
if assert.NoError(t, err) {
|
||||
assert.False(t, sch.IsTuple)
|
||||
assert.True(t, sch.IsTupleWithExtra)
|
||||
assert.False(t, sch.IsKnownType)
|
||||
assert.False(t, sch.IsSimpleSchema)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_BaseType(t *testing.T) {
|
||||
cl := (&spec.Schema{}).Typed("object", "").SetProperty("type", *spec.StringProperty()).WithDiscriminator("type")
|
||||
|
||||
sch, err := Schema(SchemaOpts{Schema: cl})
|
||||
if assert.NoError(t, err) {
|
||||
assert.True(t, sch.IsBaseType)
|
||||
assert.False(t, sch.IsKnownType)
|
||||
assert.False(t, sch.IsSimpleSchema)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSchemaAnalysis_SimpleSchema(t *testing.T) {
|
||||
for i, v := range append(knownSchemas, spec.ArrayProperty(nil), spec.MapProperty(nil)) {
|
||||
sch, err := Schema(SchemaOpts{Schema: v})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.True(t, sch.IsSimpleSchema, "item at %d should be a simple schema", i)
|
||||
}
|
||||
|
||||
asch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)})
|
||||
if assert.NoError(t, err, "failed to analyze array schema at %d: %v", i, err) {
|
||||
assert.True(t, asch.IsSimpleSchema, "array item at %d should be a simple schema", i)
|
||||
}
|
||||
|
||||
msch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)})
|
||||
if assert.NoError(t, err, "failed to analyze map schema at %d: %v", i, err) {
|
||||
assert.True(t, msch.IsSimpleSchema, "map item at %d should be a simple schema", i)
|
||||
}
|
||||
}
|
||||
|
||||
for i, v := range complexSchemas {
|
||||
sch, err := Schema(SchemaOpts{Schema: v})
|
||||
if assert.NoError(t, err, "failed to analyze schema at %d: %v", i, err) {
|
||||
assert.False(t, sch.IsSimpleSchema, "item at %d should not be a simple schema", i)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
117
vendor/github.com/go-openapi/errors/.github/CONTRIBUTING.md
generated
vendored
117
vendor/github.com/go-openapi/errors/.github/CONTRIBUTING.md
generated
vendored
@@ -1,117 +0,0 @@
|
||||
## Contribution Guidelines
|
||||
|
||||
### Pull requests are always welcome
|
||||
|
||||
We are always thrilled to receive pull requests, and do our best to
|
||||
process them as fast as possible. Not sure if that typo is worth a pull
|
||||
request? Do it! We will appreciate it.
|
||||
|
||||
If your pull request is not accepted on the first try, don't be
|
||||
discouraged! If there's a problem with the implementation, hopefully you
|
||||
received feedback on what to improve.
|
||||
|
||||
We're trying very hard to keep go-swagger lean and focused. We don't want it
|
||||
to do everything for everybody. This means that we might decide against
|
||||
incorporating a new feature. However, there might be a way to implement
|
||||
that feature *on top of* go-swagger.
|
||||
|
||||
|
||||
### Conventions
|
||||
|
||||
Fork the repo and make changes on your fork in a feature branch:
|
||||
|
||||
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
|
||||
issue
|
||||
- If it's a feature branch, create an enhancement issue to announce your
|
||||
intentions, and name it XXX-something where XXX is the number of the issue.
|
||||
|
||||
Submit unit tests for your changes. Go has a great test framework built in; use
|
||||
it! Take a look at existing tests for inspiration. Run the full test suite on
|
||||
your branch before submitting a pull request.
|
||||
|
||||
Update the documentation when creating or modifying features. Test
|
||||
your documentation changes for clarity, concision, and correctness, as
|
||||
well as a clean documentation build. See ``docs/README.md`` for more
|
||||
information on building the docs and how docs get released.
|
||||
|
||||
Write clean code. Universally formatted code promotes ease of writing, reading,
|
||||
and maintenance. Always run `gofmt -s -w file.go` on each changed file before
|
||||
committing your changes. Most editors have plugins that do this automatically.
|
||||
|
||||
Pull requests descriptions should be as clear as possible and include a
|
||||
reference to all the issues that they address.
|
||||
|
||||
Pull requests must not contain commits from other users or branches.
|
||||
|
||||
Commit messages must start with a capitalized and short summary (max. 50
|
||||
chars) written in the imperative, followed by an optional, more detailed
|
||||
explanatory text which is separated from the summary by an empty line.
|
||||
|
||||
Code review comments may be added to your pull request. Discuss, then make the
|
||||
suggested modifications and push additional commits to your feature branch. Be
|
||||
sure to post a comment after pushing. The new commits will show up in the pull
|
||||
request automatically, but the reviewers will not be notified unless you
|
||||
comment.
|
||||
|
||||
Before the pull request is merged, make sure that you squash your commits into
|
||||
logical units of work using `git rebase -i` and `git push -f`. After every
|
||||
commit the test suite should be passing. Include documentation changes in the
|
||||
same commit so that a revert would remove all traces of the feature or fix.
|
||||
|
||||
Commits that fix or close an issue should include a reference like `Closes #XXX`
|
||||
or `Fixes #XXX`, which will automatically close the issue when merged.
|
||||
|
||||
### Sign your work
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to
|
||||
pass it on as an open-source patch. The rules are pretty simple: if you
|
||||
can certify the below (from
|
||||
[developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe@gmail.com>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
You can add the sign off when creating the git commit via `git commit -s`.
|
||||
2
vendor/github.com/go-openapi/errors/.gitignore
generated
vendored
2
vendor/github.com/go-openapi/errors/.gitignore
generated
vendored
@@ -1,2 +0,0 @@
|
||||
secrets.yml
|
||||
coverage.out
|
||||
12
vendor/github.com/go-openapi/errors/.travis.yml
generated
vendored
12
vendor/github.com/go-openapi/errors/.travis.yml
generated
vendored
@@ -1,12 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.7
|
||||
install:
|
||||
- go get -u github.com/stretchr/testify/assert
|
||||
script:
|
||||
- go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
notifications:
|
||||
slack:
|
||||
secure: gZGp9NaHxi7zawlXJXKY92BGeDR1x0tbIcTyU5nMKLq0fhIaiEBJEeALwZ4VgqsSv3DytSSF5mLH8fevAM3ixE6hxjKQ+lQuf7V/w3btCN1CSWgoua5LOh1kTnqZQtJuRvO4pzoJcT3bJWBsVZ07VGNVzzJEy/zAKCHFqBUCXShw7QemlLBcYWFNqveTlvDIfCzvouoLnPoXwxEpkjxe9uz/ZKZgAnup/fXjC8RFctmgCnkCyvJTk0Y/fZCsufixJrJhshBWTnlrFCzRmgNkz2d+i1Ls3+MJ5EJJ2Tx/A5S63dL49J1f9Kr0AKHADmulSy8JNzIckKwbyFMYUecrsW+Lsu9DhnVMy1jj5pKsJDLRi2iIU3fXTMWbcyQbXjbbnBO2mPdP3Tzme75y4D9fc8hUPeyqVv2BU26NEbQ7EF2pKJ93OXvci7HlwRBgdJa8j6mP2LEDClcPQW00g7N/OZe0cTOMa8L5AwiBlbArwqt9wv6YLJoTG0wpDhzWsFvbCg5bJxe28Yn3fIDD0Lk1I7iSnBbp/5gzF19jmxqvcT8tHRkDL4xfjbENFTZjA5uB4Z4pj4WSyWQILLV/Jwhe3fi9uQwdviFHfj5pnVrmNUiGSOQL672K5wl2c3E9mGwejvsu2dfEz28n7Y/FUnOpY3/cBS0n27JJaerS0zMKNLE=
|
||||
74
vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md
generated
vendored
74
vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md
generated
vendored
@@ -1,74 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
5
vendor/github.com/go-openapi/errors/README.md
generated
vendored
5
vendor/github.com/go-openapi/errors/README.md
generated
vendored
@@ -1,5 +0,0 @@
|
||||
# OpenAPI errors [](https://travis-ci.org/go-openapi/errors) [](https://codecov.io/gh/go-openapi/errors) [](https://slackin.goswagger.io)
|
||||
|
||||
[](https://raw.githubusercontent.com/go-openapi/errors/master/LICENSE) [](http://godoc.org/github.com/go-openapi/errors)
|
||||
|
||||
Shared errors used throughout the various libraries for the go-openapi toolkit
|
||||
97
vendor/github.com/go-openapi/errors/api_test.go
generated
vendored
97
vendor/github.com/go-openapi/errors/api_test.go
generated
vendored
@@ -1,97 +0,0 @@
|
||||
// Copyright 2015 go-swagger maintainers
|
||||
//
|
||||
// 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 errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestServeError(t *testing.T) {
|
||||
// method not allowed wins
|
||||
var err error
|
||||
err = MethodNotAllowed("GET", []string{"POST", "PUT"})
|
||||
recorder := httptest.NewRecorder()
|
||||
ServeError(recorder, nil, err)
|
||||
assert.Equal(t, http.StatusMethodNotAllowed, recorder.Code)
|
||||
assert.Equal(t, "POST,PUT", recorder.Header().Get("Allow"))
|
||||
// assert.Equal(t, "application/json", recorder.Header().Get("content-type"))
|
||||
assert.Equal(t, `{"code":405,"message":"method GET is not allowed, but [POST,PUT] are"}`, recorder.Body.String())
|
||||
|
||||
// renders status code from error when present
|
||||
err = NotFound("")
|
||||
recorder = httptest.NewRecorder()
|
||||
ServeError(recorder, nil, err)
|
||||
assert.Equal(t, http.StatusNotFound, recorder.Code)
|
||||
// assert.Equal(t, "application/json", recorder.Header().Get("content-type"))
|
||||
assert.Equal(t, `{"code":404,"message":"Not found"}`, recorder.Body.String())
|
||||
|
||||
// renders mapped status code from error when present
|
||||
err = InvalidTypeName("someType")
|
||||
recorder = httptest.NewRecorder()
|
||||
ServeError(recorder, nil, err)
|
||||
assert.Equal(t, http.StatusUnprocessableEntity, recorder.Code)
|
||||
// assert.Equal(t, "application/json", recorder.Header().Get("content-type"))
|
||||
assert.Equal(t, `{"code":601,"message":"someType is an invalid type name"}`, recorder.Body.String())
|
||||
|
||||
// defaults to internal server error
|
||||
err = fmt.Errorf("some error")
|
||||
recorder = httptest.NewRecorder()
|
||||
ServeError(recorder, nil, err)
|
||||
assert.Equal(t, http.StatusInternalServerError, recorder.Code)
|
||||
// assert.Equal(t, "application/json", recorder.Header().Get("content-type"))
|
||||
assert.Equal(t, `{"code":500,"message":"some error"}`, recorder.Body.String())
|
||||
}
|
||||
|
||||
func TestAPIErrors(t *testing.T) {
|
||||
err := New(402, "this failed %s", "yada")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, 402, err.Code())
|
||||
assert.EqualValues(t, "this failed yada", err.Error())
|
||||
|
||||
err = NotFound("this failed %d", 1)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, http.StatusNotFound, err.Code())
|
||||
assert.EqualValues(t, "this failed 1", err.Error())
|
||||
|
||||
err = NotFound("")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, http.StatusNotFound, err.Code())
|
||||
assert.EqualValues(t, "Not found", err.Error())
|
||||
|
||||
err = NotImplemented("not implemented")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, http.StatusNotImplemented, err.Code())
|
||||
assert.EqualValues(t, "not implemented", err.Error())
|
||||
|
||||
err = MethodNotAllowed("GET", []string{"POST", "PUT"})
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, http.StatusMethodNotAllowed, err.Code())
|
||||
assert.EqualValues(t, "method GET is not allowed, but [POST,PUT] are", err.Error())
|
||||
|
||||
err = InvalidContentType("application/saml", []string{"application/json", "application/x-yaml"})
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, http.StatusUnsupportedMediaType, err.Code())
|
||||
assert.EqualValues(t, "unsupported media type \"application/saml\", only [application/json application/x-yaml] are allowed", err.Error())
|
||||
|
||||
err = InvalidResponseFormat("application/saml", []string{"application/json", "application/x-yaml"})
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, http.StatusNotAcceptable, err.Code())
|
||||
assert.EqualValues(t, "unsupported media type requested, only [application/json application/x-yaml] are available", err.Error())
|
||||
}
|
||||
27
vendor/github.com/go-openapi/errors/auth_test.go
generated
vendored
27
vendor/github.com/go-openapi/errors/auth_test.go
generated
vendored
@@ -1,27 +0,0 @@
|
||||
// Copyright 2015 go-swagger maintainers
|
||||
//
|
||||
// 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 errors
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestUnauthenticated(t *testing.T) {
|
||||
err := Unauthenticated("basic")
|
||||
assert.EqualValues(t, 401, err.Code())
|
||||
assert.Equal(t, "unauthenticated for basic", err.Error())
|
||||
}
|
||||
33
vendor/github.com/go-openapi/errors/middleware_test.go
generated
vendored
33
vendor/github.com/go-openapi/errors/middleware_test.go
generated
vendored
@@ -1,33 +0,0 @@
|
||||
// Copyright 2015 go-swagger maintainers
|
||||
//
|
||||
// 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 errors
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIVerificationFailed(t *testing.T) {
|
||||
err := &APIVerificationFailed{
|
||||
Section: "consumer",
|
||||
MissingSpecification: []string{"application/json", "application/x-yaml"},
|
||||
MissingRegistration: []string{"text/html", "application/xml"},
|
||||
}
|
||||
|
||||
expected := `missing [text/html, application/xml] consumer registrations
|
||||
missing from spec file [application/json, application/x-yaml] consumer`
|
||||
assert.Equal(t, expected, err.Error())
|
||||
}
|
||||
32
vendor/github.com/go-openapi/errors/parsing_test.go
generated
vendored
32
vendor/github.com/go-openapi/errors/parsing_test.go
generated
vendored
@@ -1,32 +0,0 @@
|
||||
// Copyright 2015 go-swagger maintainers
|
||||
//
|
||||
// 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 errors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestParseError(t *testing.T) {
|
||||
err := NewParseError("Content-Type", "header", "application(", errors.New("unable to parse"))
|
||||
assert.EqualValues(t, 400, err.Code())
|
||||
assert.Equal(t, "parsing Content-Type header from \"application(\" failed, because unable to parse", err.Error())
|
||||
|
||||
err = NewParseError("Content-Type", "", "application(", errors.New("unable to parse"))
|
||||
assert.EqualValues(t, 400, err.Code())
|
||||
assert.Equal(t, "parsing Content-Type from \"application(\" failed, because unable to parse", err.Error())
|
||||
}
|
||||
284
vendor/github.com/go-openapi/errors/schema_test.go
generated
vendored
284
vendor/github.com/go-openapi/errors/schema_test.go
generated
vendored
@@ -1,284 +0,0 @@
|
||||
// Copyright 2015 go-swagger maintainers
|
||||
//
|
||||
// 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 errors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSchemaErrors(t *testing.T) {
|
||||
err := InvalidType("confirmed", "query", "boolean", nil)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "confirmed in query must be of type boolean", err.Error())
|
||||
|
||||
err = InvalidType("confirmed", "", "boolean", nil)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "confirmed must be of type boolean", err.Error())
|
||||
|
||||
err = InvalidType("confirmed", "query", "boolean", "hello")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "confirmed in query must be of type boolean: \"hello\"", err.Error())
|
||||
|
||||
err = InvalidType("confirmed", "query", "boolean", errors.New("hello"))
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "confirmed in query must be of type boolean, because: hello", err.Error())
|
||||
|
||||
err = InvalidType("confirmed", "", "boolean", "hello")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "confirmed must be of type boolean: \"hello\"", err.Error())
|
||||
|
||||
err = InvalidType("confirmed", "", "boolean", errors.New("hello"))
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "confirmed must be of type boolean, because: hello", err.Error())
|
||||
|
||||
err = DuplicateItems("uniques", "query")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, UniqueFailCode, err.Code())
|
||||
assert.Equal(t, "uniques in query shouldn't contain duplicates", err.Error())
|
||||
|
||||
err = DuplicateItems("uniques", "")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, UniqueFailCode, err.Code())
|
||||
assert.Equal(t, "uniques shouldn't contain duplicates", err.Error())
|
||||
|
||||
err = TooManyItems("something", "query", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxItemsFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should have at most 5 items", err.Error())
|
||||
|
||||
err = TooManyItems("something", "", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxItemsFailCode, err.Code())
|
||||
assert.Equal(t, "something should have at most 5 items", err.Error())
|
||||
|
||||
err = TooFewItems("something", "", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinItemsFailCode, err.Code())
|
||||
assert.Equal(t, "something should have at least 5 items", err.Error())
|
||||
|
||||
err = ExceedsMaximumInt("something", "query", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be less than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumInt("something", "", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something should be less than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumInt("something", "query", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be less than 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumInt("something", "", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something should be less than 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumUint("something", "query", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be less than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumUint("something", "", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something should be less than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumUint("something", "query", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be less than 5", err.Error())
|
||||
|
||||
err = ExceedsMaximumUint("something", "", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something should be less than 5", err.Error())
|
||||
|
||||
err = ExceedsMaximum("something", "query", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be less than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMaximum("something", "", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something should be less than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMaximum("something", "query", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be less than 5", err.Error())
|
||||
|
||||
err = ExceedsMaximum("something", "", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MaxFailCode, err.Code())
|
||||
assert.Equal(t, "something should be less than 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumInt("something", "query", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be greater than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumInt("something", "", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something should be greater than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumInt("something", "query", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be greater than 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumInt("something", "", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something should be greater than 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumUint("something", "query", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be greater than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumUint("something", "", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something should be greater than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumUint("something", "query", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be greater than 5", err.Error())
|
||||
|
||||
err = ExceedsMinimumUint("something", "", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something should be greater than 5", err.Error())
|
||||
|
||||
err = ExceedsMinimum("something", "query", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be greater than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMinimum("something", "", 5, false)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something should be greater than or equal to 5", err.Error())
|
||||
|
||||
err = ExceedsMinimum("something", "query", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be greater than 5", err.Error())
|
||||
|
||||
err = ExceedsMinimum("something", "", 5, true)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MinFailCode, err.Code())
|
||||
assert.Equal(t, "something should be greater than 5", err.Error())
|
||||
|
||||
err = NotMultipleOf("something", "query", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MultipleOfFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be a multiple of 5", err.Error())
|
||||
|
||||
err = NotMultipleOf("something", "", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, MultipleOfFailCode, err.Code())
|
||||
assert.Equal(t, "something should be a multiple of 5", err.Error())
|
||||
|
||||
err = EnumFail("something", "query", "yada", []interface{}{"hello", "world"})
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, EnumFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be one of [hello world]", err.Error())
|
||||
|
||||
err = EnumFail("something", "", "yada", []interface{}{"hello", "world"})
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, EnumFailCode, err.Code())
|
||||
assert.Equal(t, "something should be one of [hello world]", err.Error())
|
||||
|
||||
err = Required("something", "query")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, RequiredFailCode, err.Code())
|
||||
assert.Equal(t, "something in query is required", err.Error())
|
||||
|
||||
err = Required("something", "")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, RequiredFailCode, err.Code())
|
||||
assert.Equal(t, "something is required", err.Error())
|
||||
|
||||
err = TooLong("something", "query", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, TooLongFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be at most 5 chars long", err.Error())
|
||||
|
||||
err = TooLong("something", "", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, TooLongFailCode, err.Code())
|
||||
assert.Equal(t, "something should be at most 5 chars long", err.Error())
|
||||
|
||||
err = TooShort("something", "query", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, TooShortFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should be at least 5 chars long", err.Error())
|
||||
|
||||
err = TooShort("something", "", 5)
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, TooShortFailCode, err.Code())
|
||||
assert.Equal(t, "something should be at least 5 chars long", err.Error())
|
||||
|
||||
err = FailedPattern("something", "query", "\\d+")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, PatternFailCode, err.Code())
|
||||
assert.Equal(t, "something in query should match '\\d+'", err.Error())
|
||||
|
||||
err = FailedPattern("something", "", "\\d+")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, PatternFailCode, err.Code())
|
||||
assert.Equal(t, "something should match '\\d+'", err.Error())
|
||||
|
||||
err = InvalidTypeName("something")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "something is an invalid type name", err.Error())
|
||||
|
||||
err = AdditionalItemsNotAllowed("something", "query")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, NoAdditionalItemsCode, err.Code())
|
||||
assert.Equal(t, "something in query can't have additional items", err.Error())
|
||||
|
||||
err = AdditionalItemsNotAllowed("something", "")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, NoAdditionalItemsCode, err.Code())
|
||||
assert.Equal(t, "something can't have additional items", err.Error())
|
||||
|
||||
err = InvalidCollectionFormat("something", "query", "yada")
|
||||
assert.Error(t, err)
|
||||
assert.EqualValues(t, InvalidTypeCode, err.Code())
|
||||
assert.Equal(t, "the collection format \"yada\" is not supported for the query param \"something\"", err.Error())
|
||||
|
||||
err2 := CompositeValidationError()
|
||||
assert.Error(t, err2)
|
||||
assert.EqualValues(t, CompositeErrorCode, err2.Code())
|
||||
assert.Equal(t, "validation failure list", err2.Error())
|
||||
}
|
||||
26
vendor/github.com/go-openapi/jsonpointer/.editorconfig
generated
vendored
26
vendor/github.com/go-openapi/jsonpointer/.editorconfig
generated
vendored
@@ -1,26 +0,0 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Set default charset
|
||||
[*.{js,py,go,scala,rb,java,html,css,less,sass,md}]
|
||||
charset = utf-8
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
[*.go]
|
||||
indent_style = tab
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[{package.json,.travis.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
117
vendor/github.com/go-openapi/jsonpointer/.github/CONTRIBUTING.md
generated
vendored
117
vendor/github.com/go-openapi/jsonpointer/.github/CONTRIBUTING.md
generated
vendored
@@ -1,117 +0,0 @@
|
||||
## Contribution Guidelines
|
||||
|
||||
### Pull requests are always welcome
|
||||
|
||||
We are always thrilled to receive pull requests, and do our best to
|
||||
process them as fast as possible. Not sure if that typo is worth a pull
|
||||
request? Do it! We will appreciate it.
|
||||
|
||||
If your pull request is not accepted on the first try, don't be
|
||||
discouraged! If there's a problem with the implementation, hopefully you
|
||||
received feedback on what to improve.
|
||||
|
||||
We're trying very hard to keep go-swagger lean and focused. We don't want it
|
||||
to do everything for everybody. This means that we might decide against
|
||||
incorporating a new feature. However, there might be a way to implement
|
||||
that feature *on top of* go-swagger.
|
||||
|
||||
|
||||
### Conventions
|
||||
|
||||
Fork the repo and make changes on your fork in a feature branch:
|
||||
|
||||
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
|
||||
issue
|
||||
- If it's a feature branch, create an enhancement issue to announce your
|
||||
intentions, and name it XXX-something where XXX is the number of the issue.
|
||||
|
||||
Submit unit tests for your changes. Go has a great test framework built in; use
|
||||
it! Take a look at existing tests for inspiration. Run the full test suite on
|
||||
your branch before submitting a pull request.
|
||||
|
||||
Update the documentation when creating or modifying features. Test
|
||||
your documentation changes for clarity, concision, and correctness, as
|
||||
well as a clean documentation build. See ``docs/README.md`` for more
|
||||
information on building the docs and how docs get released.
|
||||
|
||||
Write clean code. Universally formatted code promotes ease of writing, reading,
|
||||
and maintenance. Always run `gofmt -s -w file.go` on each changed file before
|
||||
committing your changes. Most editors have plugins that do this automatically.
|
||||
|
||||
Pull requests descriptions should be as clear as possible and include a
|
||||
reference to all the issues that they address.
|
||||
|
||||
Pull requests must not contain commits from other users or branches.
|
||||
|
||||
Commit messages must start with a capitalized and short summary (max. 50
|
||||
chars) written in the imperative, followed by an optional, more detailed
|
||||
explanatory text which is separated from the summary by an empty line.
|
||||
|
||||
Code review comments may be added to your pull request. Discuss, then make the
|
||||
suggested modifications and push additional commits to your feature branch. Be
|
||||
sure to post a comment after pushing. The new commits will show up in the pull
|
||||
request automatically, but the reviewers will not be notified unless you
|
||||
comment.
|
||||
|
||||
Before the pull request is merged, make sure that you squash your commits into
|
||||
logical units of work using `git rebase -i` and `git push -f`. After every
|
||||
commit the test suite should be passing. Include documentation changes in the
|
||||
same commit so that a revert would remove all traces of the feature or fix.
|
||||
|
||||
Commits that fix or close an issue should include a reference like `Closes #XXX`
|
||||
or `Fixes #XXX`, which will automatically close the issue when merged.
|
||||
|
||||
### Sign your work
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to
|
||||
pass it on as an open-source patch. The rules are pretty simple: if you
|
||||
can certify the below (from
|
||||
[developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe@gmail.com>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
You can add the sign off when creating the git commit via `git commit -s`.
|
||||
1
vendor/github.com/go-openapi/jsonpointer/.gitignore
generated
vendored
1
vendor/github.com/go-openapi/jsonpointer/.gitignore
generated
vendored
@@ -1 +0,0 @@
|
||||
secrets.yml
|
||||
13
vendor/github.com/go-openapi/jsonpointer/.travis.yml
generated
vendored
13
vendor/github.com/go-openapi/jsonpointer/.travis.yml
generated
vendored
@@ -1,13 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.7
|
||||
install:
|
||||
- go get -u github.com/stretchr/testify/assert
|
||||
- go get -u github.com/go-openapi/swag
|
||||
script:
|
||||
- go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
notifications:
|
||||
slack:
|
||||
secure: a5VgoiwB1G/AZqzmephPZIhEB9avMlsWSlVnM1dSAtYAwdrQHGTQxAmpOxYIoSPDhWNN5bfZmjd29++UlTwLcHSR+e0kJhH6IfDlsHj/HplNCJ9tyI0zYc7XchtdKgeMxMzBKCzgwFXGSbQGydXTliDNBo0HOzmY3cou/daMFTP60K+offcjS+3LRAYb1EroSRXZqrk1nuF/xDL3792DZUdPMiFR/L/Df6y74D6/QP4sTkTDFQitz4Wy/7jbsfj8dG6qK2zivgV6/l+w4OVjFkxVpPXogDWY10vVXNVynqxfJ7to2d1I9lNCHE2ilBCkWMIPdyJF7hjF8pKW+82yP4EzRh0vu8Xn0HT5MZpQxdRY/YMxNrWaG7SxsoEaO4q5uhgdzAqLYY3TRa7MjIK+7Ur+aqOeTXn6OKwVi0CjvZ6mIU3WUKSwiwkFZMbjRAkSb5CYwMEfGFO/z964xz83qGt6WAtBXNotqCQpTIiKtDHQeLOMfksHImCg6JLhQcWBVxamVgu0G3Pdh8Y6DyPnxraXY95+QDavbjqv7TeYT9T/FNnrkXaTTK0s4iWE5H4ACU0Qvz0wUYgfQrZv0/Hp7V17+rabUwnzYySHCy9SWX/7OV9Cfh31iMp9ZIffr76xmmThtOEqs8TrTtU6BWI3rWwvA9cXQipZTVtL0oswrGw=
|
||||
74
vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
generated
vendored
74
vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
generated
vendored
@@ -1,74 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
15
vendor/github.com/go-openapi/jsonpointer/README.md
generated
vendored
15
vendor/github.com/go-openapi/jsonpointer/README.md
generated
vendored
@@ -1,15 +0,0 @@
|
||||
# gojsonpointer [](https://travis-ci.org/go-openapi/jsonpointer) [](https://codecov.io/gh/go-openapi/jsonpointer) [](https://slackin.goswagger.io)
|
||||
|
||||
[](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [](http://godoc.org/github.com/go-openapi/jsonpointer)
|
||||
An implementation of JSON Pointer - Go language
|
||||
|
||||
## Status
|
||||
Completed YES
|
||||
|
||||
Tested YES
|
||||
|
||||
## References
|
||||
http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
|
||||
|
||||
### Note
|
||||
The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented.
|
||||
573
vendor/github.com/go-openapi/jsonpointer/pointer_test.go
generated
vendored
573
vendor/github.com/go-openapi/jsonpointer/pointer_test.go
generated
vendored
@@ -1,573 +0,0 @@
|
||||
// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
|
||||
//
|
||||
// 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.
|
||||
|
||||
// author sigu-399
|
||||
// author-github https://github.com/sigu-399
|
||||
// author-mail sigu.399@gmail.com
|
||||
//
|
||||
// repository-name jsonpointer
|
||||
// repository-desc An implementation of JSON Pointer - Go language
|
||||
//
|
||||
// description Automated tests on package.
|
||||
//
|
||||
// created 03-03-2013
|
||||
|
||||
package jsonpointer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const (
|
||||
TestDocumentNBItems = 11
|
||||
TestNodeObjNBItems = 4
|
||||
TestDocumentString = `{
|
||||
"foo": ["bar", "baz"],
|
||||
"obj": { "a":1, "b":2, "c":[3,4], "d":[ {"e":9}, {"f":[50,51]} ] },
|
||||
"": 0,
|
||||
"a/b": 1,
|
||||
"c%d": 2,
|
||||
"e^f": 3,
|
||||
"g|h": 4,
|
||||
"i\\j": 5,
|
||||
"k\"l": 6,
|
||||
" ": 7,
|
||||
"m~n": 8
|
||||
}`
|
||||
)
|
||||
|
||||
var testDocumentJSON interface{}
|
||||
|
||||
type testStructJSON struct {
|
||||
Foo []string `json:"foo"`
|
||||
Obj struct {
|
||||
A int `json:"a"`
|
||||
B int `json:"b"`
|
||||
C []int `json:"c"`
|
||||
D []struct {
|
||||
E int `json:"e"`
|
||||
F []int `json:"f"`
|
||||
} `json:"d"`
|
||||
} `json:"obj"`
|
||||
}
|
||||
|
||||
type aliasedMap map[string]interface{}
|
||||
|
||||
var testStructJSONDoc testStructJSON
|
||||
var testStructJSONPtr *testStructJSON
|
||||
|
||||
func init() {
|
||||
json.Unmarshal([]byte(TestDocumentString), &testDocumentJSON)
|
||||
json.Unmarshal([]byte(TestDocumentString), &testStructJSONDoc)
|
||||
testStructJSONPtr = &testStructJSONDoc
|
||||
}
|
||||
|
||||
func TestEscaping(t *testing.T) {
|
||||
|
||||
ins := []string{`/`, `/`, `/a~1b`, `/a~1b`, `/c%d`, `/e^f`, `/g|h`, `/i\j`, `/k"l`, `/ `, `/m~0n`}
|
||||
outs := []float64{0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8}
|
||||
|
||||
for i := range ins {
|
||||
p, err := New(ins[i])
|
||||
if assert.NoError(t, err, "input: %v", ins[i]) {
|
||||
result, _, err := p.Get(testDocumentJSON)
|
||||
if assert.NoError(t, err, "input: %v", ins[i]) {
|
||||
assert.Equal(t, outs[i], result, "input: %v", ins[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFullDocument(t *testing.T) {
|
||||
|
||||
in := ``
|
||||
|
||||
p, err := New(in)
|
||||
if err != nil {
|
||||
t.Errorf("New(%v) error %v", in, err.Error())
|
||||
}
|
||||
|
||||
result, _, err := p.Get(testDocumentJSON)
|
||||
if err != nil {
|
||||
t.Errorf("Get(%v) error %v", in, err.Error())
|
||||
}
|
||||
|
||||
if len(result.(map[string]interface{})) != TestDocumentNBItems {
|
||||
t.Errorf("Get(%v) = %v, expect full document", in, result)
|
||||
}
|
||||
|
||||
result, _, err = p.get(testDocumentJSON, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Get(%v) error %v", in, err.Error())
|
||||
}
|
||||
|
||||
if len(result.(map[string]interface{})) != TestDocumentNBItems {
|
||||
t.Errorf("Get(%v) = %v, expect full document", in, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodedTokens(t *testing.T) {
|
||||
p, err := New("/obj/a~1b")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []string{"obj", "a/b"}, p.DecodedTokens())
|
||||
}
|
||||
|
||||
func TestIsEmpty(t *testing.T) {
|
||||
p, err := New("")
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, p.IsEmpty())
|
||||
p, err = New("/obj")
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, p.IsEmpty())
|
||||
}
|
||||
|
||||
func TestGetSingle(t *testing.T) {
|
||||
in := `/obj`
|
||||
|
||||
_, err := New(in)
|
||||
assert.NoError(t, err)
|
||||
result, _, err := GetForToken(testDocumentJSON, "obj")
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, result, TestNodeObjNBItems)
|
||||
|
||||
result, _, err = GetForToken(testStructJSONDoc, "Obj")
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, result)
|
||||
|
||||
result, _, err = GetForToken(testStructJSONDoc, "Obj2")
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, result)
|
||||
}
|
||||
|
||||
type pointableImpl struct {
|
||||
a string
|
||||
}
|
||||
|
||||
func (p pointableImpl) JSONLookup(token string) (interface{}, error) {
|
||||
if token == "some" {
|
||||
return p.a, nil
|
||||
}
|
||||
return nil, fmt.Errorf("object has no field %q", token)
|
||||
}
|
||||
|
||||
func TestPointableInterface(t *testing.T) {
|
||||
p := &pointableImpl{"hello"}
|
||||
|
||||
result, _, err := GetForToken(p, "some")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, p.a, result)
|
||||
|
||||
result, _, err = GetForToken(p, "something")
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, result)
|
||||
}
|
||||
|
||||
func TestGetNode(t *testing.T) {
|
||||
|
||||
in := `/obj`
|
||||
|
||||
p, err := New(in)
|
||||
assert.NoError(t, err)
|
||||
result, _, err := p.Get(testDocumentJSON)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, result, TestNodeObjNBItems)
|
||||
|
||||
result, _, err = p.Get(aliasedMap(testDocumentJSON.(map[string]interface{})))
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, result, TestNodeObjNBItems)
|
||||
|
||||
result, _, err = p.Get(testStructJSONDoc)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, testStructJSONDoc.Obj, result)
|
||||
|
||||
result, _, err = p.Get(testStructJSONPtr)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, testStructJSONDoc.Obj, result)
|
||||
}
|
||||
|
||||
func TestArray(t *testing.T) {
|
||||
|
||||
ins := []string{`/foo/0`, `/foo/0`, `/foo/1`}
|
||||
outs := []string{"bar", "bar", "baz"}
|
||||
|
||||
for i := range ins {
|
||||
p, err := New(ins[i])
|
||||
assert.NoError(t, err)
|
||||
|
||||
result, _, err := p.Get(testStructJSONDoc)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, outs[i], result)
|
||||
|
||||
result, _, err = p.Get(testStructJSONPtr)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, outs[i], result)
|
||||
|
||||
result, _, err = p.Get(testDocumentJSON)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, outs[i], result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOtherThings(t *testing.T) {
|
||||
_, err := New("abc")
|
||||
assert.Error(t, err)
|
||||
|
||||
p, err := New("")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "", p.String())
|
||||
|
||||
p, err = New("/obj/a")
|
||||
assert.Equal(t, "/obj/a", p.String())
|
||||
|
||||
s := Escape("m~n")
|
||||
assert.Equal(t, "m~0n", s)
|
||||
s = Escape("m/n")
|
||||
assert.Equal(t, "m~1n", s)
|
||||
|
||||
p, err = New("/foo/3")
|
||||
assert.NoError(t, err)
|
||||
_, _, err = p.Get(testDocumentJSON)
|
||||
assert.Error(t, err)
|
||||
|
||||
p, err = New("/foo/a")
|
||||
assert.NoError(t, err)
|
||||
_, _, err = p.Get(testDocumentJSON)
|
||||
assert.Error(t, err)
|
||||
|
||||
p, err = New("/notthere")
|
||||
assert.NoError(t, err)
|
||||
_, _, err = p.Get(testDocumentJSON)
|
||||
assert.Error(t, err)
|
||||
|
||||
p, err = New("/invalid")
|
||||
assert.NoError(t, err)
|
||||
_, _, err = p.Get(1234)
|
||||
assert.Error(t, err)
|
||||
|
||||
p, err = New("/foo/1")
|
||||
assert.NoError(t, err)
|
||||
expected := "hello"
|
||||
bbb := testDocumentJSON.(map[string]interface{})["foo"]
|
||||
bbb.([]interface{})[1] = "hello"
|
||||
|
||||
v, _, err := p.Get(testDocumentJSON)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, v)
|
||||
|
||||
esc := Escape("a/")
|
||||
assert.Equal(t, "a~1", esc)
|
||||
unesc := Unescape(esc)
|
||||
assert.Equal(t, "a/", unesc)
|
||||
|
||||
unesc = Unescape("~01")
|
||||
assert.Equal(t, "~1", unesc)
|
||||
assert.Equal(t, "~0~1", Escape("~/"))
|
||||
assert.Equal(t, "~/", Unescape("~0~1"))
|
||||
}
|
||||
|
||||
func TestObject(t *testing.T) {
|
||||
|
||||
ins := []string{`/obj/a`, `/obj/b`, `/obj/c/0`, `/obj/c/1`, `/obj/c/1`, `/obj/d/1/f/0`}
|
||||
outs := []float64{1, 2, 3, 4, 4, 50}
|
||||
|
||||
for i := range ins {
|
||||
|
||||
p, err := New(ins[i])
|
||||
assert.NoError(t, err)
|
||||
|
||||
result, _, err := p.Get(testDocumentJSON)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, outs[i], result)
|
||||
|
||||
result, _, err = p.Get(testStructJSONDoc)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, outs[i], result)
|
||||
|
||||
result, _, err = p.Get(testStructJSONPtr)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, outs[i], result)
|
||||
}
|
||||
}
|
||||
|
||||
type setJsonDocEle struct {
|
||||
B int `json:"b"`
|
||||
C int `json:"c"`
|
||||
}
|
||||
type setJsonDoc struct {
|
||||
A []struct {
|
||||
B int `json:"b"`
|
||||
C int `json:"c"`
|
||||
} `json:"a"`
|
||||
D int `json:"d"`
|
||||
}
|
||||
|
||||
type settableDoc struct {
|
||||
Coll settableColl
|
||||
Int settableInt
|
||||
}
|
||||
|
||||
func (s settableDoc) MarshalJSON() ([]byte, error) {
|
||||
var res struct {
|
||||
A settableColl `json:"a"`
|
||||
D settableInt `json:"d"`
|
||||
}
|
||||
res.A = s.Coll
|
||||
res.D = s.Int
|
||||
return json.Marshal(res)
|
||||
}
|
||||
func (s *settableDoc) UnmarshalJSON(data []byte) error {
|
||||
var res struct {
|
||||
A settableColl `json:"a"`
|
||||
D settableInt `json:"d"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
s.Coll = res.A
|
||||
s.Int = res.D
|
||||
return nil
|
||||
}
|
||||
|
||||
// JSONLookup implements an interface to customize json pointer lookup
|
||||
func (s settableDoc) JSONLookup(token string) (interface{}, error) {
|
||||
switch token {
|
||||
case "a":
|
||||
return &s.Coll, nil
|
||||
case "d":
|
||||
return &s.Int, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("%s is not a known field", token)
|
||||
}
|
||||
}
|
||||
|
||||
// JSONLookup implements an interface to customize json pointer lookup
|
||||
func (s *settableDoc) JSONSet(token string, data interface{}) error {
|
||||
switch token {
|
||||
case "a":
|
||||
switch dt := data.(type) {
|
||||
case settableColl:
|
||||
s.Coll = dt
|
||||
return nil
|
||||
case *settableColl:
|
||||
if dt != nil {
|
||||
s.Coll = *dt
|
||||
} else {
|
||||
s.Coll = settableColl{}
|
||||
}
|
||||
return nil
|
||||
case []settableCollItem:
|
||||
s.Coll.Items = dt
|
||||
return nil
|
||||
}
|
||||
case "d":
|
||||
switch dt := data.(type) {
|
||||
case settableInt:
|
||||
s.Int = dt
|
||||
return nil
|
||||
case int:
|
||||
s.Int.Value = dt
|
||||
return nil
|
||||
case int8:
|
||||
s.Int.Value = int(dt)
|
||||
return nil
|
||||
case int16:
|
||||
s.Int.Value = int(dt)
|
||||
return nil
|
||||
case int32:
|
||||
s.Int.Value = int(dt)
|
||||
return nil
|
||||
case int64:
|
||||
s.Int.Value = int(dt)
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("invalid type %T for %s", data, token)
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%s is not a known field", token)
|
||||
}
|
||||
|
||||
type settableColl struct {
|
||||
Items []settableCollItem
|
||||
}
|
||||
|
||||
func (s settableColl) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(s.Items)
|
||||
}
|
||||
func (s *settableColl) UnmarshalJSON(data []byte) error {
|
||||
return json.Unmarshal(data, &s.Items)
|
||||
}
|
||||
|
||||
// JSONLookup implements an interface to customize json pointer lookup
|
||||
func (s settableColl) JSONLookup(token string) (interface{}, error) {
|
||||
if tok, err := strconv.Atoi(token); err == nil {
|
||||
return &s.Items[tok], nil
|
||||
}
|
||||
return nil, fmt.Errorf("%s is not a valid index", token)
|
||||
}
|
||||
|
||||
// JSONLookup implements an interface to customize json pointer lookup
|
||||
func (s *settableColl) JSONSet(token string, data interface{}) error {
|
||||
if _, err := strconv.Atoi(token); err == nil {
|
||||
_, err := SetForToken(s.Items, token, data)
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("%s is not a valid index", token)
|
||||
}
|
||||
|
||||
type settableCollItem struct {
|
||||
B int `json:"b"`
|
||||
C int `json:"c"`
|
||||
}
|
||||
|
||||
type settableInt struct {
|
||||
Value int
|
||||
}
|
||||
|
||||
func (s settableInt) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(s.Value)
|
||||
}
|
||||
func (s *settableInt) UnmarshalJSON(data []byte) error {
|
||||
return json.Unmarshal(data, &s.Value)
|
||||
}
|
||||
|
||||
func TestSetNode(t *testing.T) {
|
||||
|
||||
jsonText := `{"a":[{"b": 1, "c": 2}], "d": 3}`
|
||||
|
||||
var jsonDocument interface{}
|
||||
if assert.NoError(t, json.Unmarshal([]byte(jsonText), &jsonDocument)) {
|
||||
in := "/a/0/c"
|
||||
p, err := New(in)
|
||||
if assert.NoError(t, err) {
|
||||
|
||||
_, err = p.Set(jsonDocument, 999)
|
||||
assert.NoError(t, err)
|
||||
|
||||
firstNode := jsonDocument.(map[string]interface{})
|
||||
assert.Len(t, firstNode, 2)
|
||||
|
||||
sliceNode := firstNode["a"].([]interface{})
|
||||
assert.Len(t, sliceNode, 1)
|
||||
|
||||
changedNode := sliceNode[0].(map[string]interface{})
|
||||
chNodeVI := changedNode["c"]
|
||||
if assert.IsType(t, 0, chNodeVI) {
|
||||
changedNodeValue := chNodeVI.(int)
|
||||
if assert.Equal(t, 999, changedNodeValue) {
|
||||
assert.Len(t, sliceNode, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
v, err := New("/a/0")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = v.Set(jsonDocument, map[string]interface{}{"b": 3, "c": 8})
|
||||
if assert.NoError(t, err) {
|
||||
firstNode := jsonDocument.(map[string]interface{})
|
||||
assert.Len(t, firstNode, 2)
|
||||
|
||||
sliceNode := firstNode["a"].([]interface{})
|
||||
assert.Len(t, sliceNode, 1)
|
||||
changedNode := sliceNode[0].(map[string]interface{})
|
||||
assert.Equal(t, 3, changedNode["b"])
|
||||
assert.Equal(t, 8, changedNode["c"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var structDoc setJsonDoc
|
||||
if assert.NoError(t, json.Unmarshal([]byte(jsonText), &structDoc)) {
|
||||
g, err := New("/a")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = g.Set(&structDoc, []struct {
|
||||
B int `json:"b"`
|
||||
C int `json:"c"`
|
||||
}{{B: 4, C: 7}})
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
assert.Len(t, structDoc.A, 1)
|
||||
changedNode := structDoc.A[0]
|
||||
assert.Equal(t, 4, changedNode.B)
|
||||
assert.Equal(t, 7, changedNode.C)
|
||||
}
|
||||
}
|
||||
|
||||
v, err := New("/a/0")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = v.Set(structDoc, struct {
|
||||
B int `json:"b"`
|
||||
C int `json:"c"`
|
||||
}{B: 3, C: 8})
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
assert.Len(t, structDoc.A, 1)
|
||||
changedNode := structDoc.A[0]
|
||||
assert.Equal(t, 3, changedNode.B)
|
||||
assert.Equal(t, 8, changedNode.C)
|
||||
}
|
||||
}
|
||||
|
||||
p, err := New("/a/0/c")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = p.Set(&structDoc, 999)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, structDoc.A, 1) {
|
||||
assert.Equal(t, 999, structDoc.A[0].C)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var setDoc settableDoc
|
||||
if assert.NoError(t, json.Unmarshal([]byte(jsonText), &setDoc)) {
|
||||
g, err := New("/a")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = g.Set(&setDoc, []settableCollItem{{B: 4, C: 7}})
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
assert.Len(t, setDoc.Coll.Items, 1)
|
||||
changedNode := setDoc.Coll.Items[0]
|
||||
assert.Equal(t, 4, changedNode.B)
|
||||
assert.Equal(t, 7, changedNode.C)
|
||||
}
|
||||
}
|
||||
|
||||
v, err := New("/a/0")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = v.Set(setDoc, settableCollItem{B: 3, C: 8})
|
||||
|
||||
if assert.NoError(t, err) {
|
||||
assert.Len(t, setDoc.Coll.Items, 1)
|
||||
changedNode := setDoc.Coll.Items[0]
|
||||
assert.Equal(t, 3, changedNode.B)
|
||||
assert.Equal(t, 8, changedNode.C)
|
||||
}
|
||||
}
|
||||
|
||||
p, err := New("/a/0/c")
|
||||
if assert.NoError(t, err) {
|
||||
_, err = p.Set(setDoc, 999)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, setDoc.Coll.Items, 1) {
|
||||
assert.Equal(t, 999, setDoc.Coll.Items[0].C)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
vendor/github.com/go-openapi/jsonreference/.github/CONTRIBUTING.md
generated
vendored
117
vendor/github.com/go-openapi/jsonreference/.github/CONTRIBUTING.md
generated
vendored
@@ -1,117 +0,0 @@
|
||||
## Contribution Guidelines
|
||||
|
||||
### Pull requests are always welcome
|
||||
|
||||
We are always thrilled to receive pull requests, and do our best to
|
||||
process them as fast as possible. Not sure if that typo is worth a pull
|
||||
request? Do it! We will appreciate it.
|
||||
|
||||
If your pull request is not accepted on the first try, don't be
|
||||
discouraged! If there's a problem with the implementation, hopefully you
|
||||
received feedback on what to improve.
|
||||
|
||||
We're trying very hard to keep go-swagger lean and focused. We don't want it
|
||||
to do everything for everybody. This means that we might decide against
|
||||
incorporating a new feature. However, there might be a way to implement
|
||||
that feature *on top of* go-swagger.
|
||||
|
||||
|
||||
### Conventions
|
||||
|
||||
Fork the repo and make changes on your fork in a feature branch:
|
||||
|
||||
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
|
||||
issue
|
||||
- If it's a feature branch, create an enhancement issue to announce your
|
||||
intentions, and name it XXX-something where XXX is the number of the issue.
|
||||
|
||||
Submit unit tests for your changes. Go has a great test framework built in; use
|
||||
it! Take a look at existing tests for inspiration. Run the full test suite on
|
||||
your branch before submitting a pull request.
|
||||
|
||||
Update the documentation when creating or modifying features. Test
|
||||
your documentation changes for clarity, concision, and correctness, as
|
||||
well as a clean documentation build. See ``docs/README.md`` for more
|
||||
information on building the docs and how docs get released.
|
||||
|
||||
Write clean code. Universally formatted code promotes ease of writing, reading,
|
||||
and maintenance. Always run `gofmt -s -w file.go` on each changed file before
|
||||
committing your changes. Most editors have plugins that do this automatically.
|
||||
|
||||
Pull requests descriptions should be as clear as possible and include a
|
||||
reference to all the issues that they address.
|
||||
|
||||
Pull requests must not contain commits from other users or branches.
|
||||
|
||||
Commit messages must start with a capitalized and short summary (max. 50
|
||||
chars) written in the imperative, followed by an optional, more detailed
|
||||
explanatory text which is separated from the summary by an empty line.
|
||||
|
||||
Code review comments may be added to your pull request. Discuss, then make the
|
||||
suggested modifications and push additional commits to your feature branch. Be
|
||||
sure to post a comment after pushing. The new commits will show up in the pull
|
||||
request automatically, but the reviewers will not be notified unless you
|
||||
comment.
|
||||
|
||||
Before the pull request is merged, make sure that you squash your commits into
|
||||
logical units of work using `git rebase -i` and `git push -f`. After every
|
||||
commit the test suite should be passing. Include documentation changes in the
|
||||
same commit so that a revert would remove all traces of the feature or fix.
|
||||
|
||||
Commits that fix or close an issue should include a reference like `Closes #XXX`
|
||||
or `Fixes #XXX`, which will automatically close the issue when merged.
|
||||
|
||||
### Sign your work
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to
|
||||
pass it on as an open-source patch. The rules are pretty simple: if you
|
||||
can certify the below (from
|
||||
[developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe@gmail.com>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
You can add the sign off when creating the git commit via `git commit -s`.
|
||||
1
vendor/github.com/go-openapi/jsonreference/.gitignore
generated
vendored
1
vendor/github.com/go-openapi/jsonreference/.gitignore
generated
vendored
@@ -1 +0,0 @@
|
||||
secrets.yml
|
||||
14
vendor/github.com/go-openapi/jsonreference/.travis.yml
generated
vendored
14
vendor/github.com/go-openapi/jsonreference/.travis.yml
generated
vendored
@@ -1,14 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.7
|
||||
install:
|
||||
- go get -u github.com/stretchr/testify/assert
|
||||
- go get -u github.com/PuerkitoBio/purell
|
||||
- go get -u github.com/go-openapi/jsonpointer
|
||||
script:
|
||||
- go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
notifications:
|
||||
slack:
|
||||
secure: OpQG/36F7DSF00HLm9WZMhyqFCYYyYTsVDObW226cWiR8PWYiNfLZiSEvIzT1Gx4dDjhigKTIqcLhG34CkL5iNXDjm9Yyo2RYhQPlK8NErNqUEXuBqn4RqYHW48VGhEhOyDd4Ei0E2FN5ZbgpvHgtpkdZ6XDi64r3Ac89isP9aPHXQTuv2Jog6b4/OKKiUTftLcTIst0p4Cp3gqOJWf1wnoj+IadWiECNVQT6zb47IYjtyw6+uV8iUjTzdKcRB6Zc6b4Dq7JAg1Zd7Jfxkql3hlKp4PNlRf9Cy7y5iA3G7MLyg3FcPX5z2kmcyPt2jOTRMBWUJ5zIQpOxizAcN8WsT3WWBL5KbuYK6k0PzujrIDLqdxGpNmjkkMfDBT9cKmZpm2FdW+oZgPFJP+oKmAo4u4KJz/vjiPTXgQlN5bmrLuRMCp+AwC5wkIohTqWZVPE2TK6ZSnMYcg/W39s+RP/9mJoyryAvPSpBOLTI+biCgaUCTOAZxNTWpMFc3tPYntc41WWkdKcooZ9JA5DwfcaVFyTGQ3YXz+HvX6G1z/gW0Q/A4dBi9mj2iE1xm7tRTT+4VQ2AXFvSEI1HJpfPgYnwAtwOD1v3Qm2EUHk9sCdtEDR4wVGEPIVn44GnwFMnGKx9JWppMPYwFu3SVDdHt+E+LOlhZUply11Aa+IVrT2KUQ=
|
||||
74
vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
generated
vendored
74
vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
generated
vendored
@@ -1,74 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
15
vendor/github.com/go-openapi/jsonreference/README.md
generated
vendored
15
vendor/github.com/go-openapi/jsonreference/README.md
generated
vendored
@@ -1,15 +0,0 @@
|
||||
# gojsonreference [](https://travis-ci.org/go-openapi/jsonreference) [](https://codecov.io/gh/go-openapi/jsonreference) [](https://slackin.goswagger.io)
|
||||
|
||||
[](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) [](http://godoc.org/github.com/go-openapi/jsonreference)
|
||||
An implementation of JSON Reference - Go language
|
||||
|
||||
## Status
|
||||
Work in progress ( 90% done )
|
||||
|
||||
## Dependencies
|
||||
https://github.com/go-openapi/jsonpointer
|
||||
|
||||
## References
|
||||
http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
|
||||
|
||||
http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
|
||||
420
vendor/github.com/go-openapi/jsonreference/reference_test.go
generated
vendored
420
vendor/github.com/go-openapi/jsonreference/reference_test.go
generated
vendored
@@ -1,420 +0,0 @@
|
||||
// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
|
||||
//
|
||||
// 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.
|
||||
|
||||
// author sigu-399
|
||||
// author-github https://github.com/sigu-399
|
||||
// author-mail sigu.399@gmail.com
|
||||
//
|
||||
// repository-name jsonreference
|
||||
// repository-desc An implementation of JSON Reference - Go language
|
||||
//
|
||||
// description Automated tests on package.
|
||||
//
|
||||
// created 03-03-2013
|
||||
|
||||
package jsonreference
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-openapi/jsonpointer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIsRoot(t *testing.T) {
|
||||
in := "#"
|
||||
r1, err := New(in)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, r1.IsRoot())
|
||||
|
||||
in = "#/ok"
|
||||
r1 = MustCreateRef(in)
|
||||
assert.False(t, r1.IsRoot())
|
||||
|
||||
assert.Panics(t, assert.PanicTestFunc(func() {
|
||||
MustCreateRef("%2")
|
||||
}))
|
||||
}
|
||||
|
||||
func TestFull(t *testing.T) {
|
||||
|
||||
in := "http://host/path/a/b/c#/f/a/b"
|
||||
|
||||
r1, err := New(in)
|
||||
if err != nil {
|
||||
t.Errorf("New(%v) error %s", in, err.Error())
|
||||
}
|
||||
|
||||
if in != r1.String() {
|
||||
t.Errorf("New(%v) = %v, expect %v", in, r1.String(), in)
|
||||
}
|
||||
|
||||
if r1.HasFragmentOnly != false {
|
||||
t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in, r1.HasFragmentOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFullURL != true {
|
||||
t.Errorf("New(%v)::HasFullURL %v expect %v", in, r1.HasFullURL, true)
|
||||
}
|
||||
|
||||
if r1.HasURLPathOnly != false {
|
||||
t.Errorf("New(%v)::HasURLPathOnly %v expect %v", in, r1.HasURLPathOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFileScheme != false {
|
||||
t.Errorf("New(%v)::HasFileScheme %v expect %v", in, r1.HasFileScheme, false)
|
||||
}
|
||||
|
||||
if r1.GetPointer().String() != "/f/a/b" {
|
||||
t.Errorf("New(%v)::GetPointer() %v expect %v", in, r1.GetPointer().String(), "/f/a/b")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFullURL(t *testing.T) {
|
||||
|
||||
in := "http://host/path/a/b/c"
|
||||
|
||||
r1, err := New(in)
|
||||
if err != nil {
|
||||
t.Errorf("New(%v) error %s", in, err.Error())
|
||||
}
|
||||
|
||||
if in != r1.String() {
|
||||
t.Errorf("New(%v) = %v, expect %v", in, r1.String(), in)
|
||||
}
|
||||
|
||||
if r1.HasFragmentOnly != false {
|
||||
t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in, r1.HasFragmentOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFullURL != true {
|
||||
t.Errorf("New(%v)::HasFullURL %v expect %v", in, r1.HasFullURL, true)
|
||||
}
|
||||
|
||||
if r1.HasURLPathOnly != false {
|
||||
t.Errorf("New(%v)::HasURLPathOnly %v expect %v", in, r1.HasURLPathOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFileScheme != false {
|
||||
t.Errorf("New(%v)::HasFileScheme %v expect %v", in, r1.HasFileScheme, false)
|
||||
}
|
||||
|
||||
if r1.GetPointer().String() != "" {
|
||||
t.Errorf("New(%v)::GetPointer() %v expect %v", in, r1.GetPointer().String(), "")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFragmentOnly(t *testing.T) {
|
||||
|
||||
in := "#/fragment/only"
|
||||
|
||||
r1, err := New(in)
|
||||
if err != nil {
|
||||
t.Errorf("New(%v) error %s", in, err.Error())
|
||||
}
|
||||
|
||||
if in != r1.String() {
|
||||
t.Errorf("New(%v) = %v, expect %v", in, r1.String(), in)
|
||||
}
|
||||
|
||||
if r1.HasFragmentOnly != true {
|
||||
t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in, r1.HasFragmentOnly, true)
|
||||
}
|
||||
|
||||
if r1.HasFullURL != false {
|
||||
t.Errorf("New(%v)::HasFullURL %v expect %v", in, r1.HasFullURL, false)
|
||||
}
|
||||
|
||||
if r1.HasURLPathOnly != false {
|
||||
t.Errorf("New(%v)::HasURLPathOnly %v expect %v", in, r1.HasURLPathOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFileScheme != false {
|
||||
t.Errorf("New(%v)::HasFileScheme %v expect %v", in, r1.HasFileScheme, false)
|
||||
}
|
||||
|
||||
if r1.GetPointer().String() != "/fragment/only" {
|
||||
t.Errorf("New(%v)::GetPointer() %v expect %v", in, r1.GetPointer().String(), "/fragment/only")
|
||||
}
|
||||
|
||||
p, _ := jsonpointer.New(r1.referenceURL.Fragment)
|
||||
r2 := Ref{referencePointer: p, HasFragmentOnly: true}
|
||||
assert.Equal(t, r2.String(), in)
|
||||
|
||||
r3 := Ref{referencePointer: p, HasFragmentOnly: false}
|
||||
assert.Equal(t, r3.String(), in[1:])
|
||||
}
|
||||
|
||||
func TestURLPathOnly(t *testing.T) {
|
||||
|
||||
in := "/documents/document.json"
|
||||
|
||||
r1, err := New(in)
|
||||
if err != nil {
|
||||
t.Errorf("New(%v) error %s", in, err.Error())
|
||||
}
|
||||
|
||||
if in != r1.String() {
|
||||
t.Errorf("New(%v) = %v, expect %v", in, r1.String(), in)
|
||||
}
|
||||
|
||||
if r1.HasFragmentOnly != false {
|
||||
t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in, r1.HasFragmentOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFullURL != false {
|
||||
t.Errorf("New(%v)::HasFullURL %v expect %v", in, r1.HasFullURL, false)
|
||||
}
|
||||
|
||||
if r1.HasURLPathOnly != true {
|
||||
t.Errorf("New(%v)::HasURLPathOnly %v expect %v", in, r1.HasURLPathOnly, true)
|
||||
}
|
||||
|
||||
if r1.HasFileScheme != false {
|
||||
t.Errorf("New(%v)::HasFileScheme %v expect %v", in, r1.HasFileScheme, false)
|
||||
}
|
||||
|
||||
if r1.GetPointer().String() != "" {
|
||||
t.Errorf("New(%v)::GetPointer() %v expect %v", in, r1.GetPointer().String(), "")
|
||||
}
|
||||
}
|
||||
|
||||
func TestURLRelativePathOnly(t *testing.T) {
|
||||
|
||||
in := "document.json"
|
||||
|
||||
r1, err := New(in)
|
||||
if err != nil {
|
||||
t.Errorf("New(%v) error %s", in, err.Error())
|
||||
}
|
||||
|
||||
if in != r1.String() {
|
||||
t.Errorf("New(%v) = %v, expect %v", in, r1.String(), in)
|
||||
}
|
||||
|
||||
if r1.HasFragmentOnly != false {
|
||||
t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in, r1.HasFragmentOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFullURL != false {
|
||||
t.Errorf("New(%v)::HasFullURL %v expect %v", in, r1.HasFullURL, false)
|
||||
}
|
||||
|
||||
if r1.HasURLPathOnly != true {
|
||||
t.Errorf("New(%v)::HasURLPathOnly %v expect %v", in, r1.HasURLPathOnly, true)
|
||||
}
|
||||
|
||||
if r1.HasFileScheme != false {
|
||||
t.Errorf("New(%v)::HasFileScheme %v expect %v", in, r1.HasFileScheme, false)
|
||||
}
|
||||
|
||||
if r1.GetPointer().String() != "" {
|
||||
t.Errorf("New(%v)::GetPointer() %v expect %v", in, r1.GetPointer().String(), "")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritsInValid(t *testing.T) {
|
||||
in1 := "http://www.test.com/doc.json"
|
||||
in2 := "#/a/b"
|
||||
|
||||
r1, _ := New(in1)
|
||||
r2 := Ref{}
|
||||
result, err := r1.Inherits(r2)
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, result)
|
||||
|
||||
r1 = Ref{}
|
||||
r2, _ = New(in2)
|
||||
result, err = r1.Inherits(r2)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, r2, *result)
|
||||
}
|
||||
|
||||
func TestInheritsValid(t *testing.T) {
|
||||
|
||||
in1 := "http://www.test.com/doc.json"
|
||||
in2 := "#/a/b"
|
||||
out := in1 + in2
|
||||
|
||||
r1, _ := New(in1)
|
||||
r2, _ := New(in2)
|
||||
|
||||
result, err := r1.Inherits(r2)
|
||||
if err != nil {
|
||||
t.Errorf("Inherits(%s,%s) error %s", r1.String(), r2.String(), err.Error())
|
||||
}
|
||||
|
||||
if result.String() != out {
|
||||
t.Errorf("Inherits(%s,%s) = %s, expect %s", r1.String(), r2.String(), result.String(), out)
|
||||
}
|
||||
|
||||
if result.GetPointer().String() != "/a/b" {
|
||||
t.Errorf("result(%v)::GetPointer() %v expect %v", result.String(), result.GetPointer().String(), "/a/b")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritsDifferentHost(t *testing.T) {
|
||||
|
||||
in1 := "http://www.test.com/doc.json"
|
||||
in2 := "http://www.test2.com/doc.json#bla"
|
||||
|
||||
r1, _ := New(in1)
|
||||
r2, _ := New(in2)
|
||||
|
||||
result, err := r1.Inherits(r2)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Inherits(%s,%s) should not fail. Error: %s", r1.String(), r2.String(), err.Error())
|
||||
}
|
||||
|
||||
if result.String() != in2 {
|
||||
t.Errorf("Inherits(%s,%s) should be %s but is %s", in1, in2, in2, result)
|
||||
}
|
||||
|
||||
if result.GetPointer().String() != "" {
|
||||
t.Errorf("result(%v)::GetPointer() %v expect %v", result.String(), result.GetPointer().String(), "")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileScheme(t *testing.T) {
|
||||
|
||||
in1 := "file:///Users/mac/1.json#a"
|
||||
in2 := "file:///Users/mac/2.json#b"
|
||||
|
||||
r1, _ := New(in1)
|
||||
r2, _ := New(in2)
|
||||
|
||||
if r1.HasFragmentOnly != false {
|
||||
t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in1, r1.HasFragmentOnly, false)
|
||||
}
|
||||
|
||||
if r1.HasFileScheme != true {
|
||||
t.Errorf("New(%v)::HasFileScheme %v expect %v", in1, r1.HasFileScheme, true)
|
||||
}
|
||||
|
||||
if r1.HasFullFilePath != true {
|
||||
t.Errorf("New(%v)::HasFullFilePath %v expect %v", in1, r1.HasFullFilePath, true)
|
||||
}
|
||||
|
||||
if r1.IsCanonical() != true {
|
||||
t.Errorf("New(%v)::IsCanonical %v expect %v", in1, r1.IsCanonical, true)
|
||||
}
|
||||
|
||||
result, err := r1.Inherits(r2)
|
||||
if err != nil {
|
||||
t.Errorf("Inherits(%s,%s) should not fail. Error: %s", r1.String(), r2.String(), err.Error())
|
||||
}
|
||||
if result.String() != in2 {
|
||||
t.Errorf("Inherits(%s,%s) should be %s but is %s", in1, in2, in2, result)
|
||||
}
|
||||
|
||||
if result.GetPointer().String() != "" {
|
||||
t.Errorf("result(%v)::GetPointer() %v expect %v", result.String(), result.GetPointer().String(), "")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReferenceResolution(t *testing.T) {
|
||||
|
||||
// 5.4. Reference Resolution Examples
|
||||
// http://tools.ietf.org/html/rfc3986#section-5.4
|
||||
|
||||
base := "http://a/b/c/d;p?q"
|
||||
baseRef, err := New(base)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("New(%s) failed error: %s", base, err.Error())
|
||||
}
|
||||
if baseRef.String() != base {
|
||||
t.Errorf("New(%s) %s expected %s", base, baseRef.String(), base)
|
||||
}
|
||||
|
||||
checks := []string{
|
||||
// 5.4.1. Normal Examples
|
||||
// http://tools.ietf.org/html/rfc3986#section-5.4.1
|
||||
|
||||
"g:h", "g:h",
|
||||
"g", "http://a/b/c/g",
|
||||
"./g", "http://a/b/c/g",
|
||||
"g/", "http://a/b/c/g/",
|
||||
"/g", "http://a/g",
|
||||
"//g", "http://g",
|
||||
"?y", "http://a/b/c/d;p?y",
|
||||
"g?y", "http://a/b/c/g?y",
|
||||
"#s", "http://a/b/c/d;p?q#s",
|
||||
"g#s", "http://a/b/c/g#s",
|
||||
"g?y#s", "http://a/b/c/g?y#s",
|
||||
";x", "http://a/b/c/;x",
|
||||
"g;x", "http://a/b/c/g;x",
|
||||
"g;x?y#s", "http://a/b/c/g;x?y#s",
|
||||
"", "http://a/b/c/d;p?q",
|
||||
".", "http://a/b/c/",
|
||||
"./", "http://a/b/c/",
|
||||
"..", "http://a/b/",
|
||||
"../", "http://a/b/",
|
||||
"../g", "http://a/b/g",
|
||||
"../..", "http://a/",
|
||||
"../../", "http://a/",
|
||||
"../../g", "http://a/g",
|
||||
|
||||
// 5.4.2. Abnormal Examples
|
||||
// http://tools.ietf.org/html/rfc3986#section-5.4.2
|
||||
|
||||
"../../../g", "http://a/g",
|
||||
"../../../../g", "http://a/g",
|
||||
|
||||
"/./g", "http://a/g",
|
||||
"/../g", "http://a/g",
|
||||
"g.", "http://a/b/c/g.",
|
||||
".g", "http://a/b/c/.g",
|
||||
"g..", "http://a/b/c/g..",
|
||||
"..g", "http://a/b/c/..g",
|
||||
|
||||
"./../g", "http://a/b/g",
|
||||
"./g/.", "http://a/b/c/g/",
|
||||
"g/./h", "http://a/b/c/g/h",
|
||||
"g/../h", "http://a/b/c/h",
|
||||
"g;x=1/./y", "http://a/b/c/g;x=1/y",
|
||||
"g;x=1/../y", "http://a/b/c/y",
|
||||
|
||||
"g?y/./x", "http://a/b/c/g?y/./x",
|
||||
"g?y/../x", "http://a/b/c/g?y/../x",
|
||||
"g#s/./x", "http://a/b/c/g#s/./x",
|
||||
"g#s/../x", "http://a/b/c/g#s/../x",
|
||||
|
||||
"http:g", "http:g", // for strict parsers
|
||||
//"http:g", "http://a/b/c/g", // for backward compatibility
|
||||
|
||||
}
|
||||
for i := 0; i < len(checks); i += 2 {
|
||||
child := checks[i]
|
||||
expected := checks[i+1]
|
||||
// fmt.Printf("%d: %v -> %v\n", i/2, child, expected)
|
||||
|
||||
childRef, e := New(child)
|
||||
if e != nil {
|
||||
t.Errorf("%d: New(%s) failed error: %s", i/2, child, e.Error())
|
||||
}
|
||||
|
||||
res, e := baseRef.Inherits(childRef)
|
||||
if res == nil {
|
||||
t.Errorf("%d: Inherits(%s, %s) nil not expected", i/2, base, child)
|
||||
}
|
||||
if e != nil {
|
||||
t.Errorf("%d: Inherits(%s) failed error: %s", i/2, child, e.Error())
|
||||
}
|
||||
if res.String() != expected {
|
||||
t.Errorf("%d: Inherits(%s, %s) %s expected %s", i/2, base, child, res.String(), expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
1
vendor/github.com/go-openapi/loads/.drone.sec
generated
vendored
1
vendor/github.com/go-openapi/loads/.drone.sec
generated
vendored
@@ -1 +0,0 @@
|
||||
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.xUjixvmMMeampw0Doyr_XLvcV5ICmDgDFmlcWqgmO84O3Hwn6dqbMkwOjpKMOyEJW_98b5Om5ED59IFt2S0T_OarlrsJL8jOK5fqxSMNXy2w8LfI-e5l1URverW41ofAVK8m9wK05q2BSJM_M6PyyODaQeDBiCVK1HreMZBlXpuUDVtBMPILQoga0eSZOsTR3DYEpZIS0A0Rsa5yIhMYR5d5-JMYqbqOCB7tNJ-BM83OzYgL7Hrz0J15kqaJmhQ-GJoMJDzOemSO9KxLCOfSPp11R_G3Mfd48xYnuiRuPOTakbOCLxuYviH6uoGVIOhnMyY9qKiDKbOn4BQUi1-igA.6qjQzq9nzAxRRKV_.z79R5cMFAEuEaAh6U9ykiL8oIqzMbs_I2C-hSFRh3HYRJ4fTB-9LrcbF0uASIOq7bBn4OQzW-0QFwYOs1uaawmrByGngV5d0afiZf_LBKcmTF2vtxRi_A_nxD-EHoPmh3lKBU5WNDe_8kLjEeS89HeyyFPuv5iQbqhzdqPFohHKVigwVqVYYLjB8GWQ4t7tC4c8l5rHanaXf71W0e3op2m8bebpZL0JPGhnULVA1oU27TYeLsO112JkIYtBwZxzvAs--bBFoKeGJWVMFzrKN68UACGZ9RFw0uGJbBmVC4-jRuIc6XpqeEqw3KG-rjFzkeEor3575qW-8kiXYqpub9SFUc3SSZkxJ8hB3SrnMBOuDUSenrXNpAbltmV3KAALzN3_bMBQuihwSRIn0Hg7-Dpni8BieMe44RMDvRu6p_71aeU_KW4V7Umy_h8gpIvQFuKGdTQH2ahsyCXL0ojqjMbVMdoWpDQTQ2_Fy8Qt_p2kJ8BgDo-1Akd4a6BNU2NGqsdnrJmtVKcTqLBadf9ylCwxHdGVrtNYORALSms2T6Q1s-poQnMjIwN8lnUD8ABUBpt4uVtrYkiWPVwrwywLQeiHhR-pboe_53kWDAx4Hy4rpbKsaxanYhy_bEbAYKb3aIUA.75GD4kRBCQdcGFYP1QYdCg
|
||||
39
vendor/github.com/go-openapi/loads/.drone.yml
generated
vendored
39
vendor/github.com/go-openapi/loads/.drone.yml
generated
vendored
@@ -1,39 +0,0 @@
|
||||
clone:
|
||||
path: github.com/go-openapi/loads
|
||||
|
||||
matrix:
|
||||
GO_VERSION:
|
||||
- "1.6"
|
||||
|
||||
build:
|
||||
integration:
|
||||
image: golang:$$GO_VERSION
|
||||
pull: true
|
||||
environment:
|
||||
GOCOVMODE: "count"
|
||||
commands:
|
||||
- go get -u github.com/axw/gocov/gocov
|
||||
- go get -u gopkg.in/matm/v1/gocov-html
|
||||
- go get -u github.com/cee-dub/go-junit-report
|
||||
- go get -u github.com/stretchr/testify/assert
|
||||
- go get -u gopkg.in/yaml.v2
|
||||
- go get -u github.com/go-openapi/swag
|
||||
- go get -u github.com/go-openapi/analysis
|
||||
- go get -u github.com/go-openapi/spec
|
||||
- ./hack/build-drone.sh
|
||||
|
||||
notify:
|
||||
slack:
|
||||
channel: bots
|
||||
webhook_url: $$SLACK_URL
|
||||
username: drone
|
||||
|
||||
publish:
|
||||
coverage:
|
||||
server: https://coverage.vmware.run
|
||||
token: $$GITHUB_TOKEN
|
||||
# threshold: 70
|
||||
# must_increase: true
|
||||
when:
|
||||
matrix:
|
||||
GO_VERSION: "1.6"
|
||||
117
vendor/github.com/go-openapi/loads/.github/CONTRIBUTING.md
generated
vendored
117
vendor/github.com/go-openapi/loads/.github/CONTRIBUTING.md
generated
vendored
@@ -1,117 +0,0 @@
|
||||
## Contribution Guidelines
|
||||
|
||||
### Pull requests are always welcome
|
||||
|
||||
We are always thrilled to receive pull requests, and do our best to
|
||||
process them as fast as possible. Not sure if that typo is worth a pull
|
||||
request? Do it! We will appreciate it.
|
||||
|
||||
If your pull request is not accepted on the first try, don't be
|
||||
discouraged! If there's a problem with the implementation, hopefully you
|
||||
received feedback on what to improve.
|
||||
|
||||
We're trying very hard to keep go-swagger lean and focused. We don't want it
|
||||
to do everything for everybody. This means that we might decide against
|
||||
incorporating a new feature. However, there might be a way to implement
|
||||
that feature *on top of* go-swagger.
|
||||
|
||||
|
||||
### Conventions
|
||||
|
||||
Fork the repo and make changes on your fork in a feature branch:
|
||||
|
||||
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
|
||||
issue
|
||||
- If it's a feature branch, create an enhancement issue to announce your
|
||||
intentions, and name it XXX-something where XXX is the number of the issue.
|
||||
|
||||
Submit unit tests for your changes. Go has a great test framework built in; use
|
||||
it! Take a look at existing tests for inspiration. Run the full test suite on
|
||||
your branch before submitting a pull request.
|
||||
|
||||
Update the documentation when creating or modifying features. Test
|
||||
your documentation changes for clarity, concision, and correctness, as
|
||||
well as a clean documentation build. See ``docs/README.md`` for more
|
||||
information on building the docs and how docs get released.
|
||||
|
||||
Write clean code. Universally formatted code promotes ease of writing, reading,
|
||||
and maintenance. Always run `gofmt -s -w file.go` on each changed file before
|
||||
committing your changes. Most editors have plugins that do this automatically.
|
||||
|
||||
Pull requests descriptions should be as clear as possible and include a
|
||||
reference to all the issues that they address.
|
||||
|
||||
Pull requests must not contain commits from other users or branches.
|
||||
|
||||
Commit messages must start with a capitalized and short summary (max. 50
|
||||
chars) written in the imperative, followed by an optional, more detailed
|
||||
explanatory text which is separated from the summary by an empty line.
|
||||
|
||||
Code review comments may be added to your pull request. Discuss, then make the
|
||||
suggested modifications and push additional commits to your feature branch. Be
|
||||
sure to post a comment after pushing. The new commits will show up in the pull
|
||||
request automatically, but the reviewers will not be notified unless you
|
||||
comment.
|
||||
|
||||
Before the pull request is merged, make sure that you squash your commits into
|
||||
logical units of work using `git rebase -i` and `git push -f`. After every
|
||||
commit the test suite should be passing. Include documentation changes in the
|
||||
same commit so that a revert would remove all traces of the feature or fix.
|
||||
|
||||
Commits that fix or close an issue should include a reference like `Closes #XXX`
|
||||
or `Fixes #XXX`, which will automatically close the issue when merged.
|
||||
|
||||
### Sign your work
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to
|
||||
pass it on as an open-source patch. The rules are pretty simple: if you
|
||||
can certify the below (from
|
||||
[developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe@gmail.com>
|
||||
|
||||
using your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
You can add the sign off when creating the git commit via `git commit -s`.
|
||||
4
vendor/github.com/go-openapi/loads/.gitignore
generated
vendored
4
vendor/github.com/go-openapi/loads/.gitignore
generated
vendored
@@ -1,4 +0,0 @@
|
||||
secrets.yml
|
||||
coverage.out
|
||||
profile.cov
|
||||
profile.out
|
||||
16
vendor/github.com/go-openapi/loads/.travis.yml
generated
vendored
16
vendor/github.com/go-openapi/loads/.travis.yml
generated
vendored
@@ -1,16 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.7
|
||||
install:
|
||||
- go get -u github.com/stretchr/testify
|
||||
- go get -u github.com/go-openapi/analysis
|
||||
- go get -u github.com/go-openapi/spec
|
||||
- go get -u github.com/go-openapi/swag
|
||||
- go get -u gopkg.in/yaml.v2
|
||||
script:
|
||||
- ./hack/coverage
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
notifications:
|
||||
slack:
|
||||
secure: OxkPwVp35qBTUilgWC8xykSj+sGMcj0h8IIOKD+Rflx2schZVlFfdYdyVBM+s9OqeOfvtuvnR9v1Ye2rPKAvcjWdC4LpRGUsgmItZaI6Um8Aj6+K9udCw5qrtZVfOVmRu8LieH//XznWWKdOultUuniW0MLqw5+II87Gd00RWbCGi0hk0PykHe7uK+PDA2BEbqyZ2WKKYCvfB3j+0nrFOHScXqnh0V05l2E83J4+Sgy1fsPy+1WdX58ZlNBG333ibaC1FS79XvKSmTgKRkx3+YBo97u6ZtUmJa5WZjf2OdLG3KIckGWAv6R5xgxeU31N0Ng8L332w/Edpp2O/M2bZwdnKJ8hJQikXIAQbICbr+lTDzsoNzMdEIYcHpJ5hjPbiUl3Bmd+Jnsjf5McgAZDiWIfpCKZ29tPCEkVwRsOCqkyPRMNMzHHmoja495P5jR+ODS7+J8RFg5xgcnOgpP9D4Wlhztlf5WyZMpkLxTUD+bZq2SRf50HfHFXTkfq22zPl3d1eq0yrLwh/Z/fWKkfb6SyysROL8y6s8u3dpFX1YHSg0BR6i913h4aoZw9B2BG27cafLLTwKYsp2dFo1PWl4O6u9giFJIeqwloZHLKKrwh0cBFhB7RH0I58asxkZpCH6uWjJierahmHe7iS+E6i+9oCHkOZ59hmCYNimIs3hM=
|
||||
74
vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md
generated
vendored
74
vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md
generated
vendored
@@ -1,74 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
5
vendor/github.com/go-openapi/loads/README.md
generated
vendored
5
vendor/github.com/go-openapi/loads/README.md
generated
vendored
@@ -1,5 +0,0 @@
|
||||
# Loads OAI specs [](https://travis-ci.org/go-openapi/loads) [](https://codecov.io/gh/go-openapi/loads) [](https://slackin.goswagger.io)
|
||||
|
||||
[](https://raw.githubusercontent.com/go-openapi/loads/master/LICENSE) [](http://godoc.org/github.com/go-openapi/loads)
|
||||
|
||||
Loading of OAI specification documents from local or remote locations.
|
||||
17
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithArrayRef.json
generated
vendored
17
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithArrayRef.json
generated
vendored
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Person"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithComposition.json
generated
vendored
68
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithComposition.json
generated
vendored
@@ -1,68 +0,0 @@
|
||||
{
|
||||
"definitions": {
|
||||
"Cat": {
|
||||
"description": "A representation of a cat",
|
||||
"allOf": [
|
||||
{ "$ref": "#/models/Pet" },
|
||||
{
|
||||
"properties": {
|
||||
"huntingSkill": {
|
||||
"type": "string",
|
||||
"description": "The measured skill for hunting",
|
||||
"default": "lazy",
|
||||
"enum": ["clueless", "lazy", "adventerous", "aggressive"]
|
||||
}
|
||||
},
|
||||
"required": [ "huntingSkill" ]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Dog": {
|
||||
"description": "A representation of a dog",
|
||||
"allOf": [
|
||||
{ "$ref": "#/models/Pet" },
|
||||
{
|
||||
"properties": {
|
||||
"packSize": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "the size of the pack the dog is from",
|
||||
"default": 0,
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": [ "name", "packSize" ]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Fish": {
|
||||
"description": "A representation of a fish",
|
||||
"allOf": [
|
||||
{ "$ref": "#/models/Pet" },
|
||||
{
|
||||
"properties": {
|
||||
"fins": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "count of fins",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": [ "fins" ]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Pet": {
|
||||
"discriminator": "petType",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"petType": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [ "name", "petType" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
7
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithDateTimeMap.json
generated
vendored
7
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithDateTimeMap.json
generated
vendored
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"description": "true",
|
||||
"additionalProperties": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
28
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithExamples.json
generated
vendored
28
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithExamples.json
generated
vendored
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"definitions": {
|
||||
"Pet": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"Dog": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
7
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithInt32Map.json
generated
vendored
7
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithInt32Map.json
generated
vendored
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"description": "This is a Map[String, Integer]",
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
7
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithInt64Map.json
generated
vendored
7
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithInt64Map.json
generated
vendored
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"description": "true",
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
67
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithMultipleProperties.json
generated
vendored
67
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithMultipleProperties.json
generated
vendored
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"description": "true",
|
||||
"properties": {
|
||||
"booleanValue": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"byteValue": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
},
|
||||
"dateTimeValue": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"int32Value": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"int64Value": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"stringValue": {
|
||||
"type": "string"
|
||||
},
|
||||
"booleanArrayValue": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"byteArrayValue": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
},
|
||||
"dateTimeArrayValue": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
},
|
||||
"int32ArrayValue": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"int64ArrayValue": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
},
|
||||
"stringArrayValue": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithObjectMap.json
generated
vendored
15
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithObjectMap.json
generated
vendored
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"description": "This is a Map[String, { id: Long, name: String}]",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithPrimitiveArray.json
generated
vendored
18
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithPrimitiveArray.json
generated
vendored
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"childrensAges": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithStringProperty.json
generated
vendored
8
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithStringProperty.json
generated
vendored
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"description": "true",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
26
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithXmlAttributes.json
generated
vendored
26
vendor/github.com/go-openapi/loads/fixtures/json/models/modelWithXmlAttributes.json
generated
vendored
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"description": "this model serves xml and json structures",
|
||||
"xml": {
|
||||
"name": "XMLModel"
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"attribute": true,
|
||||
"namespace": "ns1",
|
||||
"prefix": "urn1"
|
||||
}
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"xml": {
|
||||
"wrapped": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
vendor/github.com/go-openapi/loads/fixtures/json/models/models.json
generated
vendored
14
vendor/github.com/go-openapi/loads/fixtures/json/models/models.json
generated
vendored
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"definitions": {
|
||||
"Pet": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
28
vendor/github.com/go-openapi/loads/fixtures/json/models/multipleModels.json
generated
vendored
28
vendor/github.com/go-openapi/loads/fixtures/json/models/multipleModels.json
generated
vendored
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"definitions": {
|
||||
"Pet": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"Dog": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "ComplexType"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"$ref": "Foo",
|
||||
"description": "a boolean",
|
||||
"readOnly": true
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "a boolean",
|
||||
"readOnly": true
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
98
vendor/github.com/go-openapi/loads/fixtures/json/resources/cascadingSchemes.json
generated
vendored
98
vendor/github.com/go-openapi/loads/fixtures/json/resources/cascadingSchemes.json
generated
vendored
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.9-abcd",
|
||||
"title": "Swagger Sample API",
|
||||
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
|
||||
"termsOfService": "http://helloreverb.com/terms/",
|
||||
"contact": {
|
||||
"name": "wordnik api team",
|
||||
"url": "http://developer.wordnik.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "Creative Commons 4.0 International",
|
||||
"url": "http://creativecommons.org/licenses/by/4.0/"
|
||||
}
|
||||
},
|
||||
"host": "my.api.com",
|
||||
"basePath": "/v1",
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"paths": {
|
||||
"/pets/{petId}": {
|
||||
"get": {
|
||||
"description": "Returns a pet based on ID",
|
||||
"summary": "Find pet by ID",
|
||||
"operationId": "getPetsById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"text/html"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"in": "path",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"collectionFormat": "csv"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "pet response",
|
||||
"schema": {
|
||||
"$ref": "Pet"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "error payload",
|
||||
"schema": {
|
||||
"$ref": "ErrorModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schemes": [ "https" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"Pet": {
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorModel": {
|
||||
"required": [ "code", "message" ],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
100
vendor/github.com/go-openapi/loads/fixtures/json/resources/commonParameters.json
generated
vendored
100
vendor/github.com/go-openapi/loads/fixtures/json/resources/commonParameters.json
generated
vendored
@@ -1,100 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.9-abcd",
|
||||
"title": "Swagger Sample API",
|
||||
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
|
||||
"termsOfService": "http://helloreverb.com/terms/",
|
||||
"contact": {
|
||||
"name": "wordnik api team",
|
||||
"url": "http://developer.wordnik.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "Creative Commons 4.0 International",
|
||||
"url": "http://creativecommons.org/licenses/by/4.0/"
|
||||
}
|
||||
},
|
||||
"host": "my.api.com",
|
||||
"basePath": "/v1",
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"paths": {
|
||||
"/pets/{id}": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "ID of pet to use",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"collectionFormat": "csv"
|
||||
}
|
||||
],
|
||||
"get": {
|
||||
"description": "Returns pets based on ID",
|
||||
"summary": "Find pets by ID",
|
||||
"operationId": "getPetsById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"text/html"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "pet response",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "error payload",
|
||||
"schema": {
|
||||
"$ref": "ErrorModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"Pet": {
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorModel": {
|
||||
"required": [ "code", "message" ],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
109
vendor/github.com/go-openapi/loads/fixtures/json/resources/multipleMimeTypes.json
generated
vendored
109
vendor/github.com/go-openapi/loads/fixtures/json/resources/multipleMimeTypes.json
generated
vendored
@@ -1,109 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.9-abcd",
|
||||
"title": "Swagger Sample API",
|
||||
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
|
||||
"termsOfService": "http://helloreverb.com/terms/",
|
||||
"contact": {
|
||||
"name": "wordnik api team",
|
||||
"url": "http://developer.wordnik.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "Creative Commons 4.0 International",
|
||||
"url": "http://creativecommons.org/licenses/by/4.0/"
|
||||
}
|
||||
},
|
||||
"host": "my.api.com",
|
||||
"basePath": "/v1",
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"text/plain; charset=utf-8",
|
||||
"application/json",
|
||||
"application/vnd.github+json",
|
||||
"application/vnd.github.v3+json",
|
||||
"application/vnd.github.v3.raw+json",
|
||||
"application/vnd.github.v3.text+json",
|
||||
"application/vnd.github.v3.html+json",
|
||||
"application/vnd.github.v3.full+json",
|
||||
"application/vnd.github.v3.diff",
|
||||
"application/vnd.github.v3.patch"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"paths": {
|
||||
"/pets/{id}": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "ID of pet to use",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"collectionFormat": "csv"
|
||||
}
|
||||
],
|
||||
"get": {
|
||||
"description": "Returns pets based on ID",
|
||||
"summary": "Find pets by ID",
|
||||
"operationId": "getPetsById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"text/html"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "pet response",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "error payload",
|
||||
"schema": {
|
||||
"$ref": "ErrorModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"Pet": {
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorModel": {
|
||||
"required": [ "code", "message" ],
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"description": "Returns a pet based on ID",
|
||||
"summary": "Find pet by ID",
|
||||
"operationId": "getPetsById",
|
||||
"tags": [ "foo", "bar"],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"text/html"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"in": "path",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "a pet to be returned",
|
||||
"schema": {"$ref": "Pet"}
|
||||
},
|
||||
"default": {
|
||||
"description": "Unexpected error",
|
||||
"schema": {"$ref": "ErrorModel"}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"description": "Returns a pet based on ID",
|
||||
"summary": "Find pet by ID",
|
||||
"operationId": "getPetsById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"text/html"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"in": "path",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "includeDetails",
|
||||
"in": "query",
|
||||
"description": "include details in response",
|
||||
"required": true,
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "a pet to be returned",
|
||||
"schema": {"$ref": "Pet"}
|
||||
},
|
||||
"default": {
|
||||
"description": "Unexpected error",
|
||||
"schema": {"$ref": "ErrorModel"}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"description": "Returns a pet based on ID",
|
||||
"summary": "Find pet by ID",
|
||||
"operationId": "getPetsById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"text/html"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"in": "path",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "fun",
|
||||
"schema": {"$ref": "Pet"}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid ID supplied <= this is purely for documentation",
|
||||
"schema": {"$ref": "ErrorModel"}
|
||||
},
|
||||
"default": {
|
||||
"description": "Unexpected error",
|
||||
"schema": {"$ref": "ErrorModel"}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"description": "user to add to the system",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"format": "csv"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"description": "user to add to the system",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "User"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "id",
|
||||
"in": "body",
|
||||
"description": "id to add",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"description": "user to add to the system",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"description": "user to add to the system",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "firstName",
|
||||
"in": "formData",
|
||||
"description": "users first name",
|
||||
"required": true,
|
||||
"$ref": "Nothing"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "id",
|
||||
"in": "formData",
|
||||
"description": "username to fetch",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "user",
|
||||
"in": "formData",
|
||||
"description": "user to add to the system",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "firstName",
|
||||
"in": "formData",
|
||||
"description": "users first name",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "token",
|
||||
"in": "header",
|
||||
"description": "token to be passed as a header",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"collectionFormat": "csv"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"name": "token",
|
||||
"in": "header",
|
||||
"description": "token to be passed as a header",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"collectionFormat": "csv"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "token",
|
||||
"in": "header",
|
||||
"description": "token to be passed as a header",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "username to fetch",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user