pax_global_header00006660000000000000000000000064145731263740014526gustar00rootroot0000000000000052 comment=a662cbe96c63f803ae3c7f17fec9fb4175ceb0f4 loads-0.22.0/000077500000000000000000000000001457312637400127115ustar00rootroot00000000000000loads-0.22.0/.editorconfig000066400000000000000000000010331457312637400153630ustar00rootroot00000000000000# 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 loads-0.22.0/.github/000077500000000000000000000000001457312637400142515ustar00rootroot00000000000000loads-0.22.0/.github/CONTRIBUTING.md000066400000000000000000000114601457312637400165040ustar00rootroot00000000000000## 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 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`. loads-0.22.0/.github/dependabot.yaml000066400000000000000000000032001457312637400172350ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" day: "friday" open-pull-requests-limit: 2 # <- default is 5 groups: # <- group all github actions updates in a single PR # 1. development-dependencies are auto-merged development-dependencies: patterns: - '*' - package-ecosystem: "gomod" # We define 4 groups of dependencies to regroup update pull requests: # - development (e.g. test dependencies) # - go-openapi updates # - golang.org (e.g. golang.org/x/... packages) # - other dependencies (direct or indirect) # # * All groups are checked once a week and each produce at most 1 PR. # * All dependabot PRs are auto-approved # # Auto-merging policy, when requirements are met: # 1. development-dependencies are auto-merged # 2. golang.org-dependencies are auto-merged # 3. go-openapi patch updates are auto-merged. Minor/major version updates require a manual merge. # 4. other dependencies require a manual merge directory: "/" schedule: interval: "weekly" day: "friday" open-pull-requests-limit: 4 groups: development-dependencies: patterns: - "github.com/stretchr/testify" golang.org-dependencies: patterns: - "golang.org/*" go-openapi-dependencies: patterns: - "github.com/go-openapi/*" other-dependencies: exclude-patterns: - "github.com/go-openapi/*" - "github.com/stretchr/testify" - "golang.org/*" loads-0.22.0/.github/workflows/000077500000000000000000000000001457312637400163065ustar00rootroot00000000000000loads-0.22.0/.github/workflows/auto-merge.yml000066400000000000000000000031301457312637400210730ustar00rootroot00000000000000name: Dependabot auto-merge on: pull_request permissions: contents: write pull-requests: write jobs: dependabot: runs-on: ubuntu-latest if: github.actor == 'dependabot[bot]' steps: - name: Dependabot metadata id: metadata uses: dependabot/fetch-metadata@v1 - name: Auto-approve all dependabot PRs run: gh pr review --approve "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Auto-merge dependabot PRs for development dependencies if: contains(steps.metadata.outputs.dependency-group, 'development-dependencies') run: gh pr merge --auto --rebase "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Auto-merge dependabot PRs for go-openapi patches if: contains(steps.metadata.outputs.dependency-group, 'go-openapi-dependencies') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') run: gh pr merge --auto --rebase "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Auto-merge dependabot PRs for golang.org updates if: contains(steps.metadata.outputs.dependency-group, 'golang.org-dependencies') run: gh pr merge --auto --rebase "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} loads-0.22.0/.github/workflows/go-test.yml000066400000000000000000000024761457312637400204240ustar00rootroot00000000000000name: go test on: push: tags: - v* branches: - master pull_request: jobs: lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: stable check-latest: true cache: true - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: version: latest only-new-issues: true skip-cache: true test: name: Unit tests runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] go_version: ['oldstable', 'stable' ] steps: - name: Run unit tests uses: actions/setup-go@v5 with: go-version: '${{ matrix.go_version }}' check-latest: true cache: true - uses: actions/checkout@v4 - run: go test -v -race -coverprofile="coverage-${{ matrix.os }}.${{ matrix.go_version }}.out" -covermode=atomic -coverpkg=$(go list)/... ./... - name: Upload coverage to codecov uses: codecov/codecov-action@v4 with: files: './coverage-${{ matrix.os }}.${{ matrix.go_version }}.out' flags: '${{ matrix.go_version }}' os: '${{ matrix.os }}' fail_ci_if_error: false verbose: true loads-0.22.0/.gitignore000066400000000000000000000000611457312637400146760ustar00rootroot00000000000000secrets.yml coverage.out profile.cov profile.out loads-0.22.0/.golangci.yml000066400000000000000000000016701457312637400153010ustar00rootroot00000000000000linters-settings: govet: check-shadowing: true golint: min-confidence: 0 gocyclo: min-complexity: 45 maligned: suggest-new: true dupl: threshold: 200 goconst: min-len: 2 min-occurrences: 3 linters: enable-all: true disable: - maligned - unparam - lll - gochecknoinits - gochecknoglobals - funlen - godox - gocognit - whitespace - wsl - wrapcheck - testpackage - nlreturn - gomnd - exhaustivestruct - goerr113 - errorlint - nestif - godot - gofumpt - paralleltest - tparallel - thelper - ifshort - exhaustruct - varnamelen - gci - depguard - errchkjson - inamedparam - nonamedreturns - musttag - ireturn - forcetypeassert - cyclop # deprecated linters - deadcode - interfacer - scopelint - varcheck - structcheck - golint - nosnakecase loads-0.22.0/.travis.yml000066400000000000000000000023251457312637400150240ustar00rootroot00000000000000after_success: - bash <(curl -s https://codecov.io/bash) go: - 1.16.x - 1.x install: - go get gotest.tools/gotestsum language: go arch: - amd64 - ppc64le jobs: include: # include linting job, but only for latest go version and amd64 arch - go: 1.x arch: amd64 install: go get github.com/golangci/golangci-lint/cmd/golangci-lint script: - golangci-lint run --new-from-rev master 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= script: - gotestsum -f short-verbose -- -race -timeout=20m -coverprofile=coverage.txt -covermode=atomic ./... loads-0.22.0/CODE_OF_CONDUCT.md000066400000000000000000000062411457312637400155130ustar00rootroot00000000000000# 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/ loads-0.22.0/LICENSE000066400000000000000000000261361457312637400137260ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. loads-0.22.0/README.md000066400000000000000000000014531457312637400141730ustar00rootroot00000000000000# Loads OAI specs [![Build Status](https://github.com/go-openapi/loads/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/loads/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/loads/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/loads) [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/loads/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/loads?status.svg)](http://godoc.org/github.com/go-openapi/loads) [![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/loads)](https://goreportcard.com/report/github.com/go-openapi/loads) Loading of OAI specification documents from local or remote locations. Supports JSON and YAML documents. loads-0.22.0/doc.go000066400000000000000000000014441457312637400140100ustar00rootroot00000000000000// 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 loads provides document loading methods for swagger (OAI) specifications. // // It is used by other go-openapi packages to load and run analysis on local or remote spec documents. package loads loads-0.22.0/doc_test.go000066400000000000000000000025271457312637400150520ustar00rootroot00000000000000package loads_test import ( "encoding/json" "fmt" "os" "path/filepath" "github.com/go-openapi/loads" "github.com/go-openapi/swag" ) func ExampleSpec() { // Example with default loaders defined at the package level path := "fixtures/yaml/swagger/spec.yml" doc, err := loads.Spec(path) if err != nil { fmt.Println("Could not load this spec") return } fmt.Printf("Spec loaded: %q\n", doc.Host()) // Output: Spec loaded: "api.example.com" } func ExampleLoaderOption() { // Example with custom loaders passed as options path := "fixtures/yaml/swagger/spec.yml" // a simpler version of loads.JSONDoc jsonLoader := loads.NewDocLoaderWithMatch( func(pth string) (json.RawMessage, error) { buf, err := os.ReadFile(pth) return json.RawMessage(buf), err }, func(pth string) bool { return filepath.Ext(pth) == ".json" }, ) // equivalent to the default loader at the package level, which does: // // loads.AddLoader(swag.YAMLMatcher, swag.YAMLDoc) yamlLoader := loads.NewDocLoaderWithMatch( swag.YAMLDoc, func(pth string) bool { return filepath.Ext(pth) == ".yml" }, ) doc, err := loads.Spec(path, loads.WithDocLoaderMatches(jsonLoader, yamlLoader)) if err != nil { fmt.Println("Could not load this spec") return } fmt.Printf("Spec loaded: %q\n", doc.Host()) // Output: Spec loaded: "api.example.com" } loads-0.22.0/example_test.go000066400000000000000000000000161457312637400157270ustar00rootroot00000000000000package loads loads-0.22.0/fixtures/000077500000000000000000000000001457312637400145625ustar00rootroot00000000000000loads-0.22.0/fixtures/bugs/000077500000000000000000000000001457312637400155225ustar00rootroot00000000000000loads-0.22.0/fixtures/bugs/145/000077500000000000000000000000001457312637400160335ustar00rootroot00000000000000loads-0.22.0/fixtures/bugs/145/Program Files (x86)/000077500000000000000000000000001457312637400212145ustar00rootroot00000000000000loads-0.22.0/fixtures/bugs/145/Program Files (x86)/AppName/000077500000000000000000000000001457312637400225355ustar00rootroot00000000000000loads-0.22.0/fixtures/bugs/145/Program Files (x86)/AppName/ref.json000066400000000000000000000004621457312637400242060ustar00rootroot00000000000000{ "definitions": { "todo-partial": { "title": "Todo Partial", "type": "object", "properties": { "name": { "type": "string" }, "completed": { "type": ["boolean", "null"] } }, "required": ["name", "completed"] } } } loads-0.22.0/fixtures/bugs/145/Program Files (x86)/AppName/todos-expanded.json000066400000000000000000000702531457312637400263550ustar00rootroot00000000000000{ "consumes": [ "application/json" ], "produces": [ "application/json" ], "schemes": [ "http" ], "swagger": "2.0", "info": { "description": "This OAS2 (Swagger 2) file represents a real API that lives at http://todos.stoplight.io.\n\nFor authentication information, click the apikey security scheme in the editor sidebar.", "title": "To-do Demo", "contact": { "name": "Stoplight", "url": "https://stoplight.io" }, "license": { "name": "MIT" }, "version": "1.0" }, "host": "todos.stoplight.io", "paths": { "/todos": { "get": { "description": "​", "tags": [ "Todos" ], "summary": "List Todos", "operationId": "GET_todos", "parameters": [ { "maximum": 100, "type": "integer", "description": "This is how it works.", "name": "limit", "in": "query" }, { "type": "string", "name": "skip", "in": "query" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "title": "Todo Full", "allOf": [ { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } }, { "type": "object", "required": [ "id", "user" ], "properties": { "completed_at": { "type": [ "string", "null" ], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "maximum": 1000000, "minimum": 0 }, "updated_at": { "type": "string", "format": "date-time" }, "user": { "type": "object", "title": "User", "required": [ "name", "age" ], "properties": { "age": { "type": "number", "maximum": 150, "minimum": 0 }, "error": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "name": { "description": "The user's full name.", "type": "string" } } } } } ] } }, "headers": { "foo": { "type": "string", "default": "bar" } }, "examples": { "application/json": [ { "completed": true, "id": 1, "name": "design the thingz" }, { "completed": true, "id": 2, "name": "mock the thingz" }, { "completed": false, "id": 3, "name": "code the thingz" } ], "empty": [] } }, "500": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Server Error", "status": "500" } } } } }, "post": { "security": [ { "API Key": [] }, { "Basic": [] } ], "description": "This creates a Todo object.\n\nTesting `inline code`.", "tags": [ "Todos" ], "summary": "Create Todo", "operationId": "POST_todos", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } } } ], "responses": { "201": { "description": "", "schema": { "title": "Todo Full", "allOf": [ { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } }, { "type": "object", "required": [ "id", "user" ], "properties": { "completed_at": { "type": [ "string", "null" ], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "maximum": 1000000, "minimum": 0 }, "updated_at": { "type": "string", "format": "date-time" }, "user": { "type": "object", "title": "User", "required": [ "name", "age" ], "properties": { "age": { "type": "number", "maximum": 150, "minimum": 0 }, "error": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "name": { "description": "The user's full name.", "type": "string" } } } } } ] }, "examples": { "/todos/chores": { "completed": false, "created_at": "2014-08-28T14:14:28.494Z", "id": 9000, "name": "Do Chores", "updated_at": "2014-08-28T14:14:28.494Z" }, "application/json": { "completed": null, "completed_at": null, "created_at": "2014-08-28T14:14:28.494Z", "id": 9000, "name": "It's Over 9000!!!", "updated_at": "2014-08-28T14:14:28.494Z" } } }, "401": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Not Authorized", "status": "401" } } }, "500": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Server Error", "status": "500" } } } } } }, "/todos/{todoId}": { "get": { "tags": [ "Todos" ], "summary": "Get Todo", "operationId": "GET_todo", "parameters": [ { "name": "todoId", "type": "string", "in": "query", "required": true } ], "responses": { "200": { "description": "", "schema": { "title": "Todo Full", "allOf": [ { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } }, { "type": "object", "required": [ "id", "user" ], "properties": { "completed_at": { "type": [ "string", "null" ], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "maximum": 1000000, "minimum": 0 }, "updated_at": { "type": "string", "format": "date-time" }, "user": { "type": "object", "title": "User", "required": [ "name", "age" ], "properties": { "age": { "type": "number", "maximum": 150, "minimum": 0 }, "error": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "name": { "description": "The user's full name.", "type": "string" } } } } } ] }, "examples": { "/todos/chores": { "completed": false, "created_at": "2014-08-28T14:14:28.494Z", "id": 9000, "name": "Do Chores", "updated_at": "2014-08-28T14:14:28.494Z" }, "/todos/foobar": "{\n\t\"foo\": \"bar\"\n}\n", "application/json": { "completed": false, "completed_at": "1955-04-23T13:22:52.685Z", "created_at": "1994-11-05T03:26:51.471Z", "id": 1, "name": "get food", "updated_at": "1989-07-29T11:30:06.701Z" }, "new": { "completed": null, "completed_at": "2014-01-07T07:49:55.123Z", "created_at": "1948-04-21T12:04:21.282Z", "float": -47990796.228164576, "id": 920778, "name": "esse qui proident labore", "updated_at": "1951-12-19T11:10:34.039Z", "user": { "age": 121.45395681110494, "name": "irure deserunt fugiat" } } } }, "404": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Not Found", "status": "404" } } }, "500": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Server Error", "status": "500" } } } } }, "put": { "security": [ { "Basic": [] }, { "API Key": [] } ], "tags": [ "Todos" ], "summary": "Update Todo", "operationId": "PUT_todos", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } } } ], "responses": { "200": { "description": "", "schema": { "title": "Todo Full", "allOf": [ { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } }, { "type": "object", "required": [ "id", "user" ], "properties": { "completed_at": { "type": [ "string", "null" ], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "maximum": 1000000, "minimum": 0 }, "updated_at": { "type": "string", "format": "date-time" }, "user": { "type": "object", "title": "User", "required": [ "name", "age" ], "properties": { "age": { "type": "number", "maximum": 150, "minimum": 0 }, "error": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "name": { "description": "The user's full name.", "type": "string" } } } } } ] }, "examples": { "application/json": { "completed": true, "completed_at": null, "created_at": "2014-08-28T14:14:28.494Z", "id": 9000, "name": "It's Over 9000!!!", "updated_at": "2015-08-28T14:14:28.494Z" } } }, "401": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Not Authorized", "status": "401" } } }, "404": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Not Found", "status": "404" } } }, "500": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Server Error", "status": "500" } } } } }, "delete": { "security": [ { "Basic": [] }, { "API Key": [] } ], "tags": [ "Todos" ], "summary": "Delete Todo", "operationId": "DELETE_todo", "responses": { "204": { "description": "" }, "401": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Not Authorized", "status": "401" } } }, "404": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Not Found", "status": "404" } } }, "500": { "description": "", "schema": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "examples": { "application/json": { "error": "Server Error", "status": "500" } } } } }, "parameters": [ { "type": "string", "name": "todoId", "in": "path", "required": true } ] } }, "definitions": { "todo-full": { "title": "Todo Full", "allOf": [ { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } }, { "type": "object", "required": [ "id", "user" ], "properties": { "completed_at": { "type": [ "string", "null" ], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "maximum": 1000000, "minimum": 0 }, "updated_at": { "type": "string", "format": "date-time" }, "user": { "type": "object", "title": "User", "required": [ "name", "age" ], "properties": { "age": { "type": "number", "maximum": 150, "minimum": 0 }, "error": { "type": "object", "title": "Error Response", "required": [ "status", "error" ], "properties": { "error": { "type": "string" }, "status": { "type": "string" } } }, "name": { "description": "The user's full name.", "type": "string" } } } } } ] }, "todo-partial": { "type": "object", "title": "Todo Partial", "required": [ "name", "completed" ], "properties": { "completed": { "type": [ "boolean", "null" ] }, "name": { "type": "string" } } } }, "parameters": { "limit": { "maximum": 100, "type": "integer", "description": "This is how it works.", "name": "limit", "in": "query" }, "skip": { "type": "string", "name": "skip", "in": "query" } }, "securityDefinitions": { "API Key": { "type": "apiKey", "name": "apikey", "in": "query" }, "Basic": { "type": "basic" } }, "tags": [ { "name": "Todos" } ] } loads-0.22.0/fixtures/bugs/145/Program Files (x86)/AppName/todos.common.json000066400000000000000000000045471457312637400260610ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "version": "1.0", "title": "To-do Demo", "description": "### Notes:\n\nThis OAS2 (Swagger 2) specification defines common models and responses, that other specifications may reference.\n\nFor example, check out the user poperty in the main.oas2 todo-partial model - it references the user model in this specification!\n\nLikewise, the main.oas2 operations reference the shared error responses in this common specification.", "contact": { "name": "Stoplight", "url": "https://stoplight.io" }, "license": { "name": "MIT" } }, "host": "example.com", "securityDefinitions": {}, "paths": {}, "responses": { "401": { "description": "", "schema": { "$ref": "#/definitions/error-response" }, "examples": { "application/json": { "status": "401", "error": "Not Authorized" } } }, "403": { "description": "", "schema": { "$ref": "#/definitions/error-response" }, "examples": { "application/json": { "status": "403", "error": "Forbbiden" } } }, "404": { "description": "", "schema": { "$ref": "#/definitions/error-response" }, "examples": { "application/json": { "status": "404", "error": "Not Found" } } }, "500": { "description": "", "schema": { "$ref": "#/definitions/error-response" }, "examples": { "application/json": { "status": "500", "error": "Server Error" } } } }, "definitions": { "user": { "title": "User", "type": "object", "properties": { "name": { "type": "string", "description": "The user's full name." }, "age": { "type": "number", "minimum": 0, "maximum": 150 }, "error": { "$ref": "#/definitions/error-response" } }, "required": ["name", "age"] }, "error-response": { "type": "object", "title": "Error Response", "properties": { "status": { "type": "string" }, "error": { "type": "string" } }, "required": ["status", "error"] } } } loads-0.22.0/fixtures/bugs/145/Program Files (x86)/AppName/todos.json000066400000000000000000000212431457312637400245620ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "version": "1.0", "title": "To-do Demo", "description": "This OAS2 (Swagger 2) file represents a real API that lives at http://todos.stoplight.io.\n\nFor authentication information, click the apikey security scheme in the editor sidebar.", "contact": { "name": "Stoplight", "url": "https://stoplight.io" }, "license": { "name": "MIT" } }, "host": "todos.stoplight.io", "schemes": ["http"], "consumes": ["application/json"], "produces": ["application/json"], "securityDefinitions": { "Basic": { "type": "basic" }, "API Key": { "type": "apiKey", "name": "apikey", "in": "query" } }, "paths": { "/todos/{todoId}": { "parameters": [{ "name": "todoId", "in": "path", "required": true, "type": "string" }], "get": { "operationId": "GET_todo", "summary": "Get Todo", "tags": ["Todos"], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/todo-full" }, "examples": { "application/json": { "id": 1, "name": "get food", "completed": false, "completed_at": "1955-04-23T13:22:52.685Z", "created_at": "1994-11-05T03:26:51.471Z", "updated_at": "1989-07-29T11:30:06.701Z" }, "/todos/foobar": "{\n\t\"foo\": \"bar\"\n}\n", "/todos/chores": { "id": 9000, "name": "Do Chores", "completed": false, "created_at": "2014-08-28T14:14:28.494Z", "updated_at": "2014-08-28T14:14:28.494Z" }, "new": { "name": "esse qui proident labore", "completed": null, "id": 920778, "completed_at": "2014-01-07T07:49:55.123Z", "created_at": "1948-04-21T12:04:21.282Z", "updated_at": "1951-12-19T11:10:34.039Z", "user": { "name": "irure deserunt fugiat", "age": 121.45395681110494 }, "float": -47990796.228164576 } } }, "404": { "$ref": "./todos.common.json#/responses/404" }, "500": { "$ref": "./todos.common.json#/responses/500" } }, "parameters": [{ "in": "query", "name": "", "type": "string" }] }, "put": { "operationId": "PUT_todos", "summary": "Update Todo", "tags": ["Todos"], "parameters": [{ "name": "body", "in": "body", "schema": { "$ref": "#/definitions/todo-partial", "example": { "name": "my todo's new name", "completed": false } } }], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/todo-full" }, "examples": { "application/json": { "id": 9000, "name": "It's Over 9000!!!", "completed": true, "completed_at": null, "created_at": "2014-08-28T14:14:28.494Z", "updated_at": "2015-08-28T14:14:28.494Z" } } }, "401": { "$ref": "./todos.common.json#/responses/401" }, "404": { "$ref": "./todos.common.json#/responses/404" }, "500": { "$ref": "./todos.common.json#/responses/500" } }, "security": [{ "Basic": [] }, { "API Key": [] } ] }, "delete": { "operationId": "DELETE_todo", "summary": "Delete Todo", "tags": ["Todos"], "responses": { "204": { "description": "" }, "401": { "$ref": "./todos.common.json#/responses/401" }, "404": { "$ref": "./todos.common.json#/responses/404" }, "500": { "$ref": "./todos.common.json#/responses/500" } }, "security": [{ "Basic": [] }, { "API Key": [] } ] } }, "/todos": { "post": { "operationId": "POST_todos", "summary": "Create Todo", "tags": ["Todos"], "parameters": [{ "name": "body", "in": "body", "schema": { "$ref": "#/definitions/todo-partial", "example": { "name": "my todo's name", "completed": false } } }], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/todo-full" }, "examples": { "application/json": { "id": 9000, "name": "It's Over 9000!!!", "completed": null, "completed_at": null, "created_at": "2014-08-28T14:14:28.494Z", "updated_at": "2014-08-28T14:14:28.494Z" }, "/todos/chores": { "id": 9000, "name": "Do Chores", "completed": false, "created_at": "2014-08-28T14:14:28.494Z", "updated_at": "2014-08-28T14:14:28.494Z" } } }, "401": { "$ref": "./todos.common.json#/responses/401" }, "500": { "$ref": "./todos.common.json#/responses/500" } }, "security": [{ "API Key": [] }, { "Basic": [] } ], "description": "This creates a Todo object.\n\nTesting `inline code`." }, "get": { "operationId": "GET_todos", "summary": "List Todos", "tags": ["Todos"], "parameters": [{ "$ref": "#/parameters/limit" }, { "$ref": "#/parameters/skip" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/todo-full" } }, "examples": { "application/json": [{ "id": 1, "name": "design the thingz", "completed": true }, { "id": 2, "name": "mock the thingz", "completed": true }, { "id": 3, "name": "code the thingz", "completed": false } ], "empty": [] }, "headers": { "foo": { "type": "string", "default": "bar" } } }, "500": { "$ref": "./todos.common.json#/responses/500" } }, "description": "​" } } }, "parameters": { "limit": { "name": "limit", "in": "query", "description": "This is how it works.", "required": false, "type": "integer", "maximum": 100 }, "skip": { "name": "skip", "in": "query", "required": false, "type": "string" } }, "definitions": { "todo-partial": { "$ref": "ref.json#/definitions/todo-partial" }, "todo-full": { "title": "Todo Full", "allOf": [{ "$ref": "#/definitions/todo-partial" }, { "type": "object", "properties": { "id": { "type": "integer", "minimum": 0, "maximum": 1000000 }, "completed_at": { "type": ["string", "null"], "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" }, "user": { "$ref": "./todos.common.json#/definitions/user" } }, "required": ["id", "user"] } ] } }, "tags": [{ "name": "Todos" }] } loads-0.22.0/fixtures/bugs/1816/000077500000000000000000000000001457312637400161215ustar00rootroot00000000000000loads-0.22.0/fixtures/bugs/1816/fixture-1816.yaml000066400000000000000000000345751457312637400211060ustar00rootroot00000000000000swagger: '2.0' info: version: "1.0.0" title: Service Manager schemes: - http produces: - application/vnd.cia.v1+json tags: - name: services basePath: /v1 paths: /services: parameters: - name: "X-Request-Id" in: "header" description: Unique identifier associated with request required: true type: string format: uuid get: tags: [services] operationId: searchServices summary: Search for Services description: | To apply filter criteria use the following approach: `?` Example: `?name=Test` parameters: - name: name in: query description: Search records by name required: false type: string minLength: 3 - name: version in: query description: Search records by version required: false type: string minLength: 3 - name: location in: query description: Search records by location required: false type: string minLength: 3 - name: region in: query description: Search records by region required: false type: string minLength: 3 responses: 200: description: List of Services headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: type: array items: $ref: "#/definitions/service_view" 400: $ref: "#/responses/400" 401: $ref: '#/responses/401' 403: $ref: '#/responses/403' default: $ref: '#/responses/500' /services/{serviceId}: parameters: - name: serviceId description: Unique identifier for Service in: path required: true type: string format: uuid - name: "X-Request-Id" in: "header" description: Unique identifier associated with request required: true type: string format: uuid get: tags: [services] operationId: viewService summary: View Service description: View Service responses: 200: description: Service headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/service_view" 400: $ref: "#/responses/400" 401: $ref: '#/responses/401' 403: $ref: '#/responses/403' 404: $ref: '#/responses/404' default: $ref: '#/responses/500' /services/{serviceId}/units: parameters: - name: serviceId description: Unique identifier for Service in: path required: true type: string format: uuid - name: "X-Request-Id" in: "header" description: Unique identifier associated with request required: true type: string format: uuid get: tags: [services] operationId: searchUnits summary: Search for Service Units description: | To apply filter criteria use the following approach: `?` Example: `?name=Test` parameters: - name: name in: query description: Search records by name required: false type: string minLength: 3 - name: type in: query description: Search records by type required: false type: string minLength: 3 responses: 200: description: List of Service Units headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: type: array items: $ref: "#/definitions/unit_view" 400: $ref: "#/responses/400" 401: $ref: '#/responses/401' 403: $ref: '#/responses/403' 404: $ref: '#/responses/404' default: $ref: '#/responses/500' /services/{serviceId}/units/{unitId}: parameters: - name: serviceId description: Unique identifier for Service in: path required: true type: string format: uuid - name: unitId description: Unique identifier for Service Unit in: path required: true type: string format: uuid - name: "X-Request-Id" in: "header" description: Unique identifier associated with request required: true type: string format: uuid get: tags: [services] operationId: viewUnit summary: View Service Unit description: View Service Unit responses: 200: description: Service Unit headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/unit_view" 400: $ref: "#/responses/400" 401: $ref: '#/responses/401' 403: $ref: '#/responses/403' 404: $ref: '#/responses/404' default: $ref: '#/responses/500' definitions: service_view: title: Service View description: An order-able Service defined in Service Catalog. type: object properties: id: title: Service Identifier description: unique identifier for the service type: string format: uuid example: 3377f6e7-dd55-4639-bc54-65646fde2adc name: title: Service Name description: name for the service type: string example: OpenStack Service version: title: Service Version description: labeled variant of the service type: string example: Newton tenant_id: title: Service Providers Tenant description: The Tenant identifier for the Tenant providing the service type: string format: uuid example: 3377f6e7-dd55-4639-bc54-65646fde2adc location: title: Service Location description: location of the service type: string example: ALLN region: title: Service Region description: region of the service type: string example: US-EAST status: title: Service Status description: status of the service type: string enum: [CREATING, ACTIVE, UPDATING, DELETING, INACTIVE, DELETED, FAILED] example: ACTIVE tags: title: Service Tags description: tags to identify service properties type: array items: type: string x-omitempty: true example: [LA, ALPHA] metadata: title: Service Metadata description: metadata of the service type: object additionalProperties: type: string audit: $ref: "#/definitions/audit" unit_view: title: Service Unit View description: A Service Unit for the Location defined in Service Catalog. type: object properties: id: title: Service Unit Identifier description: unique identifier for the service unit type: string format: uuid example: 3377f6e7-dd55-4639-bc54-65646fde2adc name: title: Service Unit Name description: name for the service unit type: string example: Example Service Unit type: title: Service Unit Type description: type of the service unit type: string example: VCPU description: title: Service Unit Description description: summary describing the service unit type: string example: Long description about the service unit cost: title: Service Unit Cost description: cost for the service unit type: number format: double example: 0.02 period: title: Service Unit Cost Period description: cost period for the service unit type: string enum: [FLAT, HOURLY, MONTHLY] example: HOURLY cost_algorithm: title: Service Unit Consumption Cost Algorithm description: consumption cost algorithm for the service unit type: string enum: [SIMPLE_SUM, DAILY_MAX_AVG] example: SIMPLE_SUM quotas: title: Service Unit Quotas description: quotas defined for the service unit type: object additionalProperties: $ref: '#/definitions/quota' activated_at: title: Service Unit Cost Activation Timestamp description: > service unit activation date (inclusive) as YYYY-MM-DD with respect to the billing period always as the start of the billing period type: string example: 2018-02-01 deactivated_at: title: Service Unit Cost Deactivation Timestamp description: > service unit deactivation date (exclusive) as YYYY-MM-DD with respect to the billing period - omitted if empty or the end of the billing period type: string example: 2018-03-01 audit: $ref: "#/definitions/audit" quota: title: Service Unit Quota description: quota details with values type: object properties: min: title: Minimum quota value type: number format: double minimum: 0.0 example: 1.0 max: title: Maximum quota value type: number format: double minimum: 0.0 example: 1.0 default: title: Default quota value type: number format: double minimum: 0.0 example: 1.0 audit: title: Audit description: Audit trail details type: object properties: created_at: title: Created At description: timestamp when the record was created type: string format: date-time readOnly: true created_by: title: Created By description: entity that created the record type: string readOnly: true updated_at: title: Updated At description: timestamp when the record was updated type: string format: date-time readOnly: true updated_by: title: Updated By description: entity that updated the record type: string readOnly: true error: title: Error description: | An error provides information about why the request failed. type: object required: - code - message properties: code: title: Code description: | Code identifies a specific type of error. type: string message: title: Message description: | The message provides details about the failure. type: string responses: 400: description: | Invalid Request Error. Check error message in the response body for details. examples: application/json: code: EXAMPLE-001 message: Missing required attribute 'name'. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 401: description: | Authentication Failure examples: application/json: code: EXAMPLE-002 message: Authentication failed bad password. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 402: description: | Insufficient Funds examples: application/json: code: EXAMPLE-003 message: Insufficient Funds to cover the cost of resource. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 403: description: | Authorization Failure examples: application/json: code: EXAMPLE-004 message: Not authorized to perform action. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 404: description: | Resource not found examples: application/json: code: EXAMPLE-005 message: Resource does not exist. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 409: description: | Conflict examples: application/json: code: EXAMPLE-006 message: Resource already exists. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 422: description: | Unprocessable Entity Failure examples: application/json: code: EXAMPLE-007 message: Resource is not able to be updated. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 500: description: | Internal Server Error. Check error entity in the response body for details. examples: application/json: code: EXAMPLE-009 message: Internal server error. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" 503: description: | Service Unavailable examples: application/json: code: EXAMPLE-010 message: Service Unavailable. headers: X-Request-Id: description: Unique identifier associated with request type: string format: uuid schema: $ref: "#/definitions/error" loads-0.22.0/fixtures/json/000077500000000000000000000000001457312637400155335ustar00rootroot00000000000000loads-0.22.0/fixtures/json/models/000077500000000000000000000000001457312637400170165ustar00rootroot00000000000000loads-0.22.0/fixtures/json/models/modelWithArrayRef.json000066400000000000000000000003351457312637400233020ustar00rootroot00000000000000{ "required": [ "id" ], "properties": { "id": { "type": "integer", "format": "int64" }, "children": { "type": "array", "items": { "$ref": "Person" } } } } loads-0.22.0/fixtures/json/models/modelWithComposition.json000066400000000000000000000031051457312637400240700ustar00rootroot00000000000000{ "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" ] } } } loads-0.22.0/fixtures/json/models/modelWithDateTimeMap.json000066400000000000000000000001541457312637400237200ustar00rootroot00000000000000{ "description": "true", "additionalProperties": { "type": "string", "format": "date-time" } }loads-0.22.0/fixtures/json/models/modelWithExamples.json000066400000000000000000000006271457312637400233510ustar00rootroot00000000000000{ "definitions": { "Pet": { "properties": { "name": { "type": "string" } }, "required": [ "name" ] }, "Dog": { "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, "required": [ "name" ] } } }loads-0.22.0/fixtures/json/models/modelWithInt32Map.json000066400000000000000000000002041457312637400231170ustar00rootroot00000000000000{ "description": "This is a Map[String, Integer]", "additionalProperties": { "type": "integer", "format": "int32" } } loads-0.22.0/fixtures/json/models/modelWithInt64Map.json000066400000000000000000000001511457312637400231250ustar00rootroot00000000000000{ "description": "true", "additionalProperties": { "type": "integer", "format": "int64" } }loads-0.22.0/fixtures/json/models/modelWithMultipleProperties.json000066400000000000000000000022711457312637400254400ustar00rootroot00000000000000{ "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" } } } }loads-0.22.0/fixtures/json/models/modelWithObjectMap.json000066400000000000000000000004261457312637400234340ustar00rootroot00000000000000{ "description": "This is a Map[String, { id: Long, name: String}]", "additionalProperties": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } } } loads-0.22.0/fixtures/json/models/modelWithPrimitiveArray.json000066400000000000000000000003751457312637400245420ustar00rootroot00000000000000{ "required": [ "id" ], "properties": { "id": { "type": "integer", "format": "int64" }, "childrensAges": { "type": "array", "items": { "type": "integer", "format": "int32" } } } }loads-0.22.0/fixtures/json/models/modelWithStringProperty.json000066400000000000000000000001351457312637400246000ustar00rootroot00000000000000{ "description": "true", "properties": { "name": { "type": "string" } } }loads-0.22.0/fixtures/json/models/modelWithXmlAttributes.json000066400000000000000000000006701457312637400244000ustar00rootroot00000000000000{ "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 } } } }loads-0.22.0/fixtures/json/models/models.json000066400000000000000000000002561457312637400211770ustar00rootroot00000000000000{ "definitions": { "Pet": { "properties": { "name": { "type": "string" } }, "required": [ "name" ] } } }loads-0.22.0/fixtures/json/models/multipleModels.json000066400000000000000000000006271457312637400227150ustar00rootroot00000000000000{ "definitions": { "Pet": { "properties": { "name": { "type": "string" } }, "required": [ "name" ] }, "Dog": { "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, "required": [ "name" ] } } }loads-0.22.0/fixtures/json/models/properties/000077500000000000000000000000001457312637400212125ustar00rootroot00000000000000loads-0.22.0/fixtures/json/models/properties/propertyWithBooleanArray.json000066400000000000000000000000751457312637400271260ustar00rootroot00000000000000{ "type": "array", "items": { "type": "boolean" } }loads-0.22.0/fixtures/json/models/properties/propertyWithByteArray.json000066400000000000000000000001221457312637400264430ustar00rootroot00000000000000{ "type": "array", "items": { "type": "string", "format": "byte" } }loads-0.22.0/fixtures/json/models/properties/propertyWithComplexArray.json000066400000000000000000000001011457312637400271440ustar00rootroot00000000000000{ "type": "array", "items": { "$ref": "ComplexType" } }loads-0.22.0/fixtures/json/models/properties/propertyWithDateTimeArray.json000066400000000000000000000001271457312637400272410ustar00rootroot00000000000000{ "type": "array", "items": { "type": "string", "format": "date-time" } }loads-0.22.0/fixtures/json/models/properties/propertyWithInt32Array.json000066400000000000000000000001241457312637400264410ustar00rootroot00000000000000{ "type": "array", "items": { "type": "integer", "format": "int32" } }loads-0.22.0/fixtures/json/models/properties/propertyWithInt64Array.json000066400000000000000000000001241457312637400264460ustar00rootroot00000000000000{ "type": "array", "items": { "type": "integer", "format": "int64" } }loads-0.22.0/fixtures/json/models/properties/propertyWithRef.json000066400000000000000000000001051457312637400252560ustar00rootroot00000000000000{ "$ref": "Foo", "description": "a boolean", "readOnly": true }loads-0.22.0/fixtures/json/models/properties/propertyWithStringArray.json000066400000000000000000000000741457312637400270140ustar00rootroot00000000000000{ "type": "array", "items": { "type": "string" } }loads-0.22.0/fixtures/json/models/properties/simpleBooleanProperty.json000066400000000000000000000001121457312637400264350ustar00rootroot00000000000000{ "type": "boolean", "description": "a boolean", "readOnly": true } loads-0.22.0/fixtures/json/models/properties/simpleByteProperty.json000066400000000000000000000000521457312637400257640ustar00rootroot00000000000000{ "type": "string", "format": "byte" }loads-0.22.0/fixtures/json/models/properties/simpleDateTimeProperty.json000066400000000000000000000000571457312637400265620ustar00rootroot00000000000000{ "type": "string", "format": "date-time" }loads-0.22.0/fixtures/json/models/properties/simpleInt32Property.json000066400000000000000000000000541457312637400257620ustar00rootroot00000000000000{ "type": "integer", "format": "int32" }loads-0.22.0/fixtures/json/models/properties/simpleInt64Property.json000066400000000000000000000000541457312637400257670ustar00rootroot00000000000000{ "type": "integer", "format": "int64" }loads-0.22.0/fixtures/json/models/properties/simpleStringProperty.json000066400000000000000000000000271457312637400263310ustar00rootroot00000000000000{ "type": "string" } loads-0.22.0/fixtures/json/resources/000077500000000000000000000000001457312637400175455ustar00rootroot00000000000000loads-0.22.0/fixtures/json/resources/cascadingSchemes.json000066400000000000000000000042001457312637400236600ustar00rootroot00000000000000{ "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" } } } } } loads-0.22.0/fixtures/json/resources/commonParameters.json000066400000000000000000000041701457312637400237560ustar00rootroot00000000000000{ "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" } } } } } loads-0.22.0/fixtures/json/resources/multipleMimeTypes.json000066400000000000000000000047321457312637400241360ustar00rootroot00000000000000{ "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" } } } } } loads-0.22.0/fixtures/json/resources/operations/000077500000000000000000000000001457312637400217305ustar00rootroot00000000000000loads-0.22.0/fixtures/json/resources/operations/operationWithTags.json000066400000000000000000000011771457312637400263040ustar00rootroot00000000000000{ "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"} } } }loads-0.22.0/fixtures/json/resources/operations/stringPathAndBoolQueryParamResource.json000066400000000000000000000014121457312637400317220ustar00rootroot00000000000000{ "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"} } } }loads-0.22.0/fixtures/json/resources/operations/stringPathParamResource.json000066400000000000000000000013261457312637400274410ustar00rootroot00000000000000{ "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"} } } }loads-0.22.0/fixtures/json/resources/parameters/000077500000000000000000000000001457312637400217105ustar00rootroot00000000000000loads-0.22.0/fixtures/json/resources/parameters/bodyComplexArrayParameter.json000066400000000000000000000003171457312637400277310ustar00rootroot00000000000000{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "type": "array", "items": { "type": "string" }, "format": "csv" } }loads-0.22.0/fixtures/json/resources/parameters/bodyComplexParameter.json000066400000000000000000000002141457312637400267260ustar00rootroot00000000000000{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "$ref": "User" } }loads-0.22.0/fixtures/json/resources/parameters/bodyInt64Parameter.json000066400000000000000000000002241457312637400262240ustar00rootroot00000000000000{ "name": "id", "in": "body", "description": "id to add", "required": true, "schema": { "type": "integer", "format": "int64" } }loads-0.22.0/fixtures/json/resources/parameters/bodyStringArrayParameter.json000066400000000000000000000002761457312637400275740ustar00rootroot00000000000000{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "type": "array", "items": { "type": "string" } } }loads-0.22.0/fixtures/json/resources/parameters/bodyStringParameter.json000066400000000000000000000002161457312637400265670ustar00rootroot00000000000000{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "type": "string" } }loads-0.22.0/fixtures/json/resources/parameters/formDataComplexParameter.json000066400000000000000000000001731457312637400275320ustar00rootroot00000000000000{ "name": "firstName", "in": "formData", "description": "users first name", "required": true, "$ref": "Nothing" }loads-0.22.0/fixtures/json/resources/parameters/formDataInt64Parameter.json000066400000000000000000000002121457312637400270210ustar00rootroot00000000000000{ "name": "id", "in": "formData", "description": "username to fetch", "required": true, "type": "integer", "format": "int64" }loads-0.22.0/fixtures/json/resources/parameters/formDataStringArrayParameter.json000066400000000000000000000002441457312637400303670ustar00rootroot00000000000000{ "name": "user", "in": "formData", "description": "user to add to the system", "required": true, "type": "array", "items": { "type": "string" } }loads-0.22.0/fixtures/json/resources/parameters/formDataStringParameter.json000066400000000000000000000001721457312637400273700ustar00rootroot00000000000000{ "name": "firstName", "in": "formData", "description": "users first name", "required": true, "type": "string" }loads-0.22.0/fixtures/json/resources/parameters/headerInt64ArrayParameter.json000066400000000000000000000003411457312637400275160ustar00rootroot00000000000000{ "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "type": "array", "items": { "type": "integer", "format": "int64" }, "collectionFormat": "csv" }loads-0.22.0/fixtures/json/resources/parameters/headerStringArrayParameter.json000066400000000000000000000003111457312637400300550ustar00rootroot00000000000000{ "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" }loads-0.22.0/fixtures/json/resources/parameters/headerStringParameter.json000066400000000000000000000002021457312637400270550ustar00rootroot00000000000000{ "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "type": "string" }loads-0.22.0/fixtures/json/resources/parameters/pathInt64Parameter.json000066400000000000000000000002121457312637400262200ustar00rootroot00000000000000{ "name": "id", "in": "path", "description": "username to fetch", "required": true, "type": "integer", "format": "int64" }loads-0.22.0/fixtures/json/resources/parameters/pathStringArrayParameter.json000066400000000000000000000002761457312637400275730ustar00rootroot00000000000000{ "name": "usernames", "in": "path", "description": "usernames to pass", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" }loads-0.22.0/fixtures/json/resources/parameters/pathStringParameter.json000066400000000000000000000001661457312637400265720ustar00rootroot00000000000000{ "name": "username", "in": "path", "description": "username to fetch", "required": true, "type": "string" }loads-0.22.0/fixtures/json/resources/parameters/queryInt64ArrayParameter.json000066400000000000000000000003301457312637400274310ustar00rootroot00000000000000{ "name": "id", "in": "query", "description": "ID of the object to fetch", "required": true, "type": "array", "items": { "type": "integer", "format": "int64" }, "collectionFormat": "csv" }loads-0.22.0/fixtures/json/resources/parameters/queryStringParameter.json000066400000000000000000000002171457312637400270000ustar00rootroot00000000000000{ "name": "id", "in": "query", "description": "ID of the object to fetch", "required": true, "type": "integer", "format": "int64" }loads-0.22.0/fixtures/json/resources/parameters/queryWithComplexParameter.json000066400000000000000000000002331457312637400277730ustar00rootroot00000000000000{ "name": "id", "in": "query", "description": "a complex object which should not validate", "required": true, "schema": { "$ref": "Pet" } }loads-0.22.0/fixtures/json/resources/pathLoaderIssue.json000066400000000000000000000025301457312637400235340ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "title": "PartSearch Api", "description": "Search for Parts", "version": "v3" }, "host": "api.example.com", "paths": { "\/Products\/Keyword": { "post": { "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "in": "body", "name": "body", "description": "KeywordSearchRequest", "schema": { "$ref" : "#/definitions/KeywordSearchRequest" } } ], "responses": { "200": { "description": "Success", "schema": { "description":"bla", "type": "string" } } } } } }, "definitions": { "KeywordSearchRequest": { "description": "Keyword Search Request object", "type": "string" }, "KeywordSearchResponse": { "description": "Response model for a keyword search request.", "type": "string" } } } loads-0.22.0/fixtures/json/resources/resourceWithExamplePayload.json000066400000000000000000000050521457312637400257530ustar00rootroot00000000000000{ "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" }, "examples": { "application/json": { "id": 9, "category": { "name": "domestic" }, "name": "monster", "tags": [ { "name": "for sale" } ], "status": "alive" } } }, "default": { "description": "error payload", "schema": { "$ref": "ErrorModel" } } } } } }, "definitions": { "Pet": { "required": [ "name" ], "properties": { "name": { "type": "string", "example": "cat" }, "tag": { "type": "string", "example": "for sale" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } loads-0.22.0/fixtures/json/resources/resourceWithLinkedDefinitions.json000066400000000000000000000025511457312637400264510ustar00rootroot00000000000000{ "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}": { "$ref": "https://raw.githubusercontent.com/reverb/swagger-spec/master/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json" } }, "definitions": { "Pet": { "required": [ "name" ], "properties": { "name": { "type": "string" }, "tag": { "type": "string" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } loads-0.22.0/fixtures/json/resources/resourceWithLinkedDefinitions_part1.json000066400000000000000000000013751457312637400275630ustar00rootroot00000000000000{ "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" } } } } }loads-0.22.0/fixtures/json/resources/resourceWithRelativeHost.json000066400000000000000000000041401457312637400254540ustar00rootroot00000000000000{ "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/" } }, "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" } } } } } loads-0.22.0/fixtures/json/resources/reusableParameters.json000066400000000000000000000044161457312637400242730ustar00rootroot00000000000000{ "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}": { "get": { "description": "Returns pets based on ID", "summary": "Find pets by ID", "operationId": "getPetsById", "parameters": [ { "$ref": "#/parameters/skipParam" }, { "$ref": "#/parameters/limitParam" } ], "responses": { "200": { "description": "pet response", "schema": { "type": "array", "items": { "$ref": "Pet" } } }, "default": { "description": "error payload", "schema": { "$ref": "ErrorModel" } } } } } }, "parameters": { "skipParam": { "name": "skip", "in": "query", "description": "number of items to skip", "required": true, "type": "integer", "format": "int32" }, "limitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "type": "integer", "format": "int32" } }, "definitions": { "Pet": { "required": [ "name" ], "properties": { "name": { "type": "string" }, "tag": { "type": "string" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } loads-0.22.0/fixtures/json/resources/securityExample.json000066400000000000000000000157501457312637400236330ustar00rootroot00000000000000{ "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/" } }, "basePath": "/v1", "schemes": [ "http", "https" ], "consumes": [ "application/json" ], "produces": [ "application/json", "application/xml" ], "security": [ { "githubAccessCode": [ "user", "gist" ] }, { "internalApiKey": [] } ], "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", "security": [ { "githubAuth":[ "user:read", "user:write" ] }, { "internalApiKey": [] } ], "produces": [ "application/json", "text/html" ], "responses": { "200": { "description": "pet response", "schema": { "type": "array", "items": { "$ref": "Pet" } } }, "default": { "description": "error payload", "schema": { "$ref": "ErrorModel" } } } } } }, "securityDefinitions": { "githubAccessCode": { "type": "oauth2", "scopes": { "user": "Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.", "user:email": "Grants read access to a user’s email addresses.", "user:follow": "Grants access to follow or unfollow other users.", "public_repo": "Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.", "repo": "Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.", "repo_deployment": "Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.", "repo:status": "Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.", "delete_repo": "Grants access to delete adminable repositories.", "notifications": "Grants read access to a user’s notifications. repo also provides this access.", "gist": "Grants write access to gists.", "read:repo_hook": "Grants read and ping access to hooks in public or private repositories.", "write:repo_hook": "Grants read, write, and ping access to hooks in public or private repositories.", "admin:repo_hook": "Grants read, write, ping, and delete access to hooks in public or private repositories.", "read:org": "Read-only access to organization, teams, and membership.", "write:org": "Publicize and unpublicize organization membership.", "admin:org": "Fully manage organization, teams, and memberships.", "read:public_key": "List and view details for public keys.", "write:public_key": "Create, list, and view details for public keys.", "admin:public_key": "Fully manage public keys." }, "flow": "accessCode", "authorizationUrl": "https://github.com/login/oauth/authorize", "tokenUrl": "https://github.com/login/oauth/access_token" }, "petstoreImplicit": { "type": "oauth2", "scopes": { "user": "Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.", "user:email": "Grants read access to a user’s email addresses.", "user:follow": "Grants access to follow or unfollow other users.", "public_repo": "Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.", "repo": "Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.", "repo_deployment": "Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.", "repo:status": "Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.", "delete_repo": "Grants access to delete adminable repositories.", "notifications": "Grants read access to a user’s notifications. repo also provides this access.", "gist": "Grants write access to gists.", "read:repo_hook": "Grants read and ping access to hooks in public or private repositories.", "write:repo_hook": "Grants read, write, and ping access to hooks in public or private repositories.", "admin:repo_hook": "Grants read, write, ping, and delete access to hooks in public or private repositories.", "read:org": "Read-only access to organization, teams, and membership.", "write:org": "Publicize and unpublicize organization membership.", "admin:org": "Fully manage organization, teams, and memberships.", "read:public_key": "List and view details for public keys.", "write:public_key": "Create, list, and view details for public keys.", "admin:public_key": "Fully manage public keys." }, "flow": "implicit", "authorizationUrl": "http://petstore.swagger.wordnik.com/oauth/dialog" }, "internalApiKey": { "type": "apiKey", "in": "header", "name": "api_key" } }, "definitions": { "Pet": { "required": [ "name" ], "properties": { "name": { "type": "string" }, "tag": { "type": "string" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } }loads-0.22.0/fixtures/json/resources/stringPathParamResource.json000066400000000000000000000041401457312637400252530ustar00rootroot00000000000000{ "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" } } } } } }, "definitions": { "Pet": { "required": [ "name" ], "properties": { "name": { "type": "string" }, "tag": { "type": "string" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } loads-0.22.0/fixtures/json/resources/taggedResource.json000066400000000000000000000047441457312637400234140ustar00rootroot00000000000000{ "swagger": "2.0", "x-reverb": { "addAnythingYouWant": true }, "info": { "x-reverb-info": "this is an example", "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" ], "tags": [ { "name": "pets" } ], "paths": { "x-reverb-path-info": "vendor info", "/pets": { "x-vendor-method": {}, "get": { "x-vendor-operation-property": {}, "description": "Returns a pet based on ID", "summary": "Find pet by ID", "operationId": "getPetsById", "produces": [ "application/json", "text/html" ], "parameters": [ { "x-vendor-parameter-property": {}, "name": "petId", "in": "path", "description": "ID of pet that needs to be fetched", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" } ], "responses": { "x-vendor-operation-response-property": {}, "200": { "description": "pet response", "schema": { "$ref": "Pet" } }, "default": { "description": "error payload", "schema": { "$ref": "ErrorModel" } } } } } }, "definitions": { "Pet": { "x-vendor-model-property": {}, "required": [ "name" ], "properties": { "name": { "type": "string" }, "tag": { "type": "string" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } loads-0.22.0/fixtures/json/resources/vendorExtensionExamples.json000066400000000000000000000046621457312637400253410ustar00rootroot00000000000000{ "swagger": "2.0", "x-reverb": { "addAnythingYouWant": true }, "info": { "x-reverb-info": "this is an example", "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": { "x-reverb-path-info": "vendor info", "/pets": { "x-vendor-method": {}, "get": { "x-vendor-operation-property": {}, "description": "Returns a pet based on ID", "summary": "Find pet by ID", "operationId": "getPetsById", "produces": [ "application/json", "text/html" ], "parameters": [ { "x-vendor-parameter-property": {}, "name": "petId", "in": "path", "description": "ID of pet that needs to be fetched", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" } ], "responses": { "x-vendor-operation-response-property": {}, "200": { "description": "pet response", "schema": { "$ref": "Pet" } }, "default": { "description": "error payload", "schema": { "$ref": "ErrorModel" } } } } } }, "definitions": { "Pet": { "x-vendor-model-property": {}, "required": [ "name" ], "properties": { "name": { "type": "string" }, "tag": { "type": "string" } } }, "ErrorModel": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } loads-0.22.0/fixtures/json/responses/000077500000000000000000000000001457312637400175545ustar00rootroot00000000000000loads-0.22.0/fixtures/json/responses/complexArrayResponse.json000066400000000000000000000002231457312637400246310ustar00rootroot00000000000000{ "description": "A complex object array response", "schema": { "type": "array", "items": { "$ref": "VeryComplexType" } } }loads-0.22.0/fixtures/json/responses/dateTimeResponse.json000066400000000000000000000001561457312637400237240ustar00rootroot00000000000000{ "description": "A date-time response", "schema": { "type": "string", "format": "date-time" } }loads-0.22.0/fixtures/json/responses/int32Response.json000066400000000000000000000001571457312637400231300ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "integer", "format": "int32" } }loads-0.22.0/fixtures/json/responses/int64Response.json000066400000000000000000000001571457312637400231350ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "integer", "format": "int64" } }loads-0.22.0/fixtures/json/responses/multipleResponses.json000066400000000000000000000004261457312637400242060ustar00rootroot00000000000000{ "200": { "description": "simple string response", "schema": { "type": "string" } }, "201": { "description": "object created" }, "default": { "description": "oops", "schema": { "type": "integer", "format": "int32" } } }loads-0.22.0/fixtures/json/responses/stringArrayResponse.json000066400000000000000000000002021457312637400244650ustar00rootroot00000000000000{ "description": "A string array response", "schema": { "type": "array", "items": { "type": "string" } } }loads-0.22.0/fixtures/json/responses/stringResponse.json000066400000000000000000000001271457312637400234740ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "string" } }loads-0.22.0/fixtures/json/responses/stringResponseWithHeader.json000066400000000000000000000002611457312637400254400ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "string" }, "headers": { "is-dog": {"type": "boolean"}, "is-cat": {"type": "boolean"} } } loads-0.22.0/fixtures/json/responses/voidResponse.json000066400000000000000000000000451457312637400231260ustar00rootroot00000000000000{ "description": "object created" }loads-0.22.0/fixtures/yaml/000077500000000000000000000000001457312637400155245ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/.gitkeep000066400000000000000000000000001457312637400171430ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/models/000077500000000000000000000000001457312637400170075ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/models/modelWithArrayRef.yaml000066400000000000000000000001631457312637400232630ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} children: {type: array, items: {$ref: Person}} loads-0.22.0/fixtures/yaml/models/modelWithComposition.yaml000066400000000000000000000014641457312637400240600ustar00rootroot00000000000000definitions: 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}}, required: [name, packSize]}]} Fish: {description: 'A representation of a fish', allOf: [{$ref: '#/models/Pet'}, {properties: {fins: {type: integer, format: int32, description: 'count of fins'}}, required: [fins]}]} Pet: {discriminator: petType, properties: {name: {type: string}, petType: {type: string}}, required: [name, petType]} loads-0.22.0/fixtures/yaml/models/modelWithDateTimeMap.yaml000066400000000000000000000001151457312637400236770ustar00rootroot00000000000000description: 'true' additionalProperties: type: string format: date-time loads-0.22.0/fixtures/yaml/models/modelWithExamples.yaml000066400000000000000000000002551457312637400233300ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} loads-0.22.0/fixtures/yaml/models/modelWithInt32Map.yaml000066400000000000000000000001441457312637400231040ustar00rootroot00000000000000description: 'This is a Map[String, Integer]' additionalProperties: type: integer format: int32 loads-0.22.0/fixtures/yaml/models/modelWithInt64Map.yaml000066400000000000000000000001121457312637400231040ustar00rootroot00000000000000description: 'true' additionalProperties: type: integer format: int64 loads-0.22.0/fixtures/yaml/models/modelWithMultipleProperties.yaml000066400000000000000000000012541457312637400254220ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/models/modelWithObjectMap.yaml000066400000000000000000000003101457312637400234060ustar00rootroot00000000000000description: "This is a Map[String, { id: Long, name: String}]" additionalProperties: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" loads-0.22.0/fixtures/yaml/models/modelWithPrimitiveArray.yaml000066400000000000000000000002101457312637400245100ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} childrensAges: {type: array, items: {type: integer, format: int32}} loads-0.22.0/fixtures/yaml/models/modelWithStringProperty.yaml000066400000000000000000000000671457312637400245660ustar00rootroot00000000000000description: 'true' properties: name: {type: string} loads-0.22.0/fixtures/yaml/models/modelWithXmlAttributes.yaml000066400000000000000000000003721457312637400243610ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/models/models.yaml000066400000000000000000000001131457312637400211510ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} loads-0.22.0/fixtures/yaml/models/multipleModels.yaml000066400000000000000000000002551457312637400226740ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} loads-0.22.0/fixtures/yaml/models/properties/000077500000000000000000000000001457312637400212035ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/models/properties/propertyWithBooleanArray.yaml000066400000000000000000000000431457312637400271030ustar00rootroot00000000000000type: array items: type: boolean loads-0.22.0/fixtures/yaml/models/properties/propertyWithByteArray.yaml000066400000000000000000000000611457312637400264270ustar00rootroot00000000000000type: array items: type: string format: byte loads-0.22.0/fixtures/yaml/models/properties/propertyWithComplexArray.yaml000066400000000000000000000000471457312637400271370ustar00rootroot00000000000000type: array items: $ref: ComplexType loads-0.22.0/fixtures/yaml/models/properties/propertyWithDateTimeArray.yaml000066400000000000000000000000661457312637400272250ustar00rootroot00000000000000type: array items: type: string format: date-time loads-0.22.0/fixtures/yaml/models/properties/propertyWithInt32Array.yaml000066400000000000000000000000631457312637400264250ustar00rootroot00000000000000type: array items: type: integer format: int32 loads-0.22.0/fixtures/yaml/models/properties/propertyWithInt64Array.yaml000066400000000000000000000000631457312637400264320ustar00rootroot00000000000000type: array items: type: integer format: int64 loads-0.22.0/fixtures/yaml/models/properties/propertyWithRef.yaml000066400000000000000000000000621457312637400252420ustar00rootroot00000000000000$ref: Foo description: 'a boolean' readOnly: true loads-0.22.0/fixtures/yaml/models/properties/propertyWithStringArray.yaml000066400000000000000000000000421457312637400267710ustar00rootroot00000000000000type: array items: type: string loads-0.22.0/fixtures/yaml/models/properties/simpleBooleanProperty.yaml000066400000000000000000000000661457312637400264270ustar00rootroot00000000000000type: boolean description: 'a boolean' readOnly: true loads-0.22.0/fixtures/yaml/models/properties/simpleByteProperty.yaml000066400000000000000000000000321457312637400257440ustar00rootroot00000000000000type: string format: byte loads-0.22.0/fixtures/yaml/models/properties/simpleDateTimeProperty.yaml000066400000000000000000000000371457312637400265420ustar00rootroot00000000000000type: string format: date-time loads-0.22.0/fixtures/yaml/models/properties/simpleInt32Property.yaml000066400000000000000000000000341457312637400257420ustar00rootroot00000000000000type: integer format: int32 loads-0.22.0/fixtures/yaml/models/properties/simpleInt64Property.yaml000066400000000000000000000000341457312637400257470ustar00rootroot00000000000000type: integer format: int64 loads-0.22.0/fixtures/yaml/models/properties/simpleStringProperty.yaml000066400000000000000000000000151457312637400263100ustar00rootroot00000000000000type: string loads-0.22.0/fixtures/yaml/resources/000077500000000000000000000000001457312637400175365ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/resources/cascadingSchemes.yaml000066400000000000000000000023761457312637400236560ustar00rootroot00000000000000swagger: '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}}} loads-0.22.0/fixtures/yaml/resources/commonParameters.yaml000066400000000000000000000023521457312637400237400ustar00rootroot00000000000000swagger: '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}}} loads-0.22.0/fixtures/yaml/resources/multipleMimeTypes.yaml000066400000000000000000000030631457312637400241140ustar00rootroot00000000000000swagger: '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}}} loads-0.22.0/fixtures/yaml/resources/operations/000077500000000000000000000000001457312637400217215ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/resources/operations/operationWithTags.yaml000066400000000000000000000007001457312637400262550ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/resources/operations/stringPathAndBoolQueryParamResource.yaml000066400000000000000000000010331457312637400317030ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/resources/operations/stringPathParamResource.yaml000066400000000000000000000010051457312637400274150ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/resources/parameters/000077500000000000000000000000001457312637400217015ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/resources/parameters/bodyComplexArrayParameter.yaml000066400000000000000000000002101457312637400277030ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} format: csv loads-0.22.0/fixtures/yaml/resources/parameters/bodyComplexParameter.yaml000066400000000000000000000001411457312637400267070ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: $ref: User loads-0.22.0/fixtures/yaml/resources/parameters/bodyInt64Parameter.yaml000066400000000000000000000001421457312637400262050ustar00rootroot00000000000000name: id in: body description: 'id to add' required: true schema: type: integer format: int64 loads-0.22.0/fixtures/yaml/resources/parameters/bodyStringArrayParameter.yaml000066400000000000000000000001721457312637400275510ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} loads-0.22.0/fixtures/yaml/resources/parameters/bodyStringParameter.yaml000066400000000000000000000001431457312637400265500ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: string loads-0.22.0/fixtures/yaml/resources/parameters/formDataComplexParameter.yaml000066400000000000000000000001321457312637400275070ustar00rootroot00000000000000name: firstName in: formData description: 'users first name' required: true $ref: Nothing loads-0.22.0/fixtures/yaml/resources/parameters/formDataInt64Parameter.yaml000066400000000000000000000001421457312637400270050ustar00rootroot00000000000000name: id in: formData description: 'username to fetch' required: true type: integer format: int64 loads-0.22.0/fixtures/yaml/resources/parameters/formDataStringArrayParameter.yaml000066400000000000000000000001621457312637400303500ustar00rootroot00000000000000name: user in: formData description: 'user to add to the system' required: true type: array items: type: string loads-0.22.0/fixtures/yaml/resources/parameters/formDataStringParameter.yaml000066400000000000000000000001311457312637400273450ustar00rootroot00000000000000name: firstName in: formData description: 'users first name' required: true type: string loads-0.22.0/fixtures/yaml/resources/parameters/headerInt64ArrayParameter.yaml000066400000000000000000000002351457312637400275020ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: array items: type: integer format: int64 collectionFormat: csv loads-0.22.0/fixtures/yaml/resources/parameters/headerStringArrayParameter.yaml000066400000000000000000000002141457312637400300410ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: array items: type: string collectionFormat: csv loads-0.22.0/fixtures/yaml/resources/parameters/headerStringParameter.yaml000066400000000000000000000001411457312637400270410ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: string loads-0.22.0/fixtures/yaml/resources/parameters/pathInt64Parameter.yaml000066400000000000000000000001361457312637400262070ustar00rootroot00000000000000name: id in: path description: 'username to fetch' required: true type: integer format: int64 loads-0.22.0/fixtures/yaml/resources/parameters/pathStringArrayParameter.yaml000066400000000000000000000002011457312637400275410ustar00rootroot00000000000000name: usernames in: path description: 'usernames to pass' required: true type: array items: type: string collectionFormat: csv loads-0.22.0/fixtures/yaml/resources/parameters/pathStringParameter.yaml000066400000000000000000000001251457312637400265470ustar00rootroot00000000000000name: username in: path description: 'username to fetch' required: true type: string loads-0.22.0/fixtures/yaml/resources/parameters/queryInt64ArrayParameter.yaml000066400000000000000000000002241457312637400274150ustar00rootroot00000000000000name: id in: query description: 'ID of the object to fetch' required: true type: array items: type: integer format: int64 collectionFormat: csv loads-0.22.0/fixtures/yaml/resources/parameters/queryStringParameter.yaml000066400000000000000000000001471457312637400267640ustar00rootroot00000000000000name: id in: query description: 'ID of the object to fetch' required: true type: integer format: int64 loads-0.22.0/fixtures/yaml/resources/parameters/queryWithComplexParameter.yaml000066400000000000000000000001601457312637400277540ustar00rootroot00000000000000name: id in: query description: 'a complex object which should not validate' required: true schema: $ref: Pet loads-0.22.0/fixtures/yaml/resources/resourceWithExamplePayload.yaml000066400000000000000000000026141457312637400257360ustar00rootroot00000000000000swagger: '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}, examples: {application/json: {id: 9, category: {name: domestic}, name: monster, tags: [{name: 'for sale'}], status: alive}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} definitions: Pet: {required: [name], properties: {name: {type: string, example: cat}, tag: {type: string, example: 'for sale'}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/resources/resourceWithLinkedDefinitions.yaml000066400000000000000000000016671457312637400264420ustar00rootroot00000000000000swagger: '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}': {$ref: 'https://raw.githubusercontent.com/reverb/swagger-spec/master/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json'} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/resources/resourceWithLinkedDefinitions_part1.yaml000066400000000000000000000007051457312637400275410ustar00rootroot00000000000000get: 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}}} loads-0.22.0/fixtures/yaml/resources/resourceWithRelativeHost.yaml000066400000000000000000000023311457312637400254360ustar00rootroot00000000000000swagger: '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/'} 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}}} loads-0.22.0/fixtures/yaml/resources/reusableParameters.yaml000066400000000000000000000026061457312637400242540ustar00rootroot00000000000000swagger: '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}': {get: {description: 'Returns pets based on ID', summary: 'Find pets by ID', operationId: getPetsById, parameters: [{$ref: '#/parameters/skipParam'}, {$ref: '#/parameters/limitParam'}], responses: {'200': {description: 'pet response', schema: {type: array, items: {$ref: Pet}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} parameters: skipParam: {name: skip, in: query, description: 'number of items to skip', required: true, type: integer, format: int32} limitParam: {name: limit, in: query, description: 'max records to return', required: true, type: integer, format: int32} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/resources/securityExample.yaml000066400000000000000000000126361457312637400236150ustar00rootroot00000000000000swagger: '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/'} basePath: /v1 schemes: - http - https consumes: - application/json produces: - application/json - application/xml security: - {githubAccessCode: [user, gist]} - {internalApiKey: []} 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, security: [{githubAuth: ['user:read', 'user:write']}, {internalApiKey: []}], produces: [application/json, text/html], responses: {'200': {description: 'pet response', schema: {type: array, items: {$ref: Pet}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} securityDefinitions: githubAccessCode: {type: oauth2, scopes: {user: 'Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.', 'user:email': 'Grants read access to a user’s email addresses.', 'user:follow': 'Grants access to follow or unfollow other users.', public_repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.', repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.', repo_deployment: 'Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.', 'repo:status': 'Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.', delete_repo: 'Grants access to delete adminable repositories.', notifications: 'Grants read access to a user’s notifications. repo also provides this access.', gist: 'Grants write access to gists.', 'read:repo_hook': 'Grants read and ping access to hooks in public or private repositories.', 'write:repo_hook': 'Grants read, write, and ping access to hooks in public or private repositories.', 'admin:repo_hook': 'Grants read, write, ping, and delete access to hooks in public or private repositories.', 'read:org': 'Read-only access to organization, teams, and membership.', 'write:org': 'Publicize and unpublicize organization membership.', 'admin:org': 'Fully manage organization, teams, and memberships.', 'read:public_key': 'List and view details for public keys.', 'write:public_key': 'Create, list, and view details for public keys.', 'admin:public_key': 'Fully manage public keys.'}, flow: accessCode, authorizationUrl: 'https://github.com/login/oauth/authorize', tokenUrl: 'https://github.com/login/oauth/access_token'} petstoreImplicit: {type: oauth2, scopes: {user: 'Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.', 'user:email': 'Grants read access to a user’s email addresses.', 'user:follow': 'Grants access to follow or unfollow other users.', public_repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.', repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.', repo_deployment: 'Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.', 'repo:status': 'Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.', delete_repo: 'Grants access to delete adminable repositories.', notifications: 'Grants read access to a user’s notifications. repo also provides this access.', gist: 'Grants write access to gists.', 'read:repo_hook': 'Grants read and ping access to hooks in public or private repositories.', 'write:repo_hook': 'Grants read, write, and ping access to hooks in public or private repositories.', 'admin:repo_hook': 'Grants read, write, ping, and delete access to hooks in public or private repositories.', 'read:org': 'Read-only access to organization, teams, and membership.', 'write:org': 'Publicize and unpublicize organization membership.', 'admin:org': 'Fully manage organization, teams, and memberships.', 'read:public_key': 'List and view details for public keys.', 'write:public_key': 'Create, list, and view details for public keys.', 'admin:public_key': 'Fully manage public keys.'}, flow: implicit, authorizationUrl: 'http://petstore.swagger.wordnik.com/oauth/dialog'} internalApiKey: {type: apiKey, in: header, name: api_key} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/resources/stringPathParamResource.yaml000066400000000000000000000023541457312637400252420ustar00rootroot00000000000000swagger: '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}}}}} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/resources/taggedResource.yaml000066400000000000000000000030061457312637400233640ustar00rootroot00000000000000swagger: '2.0' x-reverb: addAnythingYouWant: true info: x-reverb-info: 'this is an example' 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 tags: - {name: pets} paths: x-reverb-path-info: 'vendor info' /pets: {x-vendor-method: {}, get: {x-vendor-operation-property: {}, description: 'Returns a pet based on ID', summary: 'Find pet by ID', operationId: getPetsById, produces: [application/json, text/html], parameters: [{x-vendor-parameter-property: {}, 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}}, x-vendor-operation-response-property: {}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} definitions: Pet: {x-vendor-model-property: {}, required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/resources/vendorExtensionExamples.yaml000066400000000000000000000027571457312637400253260ustar00rootroot00000000000000swagger: '2.0' x-reverb: addAnythingYouWant: true info: x-reverb-info: 'this is an example' 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: x-reverb-path-info: 'vendor info' /pets: {x-vendor-method: {}, get: {x-vendor-operation-property: {}, description: 'Returns a pet based on ID', summary: 'Find pet by ID', operationId: getPetsById, produces: [application/json, text/html], parameters: [{x-vendor-parameter-property: {}, 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}}, x-vendor-operation-response-property: {}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} definitions: Pet: {x-vendor-model-property: {}, required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/responses/000077500000000000000000000000001457312637400175455ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/responses/complexArrayResponse.yaml000066400000000000000000000001461457312637400246170ustar00rootroot00000000000000description: 'A complex object array response' schema: type: array items: {$ref: VeryComplexType} loads-0.22.0/fixtures/yaml/responses/dateTimeResponse.yaml000066400000000000000000000001171457312637400237030ustar00rootroot00000000000000description: 'A date-time response' schema: type: string format: date-time loads-0.22.0/fixtures/yaml/responses/int32Response.yaml000066400000000000000000000001201457312637400231000ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int32 loads-0.22.0/fixtures/yaml/responses/int64Response.yaml000066400000000000000000000001201457312637400231050ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int64 loads-0.22.0/fixtures/yaml/responses/multipleResponses.yaml000066400000000000000000000002651457312637400241710ustar00rootroot00000000000000'200': description: 'simple string response' schema: {type: string} '201': description: 'object created' default: description: oops schema: {type: integer, format: int32} loads-0.22.0/fixtures/yaml/responses/stringArrayResponse.yaml000066400000000000000000000001251457312637400244530ustar00rootroot00000000000000description: 'A string array response' schema: type: array items: {type: string} loads-0.22.0/fixtures/yaml/responses/stringResponse.yaml000066400000000000000000000000771457312637400234620ustar00rootroot00000000000000description: 'A simple string response' schema: type: string loads-0.22.0/fixtures/yaml/responses/stringResponseWithHeader.yaml000066400000000000000000000001741457312637400254250ustar00rootroot00000000000000description: 'A simple string response' schema: type: string headers: is-dog: {type: boolean} is-cat: {type: boolean} loads-0.22.0/fixtures/yaml/responses/voidResponse.yaml000066400000000000000000000000361457312637400231100ustar00rootroot00000000000000description: 'object created' loads-0.22.0/fixtures/yaml/swagger/000077500000000000000000000000001457312637400171635ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/1/000077500000000000000000000000001457312637400173235ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/1/2/000077500000000000000000000000001457312637400174645ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/1/2/3/000077500000000000000000000000001457312637400176265ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/1/2/3/4/000077500000000000000000000000001457312637400177715ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/1/2/3/4/swagger.yaml000066400000000000000000000015421457312637400223160ustar00rootroot00000000000000swagger: '2.0' info: title: Something contact: name: Somebody url: https://url.com email: email@url.com description: Something version: v1 host: security.sonusnet.com schemes: - https - http basePath: /api produces: - application/json - plain/text paths: /whatnot: get: description: Get something responses: 200: description: The something schema: $ref: '#/definitions/Something' 500: description: Oops definitions: Something: description: A collection of service events type: object properties: page: $ref: '../../../../shared/definitions/page.yaml#/definitions/Page' something: #type: array #description: An array of something #items: $ref: '../../../../shared/something.yaml#/definitions/Something' loads-0.22.0/fixtures/yaml/swagger/shared/000077500000000000000000000000001457312637400204315ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/shared/definitions/000077500000000000000000000000001457312637400227445ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/swagger/shared/definitions/page.yaml000066400000000000000000000007621457312637400245510ustar00rootroot00000000000000definitions: Page: description: A description of a paged result type: object properties: page: type: integer description: the page that was requested pages: type: integer description: the total number of pages available total_items: type: integer description: the total number of items available format: int64 page_items: type: integer description: the number of items per page requested loads-0.22.0/fixtures/yaml/swagger/shared/something.yaml000066400000000000000000000013441457312637400233140ustar00rootroot00000000000000swagger: '2.0' info: title: Something definitions contact: name: Somebody url: https://url.com email: email@url.com description: Something version: v1 host: security.sonusnet.com schemes: - https - http basePath: /api/something/definitions produces: - application/json - plain/text paths: /shared: get: operationId: Get tags: - Shared responses: 200: description: OK schema: properties: name: type: string definitions: Something: description: Something type: object properties: p1: type: string description: A string p2: type: integer description: An integer loads-0.22.0/fixtures/yaml/swagger/spec.yml000066400000000000000000000012551457312637400206430ustar00rootroot00000000000000swagger: "2.0" info: version: 0.1.1 title: test 1 description: recursively following JSON references contact: name: Fred host: api.example.com schemes: - http consumes: - application/json produces: - application/json paths: /getAll: get: operationId: getAll parameters: - name: a in: body description: max number of results required: false schema: $ref: '#/definitions/a' responses: '200': description: Success schema: $ref: '#/definitions/b' definitions: a: type: string b: $ref: './test3-ter-model-schema.json#/definitions/b' loads-0.22.0/fixtures/yaml/swagger/test3-ter-model-schema.json000066400000000000000000000004341457312637400242450ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "./test3-model-schema.json", "title": "test3-model-schema", "description": "Test schema responses", "definitions": { "b": { "type": "array", "items": { "type": "string" } } } }loads-0.22.0/fixtures/yaml/yaml/000077500000000000000000000000001457312637400164665ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/.gitkeep000066400000000000000000000000001457312637400201050ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/models/000077500000000000000000000000001457312637400177515ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/models/modelWithArrayRef.yaml000066400000000000000000000001631457312637400242250ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} children: {type: array, items: {$ref: Person}} loads-0.22.0/fixtures/yaml/yaml/models/modelWithComposition.yaml000066400000000000000000000014641457312637400250220ustar00rootroot00000000000000definitions: 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}}, required: [name, packSize]}]} Fish: {description: 'A representation of a fish', allOf: [{$ref: '#/models/Pet'}, {properties: {fins: {type: integer, format: int32, description: 'count of fins'}}, required: [fins]}]} Pet: {discriminator: petType, properties: {name: {type: string}, petType: {type: string}}, required: [name, petType]} loads-0.22.0/fixtures/yaml/yaml/models/modelWithDateTimeMap.yaml000066400000000000000000000001151457312637400246410ustar00rootroot00000000000000description: 'true' additionalProperties: type: string format: date-time loads-0.22.0/fixtures/yaml/yaml/models/modelWithExamples.yaml000066400000000000000000000002551457312637400242720ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} loads-0.22.0/fixtures/yaml/yaml/models/modelWithInt32Map.yaml000066400000000000000000000001441457312637400240460ustar00rootroot00000000000000description: 'This is a Map[String, Integer]' additionalProperties: type: integer format: int32 loads-0.22.0/fixtures/yaml/yaml/models/modelWithInt64Map.yaml000066400000000000000000000001121457312637400240460ustar00rootroot00000000000000description: 'true' additionalProperties: type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/models/modelWithMultipleProperties.yaml000066400000000000000000000012541457312637400263640ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/yaml/models/modelWithObjectMap.yaml000066400000000000000000000003101457312637400243500ustar00rootroot00000000000000description: "This is a Map[String, { id: Long, name: String}]" additionalProperties: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" loads-0.22.0/fixtures/yaml/yaml/models/modelWithPrimitiveArray.yaml000066400000000000000000000002101457312637400254520ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} childrensAges: {type: array, items: {type: integer, format: int32}} loads-0.22.0/fixtures/yaml/yaml/models/modelWithStringProperty.yaml000066400000000000000000000000671457312637400255300ustar00rootroot00000000000000description: 'true' properties: name: {type: string} loads-0.22.0/fixtures/yaml/yaml/models/modelWithXmlAttributes.yaml000066400000000000000000000003721457312637400253230ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/yaml/models/models.yaml000066400000000000000000000001131457312637400221130ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} loads-0.22.0/fixtures/yaml/yaml/models/multipleModels.yaml000066400000000000000000000002551457312637400236360ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} loads-0.22.0/fixtures/yaml/yaml/models/properties/000077500000000000000000000000001457312637400221455ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithBooleanArray.yaml000066400000000000000000000000431457312637400300450ustar00rootroot00000000000000type: array items: type: boolean loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithByteArray.yaml000066400000000000000000000000611457312637400273710ustar00rootroot00000000000000type: array items: type: string format: byte loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithComplexArray.yaml000066400000000000000000000000471457312637400301010ustar00rootroot00000000000000type: array items: $ref: ComplexType loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithDateTimeArray.yaml000066400000000000000000000000661457312637400301670ustar00rootroot00000000000000type: array items: type: string format: date-time loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithInt32Array.yaml000066400000000000000000000000631457312637400273670ustar00rootroot00000000000000type: array items: type: integer format: int32 loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithInt64Array.yaml000066400000000000000000000000631457312637400273740ustar00rootroot00000000000000type: array items: type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithRef.yaml000066400000000000000000000000621457312637400262040ustar00rootroot00000000000000$ref: Foo description: 'a boolean' readOnly: true loads-0.22.0/fixtures/yaml/yaml/models/properties/propertyWithStringArray.yaml000066400000000000000000000000421457312637400277330ustar00rootroot00000000000000type: array items: type: string loads-0.22.0/fixtures/yaml/yaml/models/properties/simpleBooleanProperty.yaml000066400000000000000000000000661457312637400273710ustar00rootroot00000000000000type: boolean description: 'a boolean' readOnly: true loads-0.22.0/fixtures/yaml/yaml/models/properties/simpleByteProperty.yaml000066400000000000000000000000321457312637400267060ustar00rootroot00000000000000type: string format: byte loads-0.22.0/fixtures/yaml/yaml/models/properties/simpleDateTimeProperty.yaml000066400000000000000000000000371457312637400275040ustar00rootroot00000000000000type: string format: date-time loads-0.22.0/fixtures/yaml/yaml/models/properties/simpleInt32Property.yaml000066400000000000000000000000341457312637400267040ustar00rootroot00000000000000type: integer format: int32 loads-0.22.0/fixtures/yaml/yaml/models/properties/simpleInt64Property.yaml000066400000000000000000000000341457312637400267110ustar00rootroot00000000000000type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/models/properties/simpleStringProperty.yaml000066400000000000000000000000151457312637400272520ustar00rootroot00000000000000type: string loads-0.22.0/fixtures/yaml/yaml/resources/000077500000000000000000000000001457312637400205005ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/resources/cascadingSchemes.yaml000066400000000000000000000023761457312637400246200ustar00rootroot00000000000000swagger: '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}}} loads-0.22.0/fixtures/yaml/yaml/resources/commonParameters.yaml000066400000000000000000000023521457312637400247020ustar00rootroot00000000000000swagger: '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}}} loads-0.22.0/fixtures/yaml/yaml/resources/multipleMimeTypes.yaml000066400000000000000000000030631457312637400250560ustar00rootroot00000000000000swagger: '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}}} loads-0.22.0/fixtures/yaml/yaml/resources/operations/000077500000000000000000000000001457312637400226635ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/resources/operations/operationWithTags.yaml000066400000000000000000000007001457312637400272170ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/yaml/resources/operations/stringPathAndBoolQueryParamResource.yaml000066400000000000000000000010331457312637400326450ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/yaml/resources/operations/stringPathParamResource.yaml000066400000000000000000000010051457312637400303570ustar00rootroot00000000000000description: '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}} loads-0.22.0/fixtures/yaml/yaml/resources/parameters/000077500000000000000000000000001457312637400226435ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/resources/parameters/bodyComplexArrayParameter.yaml000066400000000000000000000002101457312637400306450ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} format: csv loads-0.22.0/fixtures/yaml/yaml/resources/parameters/bodyComplexParameter.yaml000066400000000000000000000001411457312637400276510ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: $ref: User loads-0.22.0/fixtures/yaml/yaml/resources/parameters/bodyInt64Parameter.yaml000066400000000000000000000001421457312637400271470ustar00rootroot00000000000000name: id in: body description: 'id to add' required: true schema: type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/resources/parameters/bodyStringArrayParameter.yaml000066400000000000000000000001721457312637400305130ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} loads-0.22.0/fixtures/yaml/yaml/resources/parameters/bodyStringParameter.yaml000066400000000000000000000001431457312637400275120ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: string loads-0.22.0/fixtures/yaml/yaml/resources/parameters/formDataComplexParameter.yaml000066400000000000000000000001321457312637400304510ustar00rootroot00000000000000name: firstName in: formData description: 'users first name' required: true $ref: Nothing loads-0.22.0/fixtures/yaml/yaml/resources/parameters/formDataInt64Parameter.yaml000066400000000000000000000001421457312637400277470ustar00rootroot00000000000000name: id in: formData description: 'username to fetch' required: true type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/resources/parameters/formDataStringArrayParameter.yaml000066400000000000000000000001621457312637400313120ustar00rootroot00000000000000name: user in: formData description: 'user to add to the system' required: true type: array items: type: string loads-0.22.0/fixtures/yaml/yaml/resources/parameters/formDataStringParameter.yaml000066400000000000000000000001311457312637400303070ustar00rootroot00000000000000name: firstName in: formData description: 'users first name' required: true type: string loads-0.22.0/fixtures/yaml/yaml/resources/parameters/headerInt64ArrayParameter.yaml000066400000000000000000000002351457312637400304440ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: array items: type: integer format: int64 collectionFormat: csv loads-0.22.0/fixtures/yaml/yaml/resources/parameters/headerStringArrayParameter.yaml000066400000000000000000000002141457312637400310030ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: array items: type: string collectionFormat: csv loads-0.22.0/fixtures/yaml/yaml/resources/parameters/headerStringParameter.yaml000066400000000000000000000001411457312637400300030ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: string loads-0.22.0/fixtures/yaml/yaml/resources/parameters/pathInt64Parameter.yaml000066400000000000000000000001361457312637400271510ustar00rootroot00000000000000name: id in: path description: 'username to fetch' required: true type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/resources/parameters/pathStringArrayParameter.yaml000066400000000000000000000002011457312637400305030ustar00rootroot00000000000000name: usernames in: path description: 'usernames to pass' required: true type: array items: type: string collectionFormat: csv loads-0.22.0/fixtures/yaml/yaml/resources/parameters/pathStringParameter.yaml000066400000000000000000000001251457312637400275110ustar00rootroot00000000000000name: username in: path description: 'username to fetch' required: true type: string loads-0.22.0/fixtures/yaml/yaml/resources/parameters/queryInt64ArrayParameter.yaml000066400000000000000000000002241457312637400303570ustar00rootroot00000000000000name: id in: query description: 'ID of the object to fetch' required: true type: array items: type: integer format: int64 collectionFormat: csv loads-0.22.0/fixtures/yaml/yaml/resources/parameters/queryStringParameter.yaml000066400000000000000000000001471457312637400277260ustar00rootroot00000000000000name: id in: query description: 'ID of the object to fetch' required: true type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/resources/parameters/queryWithComplexParameter.yaml000066400000000000000000000001601457312637400307160ustar00rootroot00000000000000name: id in: query description: 'a complex object which should not validate' required: true schema: $ref: Pet loads-0.22.0/fixtures/yaml/yaml/resources/resourceWithExamplePayload.yaml000066400000000000000000000026141457312637400267000ustar00rootroot00000000000000swagger: '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}, examples: {application/json: {id: 9, category: {name: domestic}, name: monster, tags: [{name: 'for sale'}], status: alive}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} definitions: Pet: {required: [name], properties: {name: {type: string, example: cat}, tag: {type: string, example: 'for sale'}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/resources/resourceWithLinkedDefinitions.yaml000066400000000000000000000016671457312637400274040ustar00rootroot00000000000000swagger: '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}': {$ref: 'https://raw.githubusercontent.com/reverb/swagger-spec/master/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json'} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/resources/resourceWithLinkedDefinitions_part1.yaml000066400000000000000000000007051457312637400305030ustar00rootroot00000000000000get: 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}}} loads-0.22.0/fixtures/yaml/yaml/resources/resourceWithRelativeHost.yaml000066400000000000000000000023311457312637400264000ustar00rootroot00000000000000swagger: '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/'} 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}}} loads-0.22.0/fixtures/yaml/yaml/resources/reusableParameters.yaml000066400000000000000000000026061457312637400252160ustar00rootroot00000000000000swagger: '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}': {get: {description: 'Returns pets based on ID', summary: 'Find pets by ID', operationId: getPetsById, parameters: [{$ref: '#/parameters/skipParam'}, {$ref: '#/parameters/limitParam'}], responses: {'200': {description: 'pet response', schema: {type: array, items: {$ref: Pet}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} parameters: skipParam: {name: skip, in: query, description: 'number of items to skip', required: true, type: integer, format: int32} limitParam: {name: limit, in: query, description: 'max records to return', required: true, type: integer, format: int32} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/resources/securityExample.yaml000066400000000000000000000126361457312637400245570ustar00rootroot00000000000000swagger: '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/'} basePath: /v1 schemes: - http - https consumes: - application/json produces: - application/json - application/xml security: - {githubAccessCode: [user, gist]} - {internalApiKey: []} 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, security: [{githubAuth: ['user:read', 'user:write']}, {internalApiKey: []}], produces: [application/json, text/html], responses: {'200': {description: 'pet response', schema: {type: array, items: {$ref: Pet}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} securityDefinitions: githubAccessCode: {type: oauth2, scopes: {user: 'Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.', 'user:email': 'Grants read access to a user’s email addresses.', 'user:follow': 'Grants access to follow or unfollow other users.', public_repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.', repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.', repo_deployment: 'Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.', 'repo:status': 'Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.', delete_repo: 'Grants access to delete adminable repositories.', notifications: 'Grants read access to a user’s notifications. repo also provides this access.', gist: 'Grants write access to gists.', 'read:repo_hook': 'Grants read and ping access to hooks in public or private repositories.', 'write:repo_hook': 'Grants read, write, and ping access to hooks in public or private repositories.', 'admin:repo_hook': 'Grants read, write, ping, and delete access to hooks in public or private repositories.', 'read:org': 'Read-only access to organization, teams, and membership.', 'write:org': 'Publicize and unpublicize organization membership.', 'admin:org': 'Fully manage organization, teams, and memberships.', 'read:public_key': 'List and view details for public keys.', 'write:public_key': 'Create, list, and view details for public keys.', 'admin:public_key': 'Fully manage public keys.'}, flow: accessCode, authorizationUrl: 'https://github.com/login/oauth/authorize', tokenUrl: 'https://github.com/login/oauth/access_token'} petstoreImplicit: {type: oauth2, scopes: {user: 'Grants read/write access to profile info only. Note that this scope includes user:email and user:follow.', 'user:email': 'Grants read access to a user’s email addresses.', 'user:follow': 'Grants access to follow or unfollow other users.', public_repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations.', repo: 'Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.', repo_deployment: 'Grants access to deployment statuses for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, without granting access to the code.', 'repo:status': 'Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.', delete_repo: 'Grants access to delete adminable repositories.', notifications: 'Grants read access to a user’s notifications. repo also provides this access.', gist: 'Grants write access to gists.', 'read:repo_hook': 'Grants read and ping access to hooks in public or private repositories.', 'write:repo_hook': 'Grants read, write, and ping access to hooks in public or private repositories.', 'admin:repo_hook': 'Grants read, write, ping, and delete access to hooks in public or private repositories.', 'read:org': 'Read-only access to organization, teams, and membership.', 'write:org': 'Publicize and unpublicize organization membership.', 'admin:org': 'Fully manage organization, teams, and memberships.', 'read:public_key': 'List and view details for public keys.', 'write:public_key': 'Create, list, and view details for public keys.', 'admin:public_key': 'Fully manage public keys.'}, flow: implicit, authorizationUrl: 'http://petstore.swagger.wordnik.com/oauth/dialog'} internalApiKey: {type: apiKey, in: header, name: api_key} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/resources/stringPathParamResource.yaml000066400000000000000000000023541457312637400262040ustar00rootroot00000000000000swagger: '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}}}}} definitions: Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/resources/taggedResource.yaml000066400000000000000000000030061457312637400243260ustar00rootroot00000000000000swagger: '2.0' x-reverb: addAnythingYouWant: true info: x-reverb-info: 'this is an example' 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 tags: - {name: pets} paths: x-reverb-path-info: 'vendor info' /pets: {x-vendor-method: {}, get: {x-vendor-operation-property: {}, description: 'Returns a pet based on ID', summary: 'Find pet by ID', operationId: getPetsById, produces: [application/json, text/html], parameters: [{x-vendor-parameter-property: {}, 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}}, x-vendor-operation-response-property: {}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} definitions: Pet: {x-vendor-model-property: {}, required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/resources/vendorExtensionExamples.yaml000066400000000000000000000027571457312637400262700ustar00rootroot00000000000000swagger: '2.0' x-reverb: addAnythingYouWant: true info: x-reverb-info: 'this is an example' 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: x-reverb-path-info: 'vendor info' /pets: {x-vendor-method: {}, get: {x-vendor-operation-property: {}, description: 'Returns a pet based on ID', summary: 'Find pet by ID', operationId: getPetsById, produces: [application/json, text/html], parameters: [{x-vendor-parameter-property: {}, 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}}, x-vendor-operation-response-property: {}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} definitions: Pet: {x-vendor-model-property: {}, required: [name], properties: {name: {type: string}, tag: {type: string}}} ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} loads-0.22.0/fixtures/yaml/yaml/responses/000077500000000000000000000000001457312637400205075ustar00rootroot00000000000000loads-0.22.0/fixtures/yaml/yaml/responses/complexArrayResponse.yaml000066400000000000000000000001461457312637400255610ustar00rootroot00000000000000description: 'A complex object array response' schema: type: array items: {$ref: VeryComplexType} loads-0.22.0/fixtures/yaml/yaml/responses/dateTimeResponse.yaml000066400000000000000000000001171457312637400246450ustar00rootroot00000000000000description: 'A date-time response' schema: type: string format: date-time loads-0.22.0/fixtures/yaml/yaml/responses/int32Response.yaml000066400000000000000000000001201457312637400240420ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int32 loads-0.22.0/fixtures/yaml/yaml/responses/int64Response.yaml000066400000000000000000000001201457312637400240470ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int64 loads-0.22.0/fixtures/yaml/yaml/responses/multipleResponses.yaml000066400000000000000000000002651457312637400251330ustar00rootroot00000000000000'200': description: 'simple string response' schema: {type: string} '201': description: 'object created' default: description: oops schema: {type: integer, format: int32} loads-0.22.0/fixtures/yaml/yaml/responses/stringArrayResponse.yaml000066400000000000000000000001251457312637400254150ustar00rootroot00000000000000description: 'A string array response' schema: type: array items: {type: string} loads-0.22.0/fixtures/yaml/yaml/responses/stringResponse.yaml000066400000000000000000000000771457312637400244240ustar00rootroot00000000000000description: 'A simple string response' schema: type: string loads-0.22.0/fixtures/yaml/yaml/responses/stringResponseWithHeader.yaml000066400000000000000000000001741457312637400263670ustar00rootroot00000000000000description: 'A simple string response' schema: type: string headers: is-dog: {type: boolean} is-cat: {type: boolean} loads-0.22.0/fixtures/yaml/yaml/responses/voidResponse.yaml000066400000000000000000000000361457312637400240520ustar00rootroot00000000000000description: 'object created' loads-0.22.0/fmts/000077500000000000000000000000001457312637400136625ustar00rootroot00000000000000loads-0.22.0/fmts/fixture_test.go000066400000000000000000000177701457312637400167520ustar00rootroot00000000000000// 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 fmts import ( "encoding/json" "os" "path/filepath" "strings" "testing" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var extensions = []string{"json"} //nolint:unparam func assertSpecJSON(t testing.TB, specJSON []byte) bool { var expected map[string]interface{} require.NoError(t, json.Unmarshal(specJSON, &expected)) obj := spec.Swagger{} require.NoError(t, json.Unmarshal(specJSON, &obj)) cb, err := json.MarshalIndent(obj, "", " ") require.NoError(t, err) var actual map[string]interface{} require.NoError(t, json.Unmarshal(cb, &actual)) return assertSpecMaps(t, actual, expected) } func assertSpecMaps(t testing.TB, actual, expected map[string]interface{}) bool { res := true if id, ok := expected["id"]; ok { res = assert.Equal(t, id, actual["id"]) } res = res && assert.Equal(t, expected["consumes"], actual["consumes"]) res = res && assert.Equal(t, expected["produces"], actual["produces"]) res = res && assert.Equal(t, expected["schemes"], actual["schemes"]) res = res && assert.Equal(t, expected["swagger"], actual["swagger"]) res = res && assert.Equal(t, expected["info"], actual["info"]) res = res && assert.Equal(t, expected["host"], actual["host"]) res = res && assert.Equal(t, expected["basePath"], actual["basePath"]) res = res && assert.Equal(t, expected["paths"], actual["paths"]) res = res && assert.Equal(t, expected["definitions"], actual["definitions"]) res = res && assert.Equal(t, expected["responses"], actual["responses"]) res = res && assert.Equal(t, expected["securityDefinitions"], actual["securityDefinitions"]) res = res && assert.Equal(t, expected["tags"], actual["tags"]) res = res && assert.Equal(t, expected["externalDocs"], actual["externalDocs"]) res = res && assert.Equal(t, expected["x-some-extension"], actual["x-some-extension"]) res = res && assert.Equal(t, expected["x-schemes"], actual["x-schemes"]) return res } //nolint:unparam func roundTripTest(t *testing.T, fixtureType, extension, fileName string, schema interface{}) bool { if extension == "yaml" { return roundTripTestYAML(t, fixtureType, fileName, schema) } return roundTripTestJSON(t, fixtureType, fileName, schema) } func roundTripTestJSON(t *testing.T, fixtureType, fileName string, schema interface{}) bool { specName := strings.TrimSuffix(fileName, filepath.Ext(fileName)) t.Logf("verifying %s JSON fixture %q", fixtureType, specName) b, err := os.ReadFile(fileName) require.NoError(t, err) var expected map[string]interface{} require.NoError(t, json.Unmarshal(b, &expected)) require.NoError(t, json.Unmarshal(b, schema)) cb, err := json.MarshalIndent(schema, "", " ") require.NoError(t, err) var actual map[string]interface{} require.NoError(t, json.Unmarshal(cb, &actual)) return assert.EqualValues(t, expected, actual) } func roundTripTestYAML(t *testing.T, fixtureType, fileName string, schema interface{}) bool { specName := strings.TrimSuffix(fileName, filepath.Ext(fileName)) t.Logf("verifying %s YAML fixture %q", fixtureType, specName) b, err := YAMLDoc(fileName) require.NoError(t, err) var expected map[string]interface{} require.NoError(t, json.Unmarshal(b, &expected)) require.NoError(t, json.Unmarshal(b, schema)) cb, err := json.MarshalIndent(schema, "", " ") require.NoError(t, err) var actual map[string]interface{} require.NoError(t, json.Unmarshal(cb, &actual)) return assert.EqualValues(t, expected, actual) } func TestPropertyFixtures(t *testing.T) { for _, extension := range extensions { path := filepath.Join("..", "fixtures", extension, "models", "properties") files, err := os.ReadDir(path) if err != nil { t.Fatal(err) } // for _, f := range files { // roundTripTest(t, "property", extension, filepath.Join(path, f.Name()), &Schema{}) // } f := files[0] roundTripTest(t, "property", extension, filepath.Join(path, f.Name()), &spec.Schema{}) } } func TestAdditionalPropertiesWithObject(t *testing.T) { schema := new(spec.Schema) b, err := YAMLDoc("../fixtures/yaml/models/modelWithObjectMap.yaml") require.NoError(t, err) var expected map[string]interface{} require.NoError(t, json.Unmarshal(b, &expected)) require.NoError(t, json.Unmarshal(b, schema)) cb, err := json.MarshalIndent(schema, "", " ") require.NoError(t, err) var actual map[string]interface{} require.NoError(t, json.Unmarshal(cb, &actual)) assert.Equal(t, expected, actual) } func TestModelFixtures(t *testing.T) { path := filepath.Join("..", "fixtures", "json", "models") files, err := os.ReadDir(path) require.NoError(t, err) specs := []string{"modelWithObjectMap", "models", "modelWithComposition", "modelWithExamples", "multipleModels"} FILES: for _, f := range files { if f.IsDir() { continue } for _, sp := range specs { if strings.HasPrefix(f.Name(), sp) { roundTripTest(t, "model", "json", filepath.Join(path, f.Name()), &spec.Schema{}) continue FILES } } roundTripTest(t, "model", "json", filepath.Join(path, f.Name()), &spec.Schema{}) } path = filepath.Join("..", "fixtures", "yaml", "models") files, err = os.ReadDir(path) require.NoError(t, err) YAMLFILES: for _, f := range files { if f.IsDir() { continue } for _, sp := range specs { if strings.HasPrefix(f.Name(), sp) { roundTripTest(t, "model", "yaml", filepath.Join(path, f.Name()), &spec.Schema{}) continue YAMLFILES } } roundTripTest(t, "model", "yaml", filepath.Join(path, f.Name()), &spec.Schema{}) } } func TestParameterFixtures(t *testing.T) { path := filepath.Join("..", "fixtures", "json", "resources", "parameters") files, err := os.ReadDir(path) require.NoError(t, err) for _, f := range files { roundTripTest(t, "parameter", "json", filepath.Join(path, f.Name()), &spec.Parameter{}) } } func TestOperationFixtures(t *testing.T) { path := filepath.Join("..", "fixtures", "json", "resources", "operations") files, err := os.ReadDir(path) require.NoError(t, err) for _, f := range files { roundTripTest(t, "operation", "json", filepath.Join(path, f.Name()), &spec.Operation{}) } } func TestResponseFixtures(t *testing.T) { path := filepath.Join("..", "fixtures", "json", "responses") files, err := os.ReadDir(path) require.NoError(t, err) for _, f := range files { if !strings.HasPrefix(f.Name(), "multiple") { roundTripTest(t, "response", "json", filepath.Join(path, f.Name()), &spec.Response{}) } else { roundTripTest(t, "responses", "json", filepath.Join(path, f.Name()), &spec.Responses{}) } } } func TestResourcesFixtures(t *testing.T) { path := filepath.Join("..", "fixtures", "json", "resources") files, err := os.ReadDir(path) require.NoError(t, err) pathItems := []string{"resourceWithLinkedDefinitions_part1"} toSkip := []string{} FILES: for _, f := range files { if f.IsDir() { continue } for _, ts := range toSkip { if strings.HasPrefix(f.Name(), ts) { t.Log("verifying resource" + strings.TrimSuffix(f.Name(), filepath.Ext(f.Name()))) b, err := os.ReadFile(filepath.Join(path, f.Name())) require.NoError(t, err) assertSpecJSON(t, b) continue FILES } } for _, pi := range pathItems { if strings.HasPrefix(f.Name(), pi) { roundTripTest(t, "path items", "json", filepath.Join(path, f.Name()), &spec.PathItem{}) continue FILES } } t.Logf("verifying resource %q", strings.TrimSuffix(f.Name(), filepath.Ext(f.Name()))) b2, err := os.ReadFile(filepath.Join(path, f.Name())) require.NoError(t, err) assertSpecJSON(t, b2) } } loads-0.22.0/fmts/yaml.go000066400000000000000000000021421457312637400151520ustar00rootroot00000000000000// 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 fmts import "github.com/go-openapi/swag" var ( // YAMLMatcher matches yaml YAMLMatcher = swag.YAMLMatcher // YAMLToJSON converts YAML unmarshaled data into json compatible data YAMLToJSON = swag.YAMLToJSON // BytesToYAMLDoc converts raw bytes to a map[string]interface{} BytesToYAMLDoc = swag.BytesToYAMLDoc // YAMLDoc loads a yaml document from either http or a file and converts it to json YAMLDoc = swag.YAMLDoc // YAMLData loads a yaml document from either http or a file YAMLData = swag.YAMLData ) loads-0.22.0/fmts/yaml_test.go000066400000000000000000000252671457312637400162260ustar00rootroot00000000000000// 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 fmts import ( "encoding/json" "errors" "net/http" "net/http/httptest" "testing" yaml "gopkg.in/yaml.v3" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) type failJSONMarshal struct { } func (f failJSONMarshal) MarshalJSON() ([]byte, error) { return nil, errors.New("expected") } func TestLoadHTTPBytes(t *testing.T) { _, err := swag.LoadFromFileOrHTTP("httx://12394:abd") require.Error(t, err) serv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusNotFound) })) defer serv.Close() _, err = swag.LoadFromFileOrHTTP(serv.URL) require.Error(t, err) ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusOK) _, _ = rw.Write([]byte("the content")) })) defer ts2.Close() d, err := swag.LoadFromFileOrHTTP(ts2.URL) require.NoError(t, err) assert.Equal(t, []byte("the content"), d) } func TestYAMLToJSON(t *testing.T) { const sd = `--- 1: the int key value name: a string value 'y': some value ` t.Run("YAML object as JSON", func(t *testing.T) { var data interface{} require.NoError(t, yaml.Unmarshal([]byte(sd), &data)) d, err := YAMLToJSON(data) require.NoError(t, err) assert.JSONEq(t, `{"1":"the int key value","name":"a string value","y":"some value"}`, string(d), ) }) t.Run("YAML nodes as JSON", func(t *testing.T) { var data yaml.Node require.NoError(t, yaml.Unmarshal([]byte(sd), &data)) data.Content[0].Content = append(data.Content[0].Content, &yaml.Node{Kind: yaml.ScalarNode, Value: "tag", Tag: "!!str"}, &yaml.Node{ Kind: yaml.MappingNode, Content: []*yaml.Node{ {Kind: yaml.ScalarNode, Value: "name", Tag: "!!str"}, {Kind: yaml.ScalarNode, Value: "tag name", Tag: "!!str"}, }, }, ) d, err := YAMLToJSON(data) require.NoError(t, err) assert.JSONEq(t, `{"1":"the int key value","name":"a string value","y":"some value","tag":{"name":"tag name"}}`, string(d), ) }) t.Run("YAML slice as JSON", func(t *testing.T) { lst := []interface{}{"hello"} d, err := YAMLToJSON(&lst) require.NoError(t, err) assert.JSONEq(t, `["hello"]`, string(d)) }) t.Run("fail to convert to JSON", func(t *testing.T) { t.Run("with invalid receiver", func(t *testing.T) { _, err := YAMLToJSON(failJSONMarshal{}) require.Error(t, err) }) t.Run("with invalid document", func(t *testing.T) { _, err := BytesToYAMLDoc([]byte("- name: hello\n")) require.Error(t, err) }) }) t.Run("with BytesToYamlDoc", func(t *testing.T) { dd, err := BytesToYAMLDoc([]byte("description: 'object created'\n")) require.NoError(t, err) d, err := YAMLToJSON(dd) require.NoError(t, err) assert.Equal(t, json.RawMessage(`{"description":"object created"}`), d) }) } func TestLoadStrategy(t *testing.T) { loader := func(_ string) ([]byte, error) { return []byte(yamlPetStore), nil } remLoader := func(_ string) ([]byte, error) { return []byte("not it"), nil } ld := swag.LoadStrategy("blah", loader, remLoader) b, _ := ld("") assert.Equal(t, []byte(yamlPetStore), b) serv := httptest.NewServer(http.HandlerFunc(yamlPestoreServer)) defer serv.Close() s, err := YAMLDoc(serv.URL) require.NoError(t, err) assert.NotNil(t, s) ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusNotFound) _, _ = rw.Write([]byte("\n")) })) defer ts2.Close() _, err = YAMLDoc(ts2.URL) require.Error(t, err) } var yamlPestoreServer = func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusOK) _, _ = rw.Write([]byte(yamlPetStore)) } func TestWithYKey(t *testing.T) { t.Run("with YAMLv3, unquoted y as key is parsed correctly", func(t *testing.T) { doc, err := BytesToYAMLDoc([]byte(withYKey)) require.NoError(t, err) _, err = YAMLToJSON(doc) require.NoError(t, err) }) t.Run("quoted y as key is parsed correctly", func(t *testing.T) { doc, err := BytesToYAMLDoc([]byte(withQuotedYKey)) require.NoError(t, err) jsond, err := YAMLToJSON(doc) require.NoError(t, err) var yt struct { Definitions struct { Viewbox struct { Properties struct { Y struct { Type string `json:"type"` } `json:"y"` } `json:"properties"` } `json:"viewbox"` } `json:"definitions"` } require.NoError(t, json.Unmarshal(jsond, &yt)) assert.Equal(t, "integer", yt.Definitions.Viewbox.Properties.Y.Type) }) } const withQuotedYKey = `consumes: - application/json definitions: viewBox: type: object properties: x: type: integer format: int16 # y -> types don't match: expect map key string or int get: bool "y": type: integer format: int16 width: type: integer format: int16 height: type: integer format: int16 info: description: Test RESTful APIs title: Test Server version: 1.0.0 basePath: /api paths: /test: get: operationId: findAll parameters: - name: since in: query type: integer format: int64 - name: limit in: query type: integer format: int32 default: 20 responses: 200: description: Array[Trigger] schema: type: array items: $ref: "#/definitions/viewBox" produces: - application/json schemes: - https swagger: "2.0" ` const withYKey = `consumes: - application/json definitions: viewBox: type: object properties: x: type: integer format: int16 # y -> types don't match: expect map key string or int get: bool y: type: integer format: int16 width: type: integer format: int16 height: type: integer format: int16 info: description: Test RESTful APIs title: Test Server version: 1.0.0 basePath: /api paths: /test: get: operationId: findAll parameters: - name: since in: query type: integer format: int64 - name: limit in: query type: integer format: int32 default: 20 responses: 200: description: Array[Trigger] schema: type: array items: $ref: "#/definitions/viewBox" produces: - application/json schemes: - https swagger: "2.0" ` const yamlPetStore = `swagger: '2.0' info: version: '1.0.0' title: Swagger Petstore 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: Swagger API team email: foo@example.com url: http://swagger.io license: name: MIT url: http://opensource.org/licenses/MIT host: petstore.swagger.wordnik.com basePath: /api schemes: - http consumes: - application/json produces: - application/json paths: /pets: get: description: Returns all pets from the system that the user has access to operationId: findPets produces: - application/json - application/xml - text/xml - text/html parameters: - name: tags in: query description: tags to filter by required: false type: array items: type: string collectionFormat: csv - name: limit in: query description: maximum number of results to return required: false type: integer format: int32 responses: '200': description: pet response schema: type: array items: $ref: '#/definitions/pet' default: description: unexpected error schema: $ref: '#/definitions/errorModel' post: description: Creates a new pet in the store. Duplicates are allowed operationId: addPet produces: - application/json parameters: - name: pet in: body description: Pet to add to the store required: true schema: $ref: '#/definitions/newPet' responses: '200': description: pet response schema: $ref: '#/definitions/pet' default: description: unexpected error schema: $ref: '#/definitions/errorModel' /pets/{id}: get: description: Returns a user based on a single ID, if the user does not have access to the pet operationId: findPetById produces: - application/json - application/xml - text/xml - text/html parameters: - name: id in: path description: ID of pet to fetch required: true type: integer format: int64 responses: '200': description: pet response schema: $ref: '#/definitions/pet' default: description: unexpected error schema: $ref: '#/definitions/errorModel' delete: description: deletes a single pet based on the ID supplied operationId: deletePet parameters: - name: id in: path description: ID of pet to delete required: true type: integer format: int64 responses: '204': description: pet deleted default: description: unexpected error schema: $ref: '#/definitions/errorModel' definitions: pet: required: - id - name properties: id: type: integer format: int64 name: type: string tag: type: string newPet: allOf: - $ref: '#/definitions/pet' - required: - name properties: id: type: integer format: int64 name: type: string errorModel: required: - code - message properties: code: type: integer format: int32 message: type: string ` loads-0.22.0/go.mod000066400000000000000000000016251457312637400140230ustar00rootroot00000000000000module github.com/go-openapi/loads require ( github.com/go-openapi/analysis v0.23.0 github.com/go-openapi/spec v0.21.0 github.com/go-openapi/swag v0.23.0 github.com/stretchr/testify v1.9.0 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-openapi/errors v0.22.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/strfmt v0.23.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect ) go 1.20 loads-0.22.0/go.sum000066400000000000000000000072171457312637400140530ustar00rootroot00000000000000github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= loads-0.22.0/json_test.go000066400000000000000000000161571457312637400152620ustar00rootroot00000000000000// 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 loads import ( "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/require" ) func TestLoadJSON(t *testing.T) { serv := httptest.NewServer(http.HandlerFunc(jsonPestoreServer)) defer serv.Close() s, err := JSONSpec(serv.URL) require.NoError(t, err) require.NotNil(t, s) ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusNotFound) _, _ = rw.Write([]byte("{}")) })) defer ts2.Close() _, err = JSONSpec(ts2.URL) require.Error(t, err) } var jsonPestoreServer = func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusOK) _, _ = rw.Write([]byte(petstoreJSON)) } const petstoreJSON = `{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "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": "petstore.swagger.wordnik.com", "basePath": "/api", "schemes": [ "http" ], "paths": { "/pets": { "get": { "security": [ { "oauth2": ["read"] } ], "tags": [ "Pet Operations" ], "operationId": "getAllPets", "parameters": [ { "name": "status", "in": "query", "description": "The status to filter by", "type": "string" } ], "summary": "Finds all pets in the system", "responses": { "200": { "description": "Pet response", "schema": { "type": "array", "items": { "$ref": "#/definitions/Pet" } } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "post": { "security": [ { "oauth2": ["write"] } ], "tags": [ "Pet Operations" ], "operationId": "createPet", "summary": "Creates a new pet", "parameters": [ { "name": "pet", "in": "body", "description": "The Pet to create", "required": true, "schema": { "$ref": "#/definitions/newPet" } } ], "responses": { "200": { "description": "Created Pet response", "schema": { "$ref": "#/definitions/Pet" } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/pets/{id}": { "delete": { "security": [ { "oauth2": ["write"] } ], "description": "Deletes the Pet by id", "operationId": "deletePet", "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to delete", "required": true, "type": "integer", "format": "int64" } ], "responses": { "204": { "description": "pet deleted" }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "get": { "security": [ { "oauth2": ["read"] } ], "tags": [ "Pet Operations" ], "operationId": "getPetById", "summary": "Finds the pet by id", "responses": { "200": { "description": "Pet response", "schema": { "$ref": "#/definitions/Pet" } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet", "required": true, "type": "integer", "format": "int64" } ] } }, "definitions": { "Category": { "id": "Category", "properties": { "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" } } }, "Pet": { "id": "Pet", "properties": { "category": { "$ref": "#/definitions/Category" }, "id": { "description": "unique identifier for the pet", "format": "int64", "maximum": 100.0, "minimum": 0.0, "type": "integer" }, "name": { "type": "string" }, "photoUrls": { "items": { "type": "string" }, "type": "array" }, "status": { "description": "pet status in the store", "enum": [ "available", "pending", "sold" ], "type": "string" }, "tags": { "items": { "$ref": "#/definitions/Tag" }, "type": "array" } }, "required": [ "id", "name" ] }, "newPet": { "allOf": [ { "$ref": "#/definitions/Pet" } ], "required": [ "name" ] }, "Tag": { "id": "Tag", "properties": { "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" } } }, "Error": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } }, "produces": [ "application/json", "application/xml", "text/plain", "text/html" ], "securityDefinitions": { "oauth2": { "type": "oauth2", "scopes": { "read": "Read access.", "write": "Write access" }, "flow": "accessCode", "authorizationUrl": "http://petstore.swagger.wordnik.com/oauth/authorize", "tokenUrl": "http://petstore.swagger.wordnik.com/oauth/token" } } }` loads-0.22.0/loaders.go000066400000000000000000000056331457312637400147000ustar00rootroot00000000000000package loads import ( "encoding/json" "errors" "net/url" "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) var ( // Default chain of loaders, defined at the package level. // // By default this matches json and yaml documents. // // May be altered with AddLoader(). loaders *loader ) func init() { jsonLoader := &loader{ DocLoaderWithMatch: DocLoaderWithMatch{ Match: func(_ string) bool { return true }, Fn: JSONDoc, }, } loaders = jsonLoader.WithHead(&loader{ DocLoaderWithMatch: DocLoaderWithMatch{ Match: swag.YAMLMatcher, Fn: swag.YAMLDoc, }, }) // sets the global default loader for go-openapi/spec spec.PathLoader = loaders.Load } // DocLoader represents a doc loader type type DocLoader func(string) (json.RawMessage, error) // DocMatcher represents a predicate to check if a loader matches type DocMatcher func(string) bool // DocLoaderWithMatch describes a loading function for a given extension match. type DocLoaderWithMatch struct { Fn DocLoader Match DocMatcher } // NewDocLoaderWithMatch builds a DocLoaderWithMatch to be used in load options func NewDocLoaderWithMatch(fn DocLoader, matcher DocMatcher) DocLoaderWithMatch { return DocLoaderWithMatch{ Fn: fn, Match: matcher, } } type loader struct { DocLoaderWithMatch Next *loader } // WithHead adds a loader at the head of the current stack func (l *loader) WithHead(head *loader) *loader { if head == nil { return l } head.Next = l return head } // WithNext adds a loader at the trail of the current stack func (l *loader) WithNext(next *loader) *loader { l.Next = next return next } // Load the raw document from path func (l *loader) Load(path string) (json.RawMessage, error) { _, erp := url.Parse(path) if erp != nil { return nil, erp } lastErr := errors.New("no loader matched") // default error if no match was found for ldr := l; ldr != nil; ldr = ldr.Next { if ldr.Match != nil && !ldr.Match(path) { continue } // try then move to next one if there is an error b, err := ldr.Fn(path) if err == nil { return b, nil } lastErr = err } return nil, lastErr } // JSONDoc loads a json document from either a file or a remote url func JSONDoc(path string) (json.RawMessage, error) { data, err := swag.LoadFromFileOrHTTP(path) if err != nil { return nil, err } return json.RawMessage(data), nil } // AddLoader for a document, executed before other previously set loaders. // // This sets the configuration at the package level. // // NOTE: // - this updates the default loader used by github.com/go-openapi/spec // - since this sets package level globals, you shouln't call this concurrently func AddLoader(predicate DocMatcher, load DocLoader) { loaders = loaders.WithHead(&loader{ DocLoaderWithMatch: DocLoaderWithMatch{ Match: predicate, Fn: load, }, }) // sets the global default loader for go-openapi/spec spec.PathLoader = loaders.Load } loads-0.22.0/loaders_test.go000066400000000000000000000004701457312637400157310ustar00rootroot00000000000000package loads import ( "testing" "github.com/stretchr/testify/require" ) func TestLoader_EdgeCases(t *testing.T) { ldr := &loader{} ldr.Fn = JSONDoc // chaining with nil is a no op next := ldr.WithHead(nil) require.Equal(t, ldr, next) _, err := ldr.Load(`d\::invalid uri\`) require.Error(t, err) } loads-0.22.0/options.go000066400000000000000000000022611457312637400147340ustar00rootroot00000000000000package loads type options struct { loader *loader } func defaultOptions() *options { return &options{ loader: loaders, } } func loaderFromOptions(options []LoaderOption) *loader { opts := defaultOptions() for _, apply := range options { apply(opts) } return opts.loader } // LoaderOption allows to fine-tune the spec loader behavior type LoaderOption func(*options) // WithDocLoader sets a custom loader for loading specs func WithDocLoader(l DocLoader) LoaderOption { return func(opt *options) { if l == nil { return } opt.loader = &loader{ DocLoaderWithMatch: DocLoaderWithMatch{ Fn: l, }, } } } // WithDocLoaderMatches sets a chain of custom loaders for loading specs // for different extension matches. // // Loaders are executed in the order of provided DocLoaderWithMatch'es. func WithDocLoaderMatches(l ...DocLoaderWithMatch) LoaderOption { return func(opt *options) { var final, prev *loader for _, ldr := range l { if ldr.Fn == nil { continue } if prev == nil { final = &loader{DocLoaderWithMatch: ldr} prev = final continue } prev = prev.WithNext(&loader{DocLoaderWithMatch: ldr}) } opt.loader = final } } loads-0.22.0/options_test.go000066400000000000000000000062001457312637400157700ustar00rootroot00000000000000package loads import ( "encoding/json" "errors" "os" "path/filepath" "testing" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) const optionFixture = "fixtures/json/resources/pathLoaderIssue.json" func TestOptionsWithDocLoader(t *testing.T) { document, err := Spec(optionFixture, WithDocLoader(func(pth string) (json.RawMessage, error) { buf, err := os.ReadFile(pth) return json.RawMessage(buf), err })) require.NoError(t, err) require.NotNil(t, document) require.NotNil(t, document.pathLoader) b, err := document.pathLoader.Load(optionFixture) require.NoError(t, err) trimmed, err := trimData(b) require.NoError(t, err) assert.EqualValues(t, trimmed, document.Raw()) // a nil loader is a no op _, err = Spec(optionFixture, WithDocLoader(nil)) require.NoError(t, err) } func TestOptionsLoaderFromOptions(t *testing.T) { var called int // not chaining here, just replacing with the last one l := loaderFromOptions([]LoaderOption{ WithDocLoader(func(pth string) (json.RawMessage, error) { called = 1 buf, err := os.ReadFile(pth) return json.RawMessage(buf), err }), WithDocLoader(func(pth string) (json.RawMessage, error) { called = 2 buf, err := os.ReadFile(pth) return json.RawMessage(buf), err }), }) require.NotNil(t, l) b, err := l.Load(optionFixture) require.NoError(t, err) require.NotNil(t, b) require.Equal(t, 2, called) } func TestOptionsWithDocLoaderMatches(t *testing.T) { jsonLoader := NewDocLoaderWithMatch( func(pth string) (json.RawMessage, error) { buf, err := os.ReadFile(pth) return json.RawMessage(buf), err }, func(pth string) bool { return filepath.Ext(pth) == ".json" }, ) document, err := Spec(optionFixture, WithDocLoaderMatches(jsonLoader)) require.NoError(t, err) require.NotNil(t, document) require.NotNil(t, document.pathLoader) yamlLoader := NewDocLoaderWithMatch( swag.YAMLDoc, func(pth string) bool { return filepath.Ext(pth) == ".yaml" }, ) document, err = Spec(optionFixture, WithDocLoaderMatches(yamlLoader)) require.Error(t, err) require.Nil(t, document) // chained loaders, with different ordering document, err = Spec(optionFixture, WithDocLoaderMatches(yamlLoader, jsonLoader)) require.NoError(t, err) require.NotNil(t, document) document, err = Spec(optionFixture, WithDocLoaderMatches(jsonLoader, yamlLoader)) require.NoError(t, err) require.NotNil(t, document) // the nil loader is a no op nilLoader := NewDocLoaderWithMatch(nil, nil) document, err = Spec(optionFixture, WithDocLoaderMatches(nilLoader, jsonLoader, yamlLoader)) require.NoError(t, err) require.NotNil(t, document) // the nil matcher always matches nilMatcher := NewDocLoaderWithMatch(func(_ string) (json.RawMessage, error) { return nil, errors.New("test") }, nil) _, err = Spec(optionFixture, WithDocLoaderMatches(nilMatcher)) require.Error(t, err) require.Equal(t, "test", err.Error()) // when a matcher returns an errors, the next one is tried document, err = Spec(optionFixture, WithDocLoaderMatches(nilMatcher, jsonLoader, yamlLoader)) require.NoError(t, err) require.NotNil(t, document) } loads-0.22.0/spec.go000066400000000000000000000147431457312637400142030ustar00rootroot00000000000000// 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 loads import ( "bytes" "encoding/gob" "encoding/json" "fmt" "github.com/go-openapi/analysis" "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) func init() { gob.Register(map[string]interface{}{}) gob.Register([]interface{}{}) } // Document represents a swagger spec document type Document struct { // specAnalyzer Analyzer *analysis.Spec spec *spec.Swagger specFilePath string origSpec *spec.Swagger schema *spec.Schema pathLoader *loader raw json.RawMessage } // JSONSpec loads a spec from a json document func JSONSpec(path string, options ...LoaderOption) (*Document, error) { data, err := JSONDoc(path) if err != nil { return nil, err } // convert to json doc, err := Analyzed(data, "", options...) if err != nil { return nil, err } doc.specFilePath = path return doc, nil } // Embedded returns a Document based on embedded specs. No analysis is required func Embedded(orig, flat json.RawMessage, options ...LoaderOption) (*Document, error) { var origSpec, flatSpec spec.Swagger if err := json.Unmarshal(orig, &origSpec); err != nil { return nil, err } if err := json.Unmarshal(flat, &flatSpec); err != nil { return nil, err } return &Document{ raw: orig, origSpec: &origSpec, spec: &flatSpec, pathLoader: loaderFromOptions(options), }, nil } // Spec loads a new spec document from a local or remote path func Spec(path string, options ...LoaderOption) (*Document, error) { ldr := loaderFromOptions(options) b, err := ldr.Load(path) if err != nil { return nil, err } document, err := Analyzed(b, "", options...) if err != nil { return nil, err } document.specFilePath = path document.pathLoader = ldr return document, nil } // Analyzed creates a new analyzed spec document for a root json.RawMessage. func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*Document, error) { if version == "" { version = "2.0" } if version != "2.0" { return nil, fmt.Errorf("spec version %q is not supported", version) } raw, err := trimData(data) // trim blanks, then convert yaml docs into json if err != nil { return nil, err } swspec := new(spec.Swagger) if err = json.Unmarshal(raw, swspec); err != nil { return nil, err } origsqspec, err := cloneSpec(swspec) if err != nil { return nil, err } d := &Document{ Analyzer: analysis.New(swspec), // NOTE: at this moment, analysis does not follow $refs to documents outside the root doc schema: spec.MustLoadSwagger20Schema(), spec: swspec, raw: raw, origSpec: origsqspec, pathLoader: loaderFromOptions(options), } return d, nil } func trimData(in json.RawMessage) (json.RawMessage, error) { trimmed := bytes.TrimSpace(in) if len(trimmed) == 0 { return in, nil } if trimmed[0] == '{' || trimmed[0] == '[' { return trimmed, nil } // assume yaml doc: convert it to json yml, err := swag.BytesToYAMLDoc(trimmed) if err != nil { return nil, fmt.Errorf("analyzed: %v", err) } d, err := swag.YAMLToJSON(yml) if err != nil { return nil, fmt.Errorf("analyzed: %v", err) } return d, nil } // Expanded expands the $ref fields in the spec document and returns a new spec document func (d *Document) Expanded(options ...*spec.ExpandOptions) (*Document, error) { swspec := new(spec.Swagger) if err := json.Unmarshal(d.raw, swspec); err != nil { return nil, err } var expandOptions *spec.ExpandOptions if len(options) > 0 { expandOptions = options[0] if expandOptions.RelativeBase == "" { expandOptions.RelativeBase = d.specFilePath } } else { expandOptions = &spec.ExpandOptions{ RelativeBase: d.specFilePath, } } if expandOptions.PathLoader == nil { if d.pathLoader != nil { // use loader from Document options expandOptions.PathLoader = d.pathLoader.Load } else { // use package level loader expandOptions.PathLoader = loaders.Load } } if err := spec.ExpandSpec(swspec, expandOptions); err != nil { return nil, err } dd := &Document{ Analyzer: analysis.New(swspec), spec: swspec, specFilePath: d.specFilePath, schema: spec.MustLoadSwagger20Schema(), raw: d.raw, origSpec: d.origSpec, } return dd, nil } // BasePath the base path for the API specified by this spec func (d *Document) BasePath() string { return d.spec.BasePath } // Version returns the version of this spec func (d *Document) Version() string { return d.spec.Swagger } // Schema returns the swagger 2.0 schema func (d *Document) Schema() *spec.Schema { return d.schema } // Spec returns the swagger spec object model func (d *Document) Spec() *spec.Swagger { return d.spec } // Host returns the host for the API func (d *Document) Host() string { return d.spec.Host } // Raw returns the raw swagger spec as json bytes func (d *Document) Raw() json.RawMessage { return d.raw } // OrigSpec yields the original spec func (d *Document) OrigSpec() *spec.Swagger { return d.origSpec } // ResetDefinitions gives a shallow copy with the models reset to the original spec func (d *Document) ResetDefinitions() *Document { defs := make(map[string]spec.Schema, len(d.origSpec.Definitions)) for k, v := range d.origSpec.Definitions { defs[k] = v } d.spec.Definitions = defs return d } // Pristine creates a new pristine document instance based on the input data func (d *Document) Pristine() *Document { raw, _ := json.Marshal(d.Spec()) dd, _ := Analyzed(raw, d.Version()) dd.pathLoader = d.pathLoader dd.specFilePath = d.specFilePath return dd } // SpecFilePath returns the file path of the spec if one is defined func (d *Document) SpecFilePath() string { return d.specFilePath } func cloneSpec(src *spec.Swagger) (*spec.Swagger, error) { var b bytes.Buffer if err := gob.NewEncoder(&b).Encode(src); err != nil { return nil, err } var dst spec.Swagger if err := gob.NewDecoder(&b).Decode(&dst); err != nil { return nil, err } return &dst, nil } loads-0.22.0/spec_test.go000066400000000000000000000675021457312637400152430ustar00rootroot00000000000000// 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 loads import ( "encoding/json" "path/filepath" "regexp" "strconv" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestUnknownSpecVersion(t *testing.T) { _, err := Analyzed([]byte{}, "0.9") require.Error(t, err) } func TestDefaultsTo20(t *testing.T) { d, err := Analyzed(PetStoreJSONMessage, "") require.NoError(t, err) require.NotNil(t, d) assert.Equal(t, "2.0", d.Version()) // assert.Equal(t, "2.0", d.data["swagger"].(string)) assert.Equal(t, "/api", d.BasePath()) } func TestLoadsYAMLContent(t *testing.T) { d, err := Analyzed(json.RawMessage([]byte(YAMLSpec)), "") require.NoError(t, err) require.NotNil(t, d) sw := d.Spec() assert.Equal(t, "1.0.0", sw.Info.Version) } // for issue 11 func TestRegressionExpand(t *testing.T) { swaggerFile := "fixtures/yaml/swagger/1/2/3/4/swagger.yaml" document, err := Spec(swaggerFile) require.NoError(t, err) require.NotNil(t, document) d, err := document.Expanded() require.NoError(t, err) require.NotNil(t, d) b, _ := d.Spec().MarshalJSON() assert.JSONEq(t, expectedExpanded, string(b)) } func TestCascadingRefExpand(t *testing.T) { swaggerFile := "fixtures/yaml/swagger/spec.yml" document, err := Spec(swaggerFile) require.NoError(t, err) require.NotNil(t, document) d, err := document.Expanded() require.NoError(t, err) require.NotNil(t, d) b, _ := d.Spec().MarshalJSON() assert.JSONEq(t, cascadeRefExpanded, string(b)) } func TestFailsInvalidJSON(t *testing.T) { _, err := Analyzed(json.RawMessage([]byte("{]")), "") require.Error(t, err) } // issue go-swagger/go-swagger#1816 (regression when cloning original spec) func TestIssue1846(t *testing.T) { swaggerFile := "fixtures/bugs/1816/fixture-1816.yaml" document, err := Spec(swaggerFile) require.NoError(t, err) require.NotNil(t, document) sp, err := cloneSpec(document.Spec()) require.NoError(t, err) jazon, _ := json.MarshalIndent(sp, "", " ") rex := regexp.MustCompile(`"\$ref":\s*"(.+)"`) m := rex.FindAllStringSubmatch(string(jazon), -1) require.NotNil(t, m) for _, matched := range m { subMatch := matched[1] require.Truef(t, strings.HasPrefix(subMatch, "#/definitions") || strings.HasPrefix(subMatch, "#/responses"), "expected $ref to point either to definitions or responses section, got: %s", matched[0]) } } func TestEmbedded(t *testing.T) { swaggerFile := "fixtures/yaml/swagger/spec.yml" document, err := Spec(swaggerFile) require.NoError(t, err) require.NotNil(t, document) raw, err := json.Marshal(document.Raw()) require.NoError(t, err) spc, err := json.Marshal(document.Spec()) require.NoError(t, err) d, err := Embedded(raw, spc) require.NoError(t, err) require.NotNil(t, d) rawEmbedded, err := json.Marshal(d.Raw()) require.NoError(t, err) spcEmbedded, err := json.Marshal(d.Spec()) require.NoError(t, err) assert.JSONEq(t, string(raw), string(rawEmbedded)) assert.JSONEq(t, string(spc), string(spcEmbedded)) } func TestDocument(t *testing.T) { document, err := Embedded(PetStoreJSONMessage, PetStoreJSONMessage) require.NoError(t, err) require.Equal(t, "petstore.swagger.wordnik.com", document.Host()) orig, err := json.Marshal(document.OrigSpec()) require.NoError(t, err) require.JSONEq(t, string(PetStoreJSONMessage), string(orig)) cloned, err := json.Marshal(document.Pristine().Spec()) require.NoError(t, err) require.JSONEq(t, string(PetStoreJSONMessage), string(cloned)) spc := document.Spec() spc.Definitions = nil before := document.Spec() require.Empty(t, before.Definitions) reset := document.ResetDefinitions() afterReset, err := json.Marshal(reset.Spec()) require.NoError(t, err) require.JSONEq(t, string(PetStoreJSONMessage), string(afterReset)) } func BenchmarkAnalyzed(b *testing.B) { d := []byte(`{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "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": "petstore.swagger.wordnik.com", "basePath": "/api", "schemes": [ "http" ], "paths": { "/pets": { "get": { "security": [ { "basic": [] } ], "tags": [ "Pet Operations" ], "operationId": "getAllPets", "parameters": [ { "name": "status", "in": "query", "description": "The status to filter by", "type": "string" }, { "name": "limit", "in": "query", "description": "The maximum number of results to return", "type": "integer", "format": "int64" } ], "summary": "Finds all pets in the system", "responses": { "200": { "description": "Pet response", "schema": { "type": "array", "items": { "$ref": "#/definitions/Pet" } } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "post": { "security": [ { "basic": [] } ], "tags": [ "Pet Operations" ], "operationId": "createPet", "summary": "Creates a new pet", "consumes": ["application/x-yaml"], "produces": ["application/x-yaml"], "parameters": [ { "name": "pet", "in": "body", "description": "The Pet to create", "required": true, "schema": { "$ref": "#/definitions/newPet" } } ], "responses": { "200": { "description": "Created Pet response", "schema": { "$ref": "#/definitions/Pet" } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } } }`) for i := 0; i < 1000; i++ { d = append(d, []byte(`, "/pets/`)...) d = strconv.AppendInt(d, int64(i), 10) d = append(d, []byte(`": { "delete": { "security": [ { "apiKey": [] } ], "description": "Deletes the Pet by id", "operationId": "deletePet", "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to delete", "required": true, "type": "integer", "format": "int64" } ], "responses": { "204": { "description": "pet deleted" }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "get": { "tags": [ "Pet Operations" ], "operationId": "getPetById", "summary": "Finds the pet by id", "responses": { "200": { "description": "Pet response", "schema": { "$ref": "#/definitions/Pet" } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet", "required": true, "type": "integer", "format": "int64" } ] }`)...) } d = append(d, []byte(` }, "definitions": { "Category": { "id": "Category", "properties": { "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" } } }, "Pet": { "id": "Pet", "properties": { "category": { "$ref": "#/definitions/Category" }, "id": { "description": "unique identifier for the pet", "format": "int64", "maximum": 100.0, "minimum": 0.0, "type": "integer" }, "name": { "type": "string" }, "photoUrls": { "items": { "type": "string" }, "type": "array" }, "status": { "description": "pet status in the store", "enum": [ "available", "pending", "sold" ], "type": "string" }, "tags": { "items": { "$ref": "#/definitions/Tag" }, "type": "array" } }, "required": [ "id", "name" ] }, "newPet": { "anyOf": [ { "$ref": "#/definitions/Pet" }, { "required": [ "name" ] } ] }, "Tag": { "id": "Tag", "properties": { "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" } } }, "Error": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } }, "consumes": [ "application/json", "application/xml" ], "produces": [ "application/json", "application/xml", "text/plain", "text/html" ], "securityDefinitions": { "basic": { "type": "basic" }, "apiKey": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } } `)...) rm := json.RawMessage(d) b.ResetTimer() for i := 0; i < b.N; i++ { _, err := Analyzed(rm, "") if err != nil { b.Fatal(err) } } } const YAMLSpec = `swagger: '2.0' info: version: "1.0.0" title: Simple Search API description: | A very simple api description that makes a x-www-form-urlencoded only API to submit searches. produces: - application/json consumes: - application/json paths: /search: post: operationId: search summary: searches tasks description: searches the task titles and descriptions for a match consumes: - application/x-www-form-urlencoded parameters: - name: q in: formData type: string description: the search string required: true /tasks: get: operationId: getTasks summary: Gets Task objects. description: | Optional query param of **size** determines size of returned array tags: - tasks parameters: - name: size in: query description: Size of task list type: integer format: int32 default: 20 - name: completed in: query description: when true shows completed tasks type: boolean responses: default: description: Generic Error 200: description: Successful response headers: X-Rate-Limit: type: integer format: int32 X-Rate-Limit-Remaining: type: integer format: int32 default: 42 X-Rate-Limit-Reset: type: integer format: int32 default: "1449875311" X-Rate-Limit-Reset-Human: type: string default: 3 days X-Rate-Limit-Reset-Human-Number: type: string default: 3 Access-Control-Allow-Origin: type: string default: "*" schema: type: array items: $ref: "#/definitions/Task" post: operationId: createTask summary: Creates a 'Task' object. description: | Validates the content property for length etc. parameters: - name: body in: body schema: $ref: "#/definitions/Task" tags: - tasks responses: default: description: Generic Error 201: description: Task Created /tasks/{id}: parameters: - name: id in: path type: integer format: int32 description: The id of the task required: true minimum: 1 put: operationId: updateTask summary: updates a task. description: | Validates the content property for length etc. tags: - tasks parameters: - name: body in: body description: the updated task schema: $ref: "#/definitions/Task" responses: default: description: Generic Error 200: description: Task updated schema: $ref: "#/definitions/Task" delete: operationId: deleteTask summary: deletes a task description: | Deleting a task is irrevocable. tags: - tasks responses: default: description: Generic Error 204: description: Task Deleted definitions: Task: title: A Task object description: | This describes a task. Tasks require a content property to be set. required: - content type: object properties: id: title: the unique id of the task description: | This id property is autogenerated when a task is created. type: integer format: int64 readOnly: true content: title: The content of the task description: | Task content can contain [GFM](https://help.github.com/articles/github-flavored-markdown/). type: string minLength: 5 completed: title: when true this task is completed type: boolean creditcard: title: the credit card format usage type: string format: creditcard createdAt: title: task creation time type: string format: date-time readOnly: true ` // PetStoreJSONMessage json raw message for Petstore20 var PetStoreJSONMessage = json.RawMessage([]byte(PetStore20)) // PetStore20 json doc for swagger 2.0 pet store const PetStore20 = `{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "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": "petstore.swagger.wordnik.com", "basePath": "/api", "schemes": [ "http" ], "paths": { "/pets": { "get": { "security": [ { "basic": [] } ], "tags": [ "Pet Operations" ], "operationId": "getAllPets", "parameters": [ { "name": "status", "in": "query", "description": "The status to filter by", "type": "string" }, { "name": "limit", "in": "query", "description": "The maximum number of results to return", "type": "integer", "format": "int64" } ], "summary": "Finds all pets in the system", "responses": { "200": { "description": "Pet response", "schema": { "type": "array", "items": { "$ref": "#/definitions/Pet" } } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "post": { "security": [ { "basic": [] } ], "tags": [ "Pet Operations" ], "operationId": "createPet", "summary": "Creates a new pet", "consumes": ["application/x-yaml"], "produces": ["application/x-yaml"], "parameters": [ { "name": "pet", "in": "body", "description": "The Pet to create", "required": true, "schema": { "$ref": "#/definitions/newPet" } } ], "responses": { "200": { "description": "Created Pet response", "schema": { "$ref": "#/definitions/Pet" } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/pets/{id}": { "delete": { "security": [ { "apiKey": [] } ], "description": "Deletes the Pet by id", "operationId": "deletePet", "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to delete", "required": true, "type": "integer", "format": "int64" } ], "responses": { "204": { "description": "pet deleted" }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "get": { "tags": [ "Pet Operations" ], "operationId": "getPetById", "summary": "Finds the pet by id", "responses": { "200": { "description": "Pet response", "schema": { "$ref": "#/definitions/Pet" } }, "default": { "description": "Unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet", "required": true, "type": "integer", "format": "int64" } ] } }, "definitions": { "Category": { "id": "Category", "properties": { "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" } } }, "Pet": { "id": "Pet", "properties": { "category": { "$ref": "#/definitions/Category" }, "id": { "description": "unique identifier for the pet", "format": "int64", "maximum": 100.0, "minimum": 0.0, "type": "integer" }, "name": { "type": "string" }, "photoUrls": { "items": { "type": "string" }, "type": "array" }, "status": { "description": "pet status in the store", "enum": [ "available", "pending", "sold" ], "type": "string" }, "tags": { "items": { "$ref": "#/definitions/Tag" }, "type": "array" } }, "required": [ "id", "name" ] }, "newPet": { "anyOf": [ { "$ref": "#/definitions/Pet" }, { "required": [ "name" ] } ] }, "Tag": { "id": "Tag", "properties": { "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" } } }, "Error": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } }, "consumes": [ "application/json", "application/xml" ], "produces": [ "application/json", "application/xml", "text/plain", "text/html" ], "securityDefinitions": { "basic": { "type": "basic" }, "apiKey": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } } ` const expectedExpanded = ` { "produces":[ "application/json", "plain/text" ], "schemes":[ "https", "http" ], "swagger":"2.0", "info":{ "description":"Something", "title":"Something", "contact":{ "name":"Somebody", "url":"https://url.com", "email":"email@url.com" }, "version":"v1" }, "host":"security.sonusnet.com", "basePath":"/api", "paths":{ "/whatnot":{ "get":{ "description":"Get something", "responses":{ "200":{ "description":"The something", "schema":{ "description":"A collection of service events", "type":"object", "properties":{ "page":{ "description":"A description of a paged result", "type":"object", "properties":{ "page":{ "description":"the page that was requested", "type":"integer" }, "page_items":{ "description":"the number of items per page requested", "type":"integer" }, "pages":{ "description":"the total number of pages available", "type":"integer" }, "total_items":{ "description":"the total number of items available", "type":"integer", "format":"int64" } } }, "something":{ "description":"Something", "type":"object", "properties":{ "p1":{ "description":"A string", "type":"string" }, "p2":{ "description":"An integer", "type":"integer" } } } } } }, "500":{ "description":"Oops" } } } } }, "definitions":{ "Something":{ "description":"A collection of service events", "type":"object", "properties":{ "page":{ "description":"A description of a paged result", "type":"object", "properties":{ "page":{ "description":"the page that was requested", "type":"integer" }, "page_items":{ "description":"the number of items per page requested", "type":"integer" }, "pages":{ "description":"the total number of pages available", "type":"integer" }, "total_items":{ "description":"the total number of items available", "type":"integer", "format":"int64" } } }, "something":{ "description":"Something", "type":"object", "properties":{ "p1":{ "description":"A string", "type":"string" }, "p2":{ "description":"An integer", "type":"integer" } } } } } } } ` const cascadeRefExpanded = ` { "swagger": "2.0", "consumes":[ "application/json" ], "produces":[ "application/json" ], "schemes":[ "http" ], "host": "api.example.com", "info":{ "description":"recursively following JSON references", "title":"test 1", "contact":{ "name":"Fred" }, "version":"0.1.1" }, "paths":{ "/getAll":{ "get":{ "operationId":"getAll", "parameters":[ { "description":"max number of results", "name":"a", "in":"body", "schema":{ "type":"string" } } ], "responses":{ "200":{ "description":"Success", "schema":{ "type":"array", "items":{ "type":"string" } } } } } } }, "definitions":{ "a":{ "type":"string" }, "b":{ "type":"array", "items":{ "type":"string" } } } } ` func TestSpecCircular(t *testing.T) { swaggerFile := "fixtures/json/resources/pathLoaderIssue.json" document, err := Spec(swaggerFile) require.NoError(t, err) require.NotNil(t, document) } func TestIssueSpec145(t *testing.T) { t.Run("with remote $ref", func(t *testing.T) { docPath := filepath.Join("fixtures", "bugs", "145", "Program Files (x86)", "AppName", "todos.json") t.Run("with Spec loader", func(t *testing.T) { document, err := Spec(docPath) require.NoError(t, err) require.NotNil(t, document) _, err = document.Expanded() require.NoError(t, err) }) t.Run("with JSONSpec loader", func(t *testing.T) { document, err := JSONSpec(docPath) require.NoError(t, err) require.NotNil(t, document) _, err = document.Expanded() require.NoError(t, err) }) }) t.Run("with self-contained root", func(t *testing.T) { docPath := filepath.Join("fixtures", "bugs", "145", "Program Files (x86)", "AppName", "todos-expanded.json") t.Run("with Spec loader", func(t *testing.T) { document, err := Spec(docPath) require.NoError(t, err) require.NotNil(t, document) require.Equal(t, docPath, document.SpecFilePath()) expanded, err := document.Expanded() require.NoError(t, err) require.Equal(t, docPath, expanded.SpecFilePath()) }) t.Run("with JSONSpec loader", func(t *testing.T) { document, err := JSONSpec(docPath) require.NoError(t, err) require.NotNil(t, document) _, err = document.Expanded() require.NoError(t, err) t.Run("with Pristine", func(t *testing.T) { pristine := document.Pristine() require.Equal(t, document.SpecFilePath(), pristine.SpecFilePath()) }) }) }) }