pax_global_header00006660000000000000000000000064132123123720014506gustar00rootroot0000000000000052 comment=2a2b323bab96e6b1fdee110e57d959322446e9c9 golang-github-go-openapi-loads-0.15.0/000077500000000000000000000000001321231237200174545ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/.drone.sec000066400000000000000000000020611321231237200213340ustar00rootroot00000000000000eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.xUjixvmMMeampw0Doyr_XLvcV5ICmDgDFmlcWqgmO84O3Hwn6dqbMkwOjpKMOyEJW_98b5Om5ED59IFt2S0T_OarlrsJL8jOK5fqxSMNXy2w8LfI-e5l1URverW41ofAVK8m9wK05q2BSJM_M6PyyODaQeDBiCVK1HreMZBlXpuUDVtBMPILQoga0eSZOsTR3DYEpZIS0A0Rsa5yIhMYR5d5-JMYqbqOCB7tNJ-BM83OzYgL7Hrz0J15kqaJmhQ-GJoMJDzOemSO9KxLCOfSPp11R_G3Mfd48xYnuiRuPOTakbOCLxuYviH6uoGVIOhnMyY9qKiDKbOn4BQUi1-igA.6qjQzq9nzAxRRKV_.z79R5cMFAEuEaAh6U9ykiL8oIqzMbs_I2C-hSFRh3HYRJ4fTB-9LrcbF0uASIOq7bBn4OQzW-0QFwYOs1uaawmrByGngV5d0afiZf_LBKcmTF2vtxRi_A_nxD-EHoPmh3lKBU5WNDe_8kLjEeS89HeyyFPuv5iQbqhzdqPFohHKVigwVqVYYLjB8GWQ4t7tC4c8l5rHanaXf71W0e3op2m8bebpZL0JPGhnULVA1oU27TYeLsO112JkIYtBwZxzvAs--bBFoKeGJWVMFzrKN68UACGZ9RFw0uGJbBmVC4-jRuIc6XpqeEqw3KG-rjFzkeEor3575qW-8kiXYqpub9SFUc3SSZkxJ8hB3SrnMBOuDUSenrXNpAbltmV3KAALzN3_bMBQuihwSRIn0Hg7-Dpni8BieMe44RMDvRu6p_71aeU_KW4V7Umy_h8gpIvQFuKGdTQH2ahsyCXL0ojqjMbVMdoWpDQTQ2_Fy8Qt_p2kJ8BgDo-1Akd4a6BNU2NGqsdnrJmtVKcTqLBadf9ylCwxHdGVrtNYORALSms2T6Q1s-poQnMjIwN8lnUD8ABUBpt4uVtrYkiWPVwrwywLQeiHhR-pboe_53kWDAx4Hy4rpbKsaxanYhy_bEbAYKb3aIUA.75GD4kRBCQdcGFYP1QYdCggolang-github-go-openapi-loads-0.15.0/.drone.yml000066400000000000000000000015511321231237200213660ustar00rootroot00000000000000clone: path: github.com/go-openapi/loads matrix: GO_VERSION: - "1.6" build: integration: image: golang:$$GO_VERSION pull: true environment: GOCOVMODE: "count" commands: - go get -u github.com/axw/gocov/gocov - go get -u gopkg.in/matm/v1/gocov-html - go get -u github.com/cee-dub/go-junit-report - go get -u github.com/stretchr/testify/assert - go get -u gopkg.in/yaml.v2 - go get -u github.com/go-openapi/swag - go get -u github.com/go-openapi/analysis - go get -u github.com/go-openapi/spec - ./hack/build-drone.sh notify: slack: channel: bots webhook_url: $$SLACK_URL username: drone publish: coverage: server: https://coverage.vmware.run token: $$GITHUB_TOKEN # threshold: 70 # must_increase: true when: matrix: GO_VERSION: "1.6" golang-github-go-openapi-loads-0.15.0/.editorconfig000066400000000000000000000010331321231237200221260ustar00rootroot00000000000000# 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 golang-github-go-openapi-loads-0.15.0/.github/000077500000000000000000000000001321231237200210145ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/.github/CONTRIBUTING.md000066400000000000000000000114601321231237200232470ustar00rootroot00000000000000## 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`. golang-github-go-openapi-loads-0.15.0/.gitignore000066400000000000000000000000611321231237200214410ustar00rootroot00000000000000secrets.yml coverage.out profile.cov profile.out golang-github-go-openapi-loads-0.15.0/.travis.yml000066400000000000000000000020021321231237200215570ustar00rootroot00000000000000language: go go: - 1.8 install: - go get -u github.com/stretchr/testify - go get -u github.com/go-openapi/analysis - go get -u github.com/go-openapi/spec - go get -u github.com/go-openapi/swag - go get -u gopkg.in/yaml.v2 script: - ./hack/coverage after_success: - bash <(curl -s https://codecov.io/bash) notifications: slack: secure: OxkPwVp35qBTUilgWC8xykSj+sGMcj0h8IIOKD+Rflx2schZVlFfdYdyVBM+s9OqeOfvtuvnR9v1Ye2rPKAvcjWdC4LpRGUsgmItZaI6Um8Aj6+K9udCw5qrtZVfOVmRu8LieH//XznWWKdOultUuniW0MLqw5+II87Gd00RWbCGi0hk0PykHe7uK+PDA2BEbqyZ2WKKYCvfB3j+0nrFOHScXqnh0V05l2E83J4+Sgy1fsPy+1WdX58ZlNBG333ibaC1FS79XvKSmTgKRkx3+YBo97u6ZtUmJa5WZjf2OdLG3KIckGWAv6R5xgxeU31N0Ng8L332w/Edpp2O/M2bZwdnKJ8hJQikXIAQbICbr+lTDzsoNzMdEIYcHpJ5hjPbiUl3Bmd+Jnsjf5McgAZDiWIfpCKZ29tPCEkVwRsOCqkyPRMNMzHHmoja495P5jR+ODS7+J8RFg5xgcnOgpP9D4Wlhztlf5WyZMpkLxTUD+bZq2SRf50HfHFXTkfq22zPl3d1eq0yrLwh/Z/fWKkfb6SyysROL8y6s8u3dpFX1YHSg0BR6i913h4aoZw9B2BG27cafLLTwKYsp2dFo1PWl4O6u9giFJIeqwloZHLKKrwh0cBFhB7RH0I58asxkZpCH6uWjJierahmHe7iS+E6i+9oCHkOZ59hmCYNimIs3hM= golang-github-go-openapi-loads-0.15.0/CODE_OF_CONDUCT.md000066400000000000000000000062411321231237200222560ustar00rootroot00000000000000# 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/ golang-github-go-openapi-loads-0.15.0/LICENSE000066400000000000000000000261361321231237200204710ustar00rootroot00000000000000 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. golang-github-go-openapi-loads-0.15.0/README.md000066400000000000000000000012421321231237200207320ustar00rootroot00000000000000# Loads OAI specs [![Build Status](https://travis-ci.org/go-openapi/loads.svg?branch=master)](https://travis-ci.org/go-openapi/loads) [![codecov](https://codecov.io/gh/go-openapi/loads/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/loads) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) [![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) Loading of OAI specification documents from local or remote locations. golang-github-go-openapi-loads-0.15.0/fixtures/000077500000000000000000000000001321231237200213255ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/000077500000000000000000000000001321231237200222765ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/models/000077500000000000000000000000001321231237200235615ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithArrayRef.json000066400000000000000000000003351321231237200300450ustar00rootroot00000000000000{ "required": [ "id" ], "properties": { "id": { "type": "integer", "format": "int64" }, "children": { "type": "array", "items": { "$ref": "Person" } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithComposition.json000066400000000000000000000031051321231237200306330ustar00rootroot00000000000000{ "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" ] } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithDateTimeMap.json000066400000000000000000000001541321231237200304630ustar00rootroot00000000000000{ "description": "true", "additionalProperties": { "type": "string", "format": "date-time" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithExamples.json000066400000000000000000000006271321231237200301140ustar00rootroot00000000000000{ "definitions": { "Pet": { "properties": { "name": { "type": "string" } }, "required": [ "name" ] }, "Dog": { "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, "required": [ "name" ] } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithInt32Map.json000066400000000000000000000002041321231237200276620ustar00rootroot00000000000000{ "description": "This is a Map[String, Integer]", "additionalProperties": { "type": "integer", "format": "int32" } } golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithInt64Map.json000066400000000000000000000001511321231237200276700ustar00rootroot00000000000000{ "description": "true", "additionalProperties": { "type": "integer", "format": "int64" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithMultipleProperties.json000066400000000000000000000022711321231237200322030ustar00rootroot00000000000000{ "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" } } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithObjectMap.json000066400000000000000000000004261321231237200301770ustar00rootroot00000000000000{ "description": "This is a Map[String, { id: Long, name: String}]", "additionalProperties": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithPrimitiveArray.json000066400000000000000000000003751321231237200313050ustar00rootroot00000000000000{ "required": [ "id" ], "properties": { "id": { "type": "integer", "format": "int64" }, "childrensAges": { "type": "array", "items": { "type": "integer", "format": "int32" } } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithStringProperty.json000066400000000000000000000001351321231237200313430ustar00rootroot00000000000000{ "description": "true", "properties": { "name": { "type": "string" } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/modelWithXmlAttributes.json000066400000000000000000000006701321231237200311430ustar00rootroot00000000000000{ "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 } } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/models.json000066400000000000000000000002561321231237200257420ustar00rootroot00000000000000{ "definitions": { "Pet": { "properties": { "name": { "type": "string" } }, "required": [ "name" ] } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/multipleModels.json000066400000000000000000000006271321231237200274600ustar00rootroot00000000000000{ "definitions": { "Pet": { "properties": { "name": { "type": "string" } }, "required": [ "name" ] }, "Dog": { "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, "required": [ "name" ] } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/000077500000000000000000000000001321231237200257555ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithBooleanArray.json000066400000000000000000000000751321231237200336710ustar00rootroot00000000000000{ "type": "array", "items": { "type": "boolean" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithByteArray.json000066400000000000000000000001221321231237200332060ustar00rootroot00000000000000{ "type": "array", "items": { "type": "string", "format": "byte" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithComplexArray.json000066400000000000000000000001011321231237200337070ustar00rootroot00000000000000{ "type": "array", "items": { "$ref": "ComplexType" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithDateTimeArray.json000066400000000000000000000001271321231237200340040ustar00rootroot00000000000000{ "type": "array", "items": { "type": "string", "format": "date-time" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithInt32Array.json000066400000000000000000000001241321231237200332040ustar00rootroot00000000000000{ "type": "array", "items": { "type": "integer", "format": "int32" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithInt64Array.json000066400000000000000000000001241321231237200332110ustar00rootroot00000000000000{ "type": "array", "items": { "type": "integer", "format": "int64" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithRef.json000066400000000000000000000001051321231237200320210ustar00rootroot00000000000000{ "$ref": "Foo", "description": "a boolean", "readOnly": true }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/propertyWithStringArray.json000066400000000000000000000000741321231237200335570ustar00rootroot00000000000000{ "type": "array", "items": { "type": "string" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/simpleBooleanProperty.json000066400000000000000000000001121321231237200332000ustar00rootroot00000000000000{ "type": "boolean", "description": "a boolean", "readOnly": true } golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/simpleByteProperty.json000066400000000000000000000000521321231237200325270ustar00rootroot00000000000000{ "type": "string", "format": "byte" }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/simpleDateTimeProperty.json000066400000000000000000000000571321231237200333250ustar00rootroot00000000000000{ "type": "string", "format": "date-time" }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/simpleInt32Property.json000066400000000000000000000000541321231237200325250ustar00rootroot00000000000000{ "type": "integer", "format": "int32" }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/simpleInt64Property.json000066400000000000000000000000541321231237200325320ustar00rootroot00000000000000{ "type": "integer", "format": "int64" }golang-github-go-openapi-loads-0.15.0/fixtures/json/models/properties/simpleStringProperty.json000066400000000000000000000000271321231237200330740ustar00rootroot00000000000000{ "type": "string" } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/000077500000000000000000000000001321231237200243105ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/cascadingSchemes.json000066400000000000000000000042001321231237200304230ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/commonParameters.json000066400000000000000000000041701321231237200305210ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/multipleMimeTypes.json000066400000000000000000000047321321231237200307010ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/operations/000077500000000000000000000000001321231237200264735ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/operations/operationWithTags.json000066400000000000000000000011771321231237200330470ustar00rootroot00000000000000{ "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"} } } }stringPathAndBoolQueryParamResource.json000066400000000000000000000014121321231237200364060ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/operations{ "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"} } } }stringPathParamResource.json000066400000000000000000000013261321231237200341250ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/operations{ "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"} } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/000077500000000000000000000000001321231237200264535ustar00rootroot00000000000000bodyComplexArrayParameter.json000066400000000000000000000003171321231237200344150ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "type": "array", "items": { "type": "string" }, "format": "csv" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/bodyComplexParameter.json000066400000000000000000000002141321231237200334710ustar00rootroot00000000000000{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "$ref": "User" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/bodyInt64Parameter.json000066400000000000000000000002241321231237200327670ustar00rootroot00000000000000{ "name": "id", "in": "body", "description": "id to add", "required": true, "schema": { "type": "integer", "format": "int64" } }bodyStringArrayParameter.json000066400000000000000000000002761321231237200342600ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "type": "array", "items": { "type": "string" } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/bodyStringParameter.json000066400000000000000000000002161321231237200333320ustar00rootroot00000000000000{ "name": "user", "in": "body", "description": "user to add to the system", "required": true, "schema": { "type": "string" } }formDataComplexParameter.json000066400000000000000000000001731321231237200342160ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "firstName", "in": "formData", "description": "users first name", "required": true, "$ref": "Nothing" }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/formDataInt64Parameter.json000066400000000000000000000002121321231237200335640ustar00rootroot00000000000000{ "name": "id", "in": "formData", "description": "username to fetch", "required": true, "type": "integer", "format": "int64" }formDataStringArrayParameter.json000066400000000000000000000002441321231237200350530ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "user", "in": "formData", "description": "user to add to the system", "required": true, "type": "array", "items": { "type": "string" } }formDataStringParameter.json000066400000000000000000000001721321231237200340540ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "firstName", "in": "formData", "description": "users first name", "required": true, "type": "string" }headerInt64ArrayParameter.json000066400000000000000000000003411321231237200342020ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "type": "array", "items": { "type": "integer", "format": "int64" }, "collectionFormat": "csv" }headerStringArrayParameter.json000066400000000000000000000003111321231237200345410ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/headerStringParameter.json000066400000000000000000000002021321231237200336200ustar00rootroot00000000000000{ "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "type": "string" }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/pathInt64Parameter.json000066400000000000000000000002121321231237200327630ustar00rootroot00000000000000{ "name": "id", "in": "path", "description": "username to fetch", "required": true, "type": "integer", "format": "int64" }pathStringArrayParameter.json000066400000000000000000000002761321231237200342570ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "usernames", "in": "path", "description": "usernames to pass", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/pathStringParameter.json000066400000000000000000000001661321231237200333350ustar00rootroot00000000000000{ "name": "username", "in": "path", "description": "username to fetch", "required": true, "type": "string" }queryInt64ArrayParameter.json000066400000000000000000000003301321231237200341150ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "id", "in": "query", "description": "ID of the object to fetch", "required": true, "type": "array", "items": { "type": "integer", "format": "int64" }, "collectionFormat": "csv" }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters/queryStringParameter.json000066400000000000000000000002171321231237200335430ustar00rootroot00000000000000{ "name": "id", "in": "query", "description": "ID of the object to fetch", "required": true, "type": "integer", "format": "int64" }queryWithComplexParameter.json000066400000000000000000000002331321231237200344570ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/parameters{ "name": "id", "in": "query", "description": "a complex object which should not validate", "required": true, "schema": { "$ref": "Pet" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/resourceWithExamplePayload.json000066400000000000000000000050521321231237200325160ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/resourceWithLinkedDefinitions.json000066400000000000000000000025511321231237200332140ustar00rootroot00000000000000{ "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" } } } } } resourceWithLinkedDefinitions_part1.json000066400000000000000000000013751321231237200342470ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/resources{ "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" } } } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/resourceWithRelativeHost.json000066400000000000000000000041401321231237200322170ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/reusableParameters.json000066400000000000000000000044161321231237200310360ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/securityExample.json000066400000000000000000000157501321231237200303760ustar00rootroot00000000000000{ "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" } } } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/stringPathParamResource.json000066400000000000000000000041401321231237200320160ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/taggedResource.json000066400000000000000000000047441321231237200301570ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/resources/vendorExtensionExamples.json000066400000000000000000000046621321231237200321040ustar00rootroot00000000000000{ "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" } } } } } golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/000077500000000000000000000000001321231237200243175ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/complexArrayResponse.json000066400000000000000000000002231321231237200313740ustar00rootroot00000000000000{ "description": "A complex object array response", "schema": { "type": "array", "items": { "$ref": "VeryComplexType" } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/dateTimeResponse.json000066400000000000000000000001561321231237200304670ustar00rootroot00000000000000{ "description": "A date-time response", "schema": { "type": "string", "format": "date-time" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/int32Response.json000066400000000000000000000001571321231237200276730ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "integer", "format": "int32" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/int64Response.json000066400000000000000000000001571321231237200277000ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "integer", "format": "int64" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/multipleResponses.json000066400000000000000000000004261321231237200307510ustar00rootroot00000000000000{ "200": { "description": "simple string response", "schema": { "type": "string" } }, "201": { "description": "object created" }, "default": { "description": "oops", "schema": { "type": "integer", "format": "int32" } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/stringArrayResponse.json000066400000000000000000000002021321231237200312300ustar00rootroot00000000000000{ "description": "A string array response", "schema": { "type": "array", "items": { "type": "string" } } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/stringResponse.json000066400000000000000000000001271321231237200302370ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "string" } }golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/stringResponseWithHeader.json000066400000000000000000000002611321231237200322030ustar00rootroot00000000000000{ "description": "A simple string response", "schema": { "type": "string" }, "headers": { "is-dog": {"type": "boolean"}, "is-cat": {"type": "boolean"} } } golang-github-go-openapi-loads-0.15.0/fixtures/json/responses/voidResponse.json000066400000000000000000000000451321231237200276710ustar00rootroot00000000000000{ "description": "object created" }golang-github-go-openapi-loads-0.15.0/fixtures/yaml/000077500000000000000000000000001321231237200222675ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/.gitkeep000066400000000000000000000000001321231237200237060ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/000077500000000000000000000000001321231237200235525ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithArrayRef.yaml000066400000000000000000000001631321231237200300260ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} children: {type: array, items: {$ref: Person}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithComposition.yaml000066400000000000000000000014641321231237200306230ustar00rootroot00000000000000definitions: 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]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithDateTimeMap.yaml000066400000000000000000000001151321231237200304420ustar00rootroot00000000000000description: 'true' additionalProperties: type: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithExamples.yaml000066400000000000000000000002551321231237200300730ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithInt32Map.yaml000066400000000000000000000001441321231237200276470ustar00rootroot00000000000000description: 'This is a Map[String, Integer]' additionalProperties: type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithInt64Map.yaml000066400000000000000000000001121321231237200276470ustar00rootroot00000000000000description: 'true' additionalProperties: type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithMultipleProperties.yaml000066400000000000000000000012541321231237200321650ustar00rootroot00000000000000description: '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}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithObjectMap.yaml000066400000000000000000000003101321231237200301510ustar00rootroot00000000000000description: "This is a Map[String, { id: Long, name: String}]" additionalProperties: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithPrimitiveArray.yaml000066400000000000000000000002101321231237200312530ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} childrensAges: {type: array, items: {type: integer, format: int32}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithStringProperty.yaml000066400000000000000000000000671321231237200313310ustar00rootroot00000000000000description: 'true' properties: name: {type: string} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/modelWithXmlAttributes.yaml000066400000000000000000000003721321231237200311240ustar00rootroot00000000000000description: '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}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/models.yaml000066400000000000000000000001131321231237200257140ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/multipleModels.yaml000066400000000000000000000002551321231237200274370ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/000077500000000000000000000000001321231237200257465ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithBooleanArray.yaml000066400000000000000000000000431321231237200336460ustar00rootroot00000000000000type: array items: type: boolean golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithByteArray.yaml000066400000000000000000000000611321231237200331720ustar00rootroot00000000000000type: array items: type: string format: byte golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithComplexArray.yaml000066400000000000000000000000471321231237200337020ustar00rootroot00000000000000type: array items: $ref: ComplexType golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithDateTimeArray.yaml000066400000000000000000000000661321231237200337700ustar00rootroot00000000000000type: array items: type: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithInt32Array.yaml000066400000000000000000000000631321231237200331700ustar00rootroot00000000000000type: array items: type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithInt64Array.yaml000066400000000000000000000000631321231237200331750ustar00rootroot00000000000000type: array items: type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithRef.yaml000066400000000000000000000000621321231237200320050ustar00rootroot00000000000000$ref: Foo description: 'a boolean' readOnly: true golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/propertyWithStringArray.yaml000066400000000000000000000000421321231237200335340ustar00rootroot00000000000000type: array items: type: string golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/simpleBooleanProperty.yaml000066400000000000000000000000661321231237200331720ustar00rootroot00000000000000type: boolean description: 'a boolean' readOnly: true golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/simpleByteProperty.yaml000066400000000000000000000000321321231237200325070ustar00rootroot00000000000000type: string format: byte golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/simpleDateTimeProperty.yaml000066400000000000000000000000371321231237200333050ustar00rootroot00000000000000type: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/simpleInt32Property.yaml000066400000000000000000000000341321231237200325050ustar00rootroot00000000000000type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/simpleInt64Property.yaml000066400000000000000000000000341321231237200325120ustar00rootroot00000000000000type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/models/properties/simpleStringProperty.yaml000066400000000000000000000000151321231237200330530ustar00rootroot00000000000000type: string golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/000077500000000000000000000000001321231237200243015ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/cascadingSchemes.yaml000066400000000000000000000023761321231237200304210ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/commonParameters.yaml000066400000000000000000000023521321231237200305030ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/multipleMimeTypes.yaml000066400000000000000000000030631321231237200306570ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/operations/000077500000000000000000000000001321231237200264645ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/operations/operationWithTags.yaml000066400000000000000000000007001321231237200330200ustar00rootroot00000000000000description: '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}} stringPathAndBoolQueryParamResource.yaml000066400000000000000000000010331321231237200363670ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/operationsdescription: '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}} stringPathParamResource.yaml000066400000000000000000000010051321231237200341010ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/operationsdescription: '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}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/000077500000000000000000000000001321231237200264445ustar00rootroot00000000000000bodyComplexArrayParameter.yaml000066400000000000000000000002101321231237200343670ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} format: csv golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/bodyComplexParameter.yaml000066400000000000000000000001411321231237200334520ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: $ref: User golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/bodyInt64Parameter.yaml000066400000000000000000000001421321231237200327500ustar00rootroot00000000000000name: id in: body description: 'id to add' required: true schema: type: integer format: int64 bodyStringArrayParameter.yaml000066400000000000000000000001721321231237200342350ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/bodyStringParameter.yaml000066400000000000000000000001431321231237200333130ustar00rootroot00000000000000name: user in: body description: 'user to add to the system' required: true schema: type: string formDataComplexParameter.yaml000066400000000000000000000001321321231237200341730ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: firstName in: formData description: 'users first name' required: true $ref: Nothing golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/formDataInt64Parameter.yaml000066400000000000000000000001421321231237200335500ustar00rootroot00000000000000name: id in: formData description: 'username to fetch' required: true type: integer format: int64 formDataStringArrayParameter.yaml000066400000000000000000000001621321231237200350340ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: user in: formData description: 'user to add to the system' required: true type: array items: type: string formDataStringParameter.yaml000066400000000000000000000001311321231237200340310ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: firstName in: formData description: 'users first name' required: true type: string headerInt64ArrayParameter.yaml000066400000000000000000000002351321231237200341660ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: token in: header description: 'token to be passed as a header' required: true type: array items: type: integer format: int64 collectionFormat: csv headerStringArrayParameter.yaml000066400000000000000000000002141321231237200345250ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: token in: header description: 'token to be passed as a header' required: true type: array items: type: string collectionFormat: csv golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/headerStringParameter.yaml000066400000000000000000000001411321231237200336040ustar00rootroot00000000000000name: token in: header description: 'token to be passed as a header' required: true type: string golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/pathInt64Parameter.yaml000066400000000000000000000001361321231237200327520ustar00rootroot00000000000000name: id in: path description: 'username to fetch' required: true type: integer format: int64 pathStringArrayParameter.yaml000066400000000000000000000002011321231237200342250ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: usernames in: path description: 'usernames to pass' required: true type: array items: type: string collectionFormat: csv golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/pathStringParameter.yaml000066400000000000000000000001251321231237200333120ustar00rootroot00000000000000name: username in: path description: 'username to fetch' required: true type: string queryInt64ArrayParameter.yaml000066400000000000000000000002241321231237200341010ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: id in: query description: 'ID of the object to fetch' required: true type: array items: type: integer format: int64 collectionFormat: csv golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parameters/queryStringParameter.yaml000066400000000000000000000001471321231237200335270ustar00rootroot00000000000000name: id in: query description: 'ID of the object to fetch' required: true type: integer format: int64 queryWithComplexParameter.yaml000066400000000000000000000001601321231237200344400ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/parametersname: id in: query description: 'a complex object which should not validate' required: true schema: $ref: Pet golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/resourceWithExamplePayload.yaml000066400000000000000000000026141321231237200325010ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/resourceWithLinkedDefinitions.yaml000066400000000000000000000016671321231237200332050ustar00rootroot00000000000000swagger: '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}}} resourceWithLinkedDefinitions_part1.yaml000066400000000000000000000007051321231237200342250ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resourcesget: 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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/resourceWithRelativeHost.yaml000066400000000000000000000023311321231237200322010ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/reusableParameters.yaml000066400000000000000000000026061321231237200310170ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/securityExample.yaml000066400000000000000000000126361321231237200303600ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/stringPathParamResource.yaml000066400000000000000000000023541321231237200320050ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/taggedResource.yaml000066400000000000000000000030061321231237200301270ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/resources/vendorExtensionExamples.yaml000066400000000000000000000027571321231237200320710ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/000077500000000000000000000000001321231237200243105ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/complexArrayResponse.yaml000066400000000000000000000001461321231237200313620ustar00rootroot00000000000000description: 'A complex object array response' schema: type: array items: {$ref: VeryComplexType} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/dateTimeResponse.yaml000066400000000000000000000001171321231237200304460ustar00rootroot00000000000000description: 'A date-time response' schema: type: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/int32Response.yaml000066400000000000000000000001201321231237200276430ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/int64Response.yaml000066400000000000000000000001201321231237200276500ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/multipleResponses.yaml000066400000000000000000000002651321231237200307340ustar00rootroot00000000000000'200': description: 'simple string response' schema: {type: string} '201': description: 'object created' default: description: oops schema: {type: integer, format: int32} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/stringArrayResponse.yaml000066400000000000000000000001251321231237200312160ustar00rootroot00000000000000description: 'A string array response' schema: type: array items: {type: string} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/stringResponse.yaml000066400000000000000000000000771321231237200302250ustar00rootroot00000000000000description: 'A simple string response' schema: type: string golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/stringResponseWithHeader.yaml000066400000000000000000000001741321231237200321700ustar00rootroot00000000000000description: 'A simple string response' schema: type: string headers: is-dog: {type: boolean} is-cat: {type: boolean} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/responses/voidResponse.yaml000066400000000000000000000000361321231237200276530ustar00rootroot00000000000000description: 'object created' golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/000077500000000000000000000000001321231237200237265ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/1/000077500000000000000000000000001321231237200240665ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/1/2/000077500000000000000000000000001321231237200242275ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/1/2/3/000077500000000000000000000000001321231237200243715ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/1/2/3/4/000077500000000000000000000000001321231237200245345ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/1/2/3/4/swagger.yaml000066400000000000000000000015421321231237200270610ustar00rootroot00000000000000swagger: '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' golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/shared/000077500000000000000000000000001321231237200251745ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/shared/definitions/000077500000000000000000000000001321231237200275075ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/shared/definitions/page.yaml000066400000000000000000000007621321231237200313140ustar00rootroot00000000000000definitions: 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 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/shared/something.yaml000066400000000000000000000013441321231237200300570ustar00rootroot00000000000000swagger: '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 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/spec.yml000066400000000000000000000012271321231237200254050ustar00rootroot00000000000000swagger: "2.0" info: version: 0.1.1 title: test 1 description: recursively following JSON references contact: name: Fred 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'golang-github-go-openapi-loads-0.15.0/fixtures/yaml/swagger/test3-ter-model-schema.json000066400000000000000000000004341321231237200310100ustar00rootroot00000000000000{ "$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" } } } }golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/000077500000000000000000000000001321231237200232315ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/.gitkeep000066400000000000000000000000001321231237200246500ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/000077500000000000000000000000001321231237200245145ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithArrayRef.yaml000066400000000000000000000001631321231237200307700ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} children: {type: array, items: {$ref: Person}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithComposition.yaml000066400000000000000000000014641321231237200315650ustar00rootroot00000000000000definitions: 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]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithDateTimeMap.yaml000066400000000000000000000001151321231237200314040ustar00rootroot00000000000000description: 'true' additionalProperties: type: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithExamples.yaml000066400000000000000000000002551321231237200310350ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithInt32Map.yaml000066400000000000000000000001441321231237200306110ustar00rootroot00000000000000description: 'This is a Map[String, Integer]' additionalProperties: type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithInt64Map.yaml000066400000000000000000000001121321231237200306110ustar00rootroot00000000000000description: 'true' additionalProperties: type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithMultipleProperties.yaml000066400000000000000000000012541321231237200331270ustar00rootroot00000000000000description: '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}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithObjectMap.yaml000066400000000000000000000003101321231237200311130ustar00rootroot00000000000000description: "This is a Map[String, { id: Long, name: String}]" additionalProperties: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithPrimitiveArray.yaml000066400000000000000000000002101321231237200322150ustar00rootroot00000000000000required: - id properties: id: {type: integer, format: int64} childrensAges: {type: array, items: {type: integer, format: int32}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithStringProperty.yaml000066400000000000000000000000671321231237200322730ustar00rootroot00000000000000description: 'true' properties: name: {type: string} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/modelWithXmlAttributes.yaml000066400000000000000000000003721321231237200320660ustar00rootroot00000000000000description: '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}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/models.yaml000066400000000000000000000001131321231237200266560ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/multipleModels.yaml000066400000000000000000000002551321231237200304010ustar00rootroot00000000000000definitions: Pet: {properties: {name: {type: string}}, required: [name]} Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/properties/000077500000000000000000000000001321231237200267105ustar00rootroot00000000000000propertyWithBooleanArray.yaml000066400000000000000000000000431321231237200345310ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: type: boolean propertyWithByteArray.yaml000066400000000000000000000000611321231237200340550ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: type: string format: byte propertyWithComplexArray.yaml000066400000000000000000000000471321231237200345650ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: $ref: ComplexType propertyWithDateTimeArray.yaml000066400000000000000000000000661321231237200346530ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: type: string format: date-time propertyWithInt32Array.yaml000066400000000000000000000000631321231237200340530ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: type: integer format: int32 propertyWithInt64Array.yaml000066400000000000000000000000631321231237200340600ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/properties/propertyWithRef.yaml000066400000000000000000000000621321231237200327470ustar00rootroot00000000000000$ref: Foo description: 'a boolean' readOnly: true propertyWithStringArray.yaml000066400000000000000000000000421321231237200344170ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: array items: type: string simpleBooleanProperty.yaml000066400000000000000000000000661321231237200340550ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: boolean description: 'a boolean' readOnly: true golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/properties/simpleByteProperty.yaml000066400000000000000000000000321321231237200334510ustar00rootroot00000000000000type: string format: byte simpleDateTimeProperty.yaml000066400000000000000000000000371321231237200341700ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/propertiestype: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/properties/simpleInt32Property.yaml000066400000000000000000000000341321231237200334470ustar00rootroot00000000000000type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/properties/simpleInt64Property.yaml000066400000000000000000000000341321231237200334540ustar00rootroot00000000000000type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/models/properties/simpleStringProperty.yaml000066400000000000000000000000151321231237200340150ustar00rootroot00000000000000type: string golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/000077500000000000000000000000001321231237200252435ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/cascadingSchemes.yaml000066400000000000000000000023761321231237200313630ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/commonParameters.yaml000066400000000000000000000023521321231237200314450ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/multipleMimeTypes.yaml000066400000000000000000000030631321231237200316210ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/operations/000077500000000000000000000000001321231237200274265ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/operations/operationWithTags.yaml000066400000000000000000000007001321231237200337620ustar00rootroot00000000000000description: '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}} stringPathAndBoolQueryParamResource.yaml000066400000000000000000000010331321231237200373310ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/operationsdescription: '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}} stringPathParamResource.yaml000066400000000000000000000010051321231237200350430ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/operationsdescription: '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}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parameters/000077500000000000000000000000001321231237200274065ustar00rootroot00000000000000bodyComplexArrayParameter.yaml000066400000000000000000000002101321231237200353310ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} format: csv bodyComplexParameter.yaml000066400000000000000000000001411321231237200343350ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: user in: body description: 'user to add to the system' required: true schema: $ref: User bodyInt64Parameter.yaml000066400000000000000000000001421321231237200336330ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: id in: body description: 'id to add' required: true schema: type: integer format: int64 bodyStringArrayParameter.yaml000066400000000000000000000001721321231237200351770ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: user in: body description: 'user to add to the system' required: true schema: type: array items: {type: string} bodyStringParameter.yaml000066400000000000000000000001431321231237200341760ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: user in: body description: 'user to add to the system' required: true schema: type: string formDataComplexParameter.yaml000066400000000000000000000001321321231237200351350ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: firstName in: formData description: 'users first name' required: true $ref: Nothing formDataInt64Parameter.yaml000066400000000000000000000001421321231237200344330ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: id in: formData description: 'username to fetch' required: true type: integer format: int64 formDataStringArrayParameter.yaml000066400000000000000000000001621321231237200357760ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: user in: formData description: 'user to add to the system' required: true type: array items: type: string formDataStringParameter.yaml000066400000000000000000000001311321231237200347730ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: firstName in: formData description: 'users first name' required: true type: string headerInt64ArrayParameter.yaml000066400000000000000000000002351321231237200351300ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: token in: header description: 'token to be passed as a header' required: true type: array items: type: integer format: int64 collectionFormat: csv headerStringArrayParameter.yaml000066400000000000000000000002141321231237200354670ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: token in: header description: 'token to be passed as a header' required: true type: array items: type: string collectionFormat: csv headerStringParameter.yaml000066400000000000000000000001411321231237200344670ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: token in: header description: 'token to be passed as a header' required: true type: string pathInt64Parameter.yaml000066400000000000000000000001361321231237200336350ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: id in: path description: 'username to fetch' required: true type: integer format: int64 pathStringArrayParameter.yaml000066400000000000000000000002011321231237200351670ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: usernames in: path description: 'usernames to pass' required: true type: array items: type: string collectionFormat: csv pathStringParameter.yaml000066400000000000000000000001251321231237200341750ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: username in: path description: 'username to fetch' required: true type: string queryInt64ArrayParameter.yaml000066400000000000000000000002241321231237200350430ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: id in: query description: 'ID of the object to fetch' required: true type: array items: type: integer format: int64 collectionFormat: csv queryStringParameter.yaml000066400000000000000000000001471321231237200344120ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: id in: query description: 'ID of the object to fetch' required: true type: integer format: int64 queryWithComplexParameter.yaml000066400000000000000000000001601321231237200354020ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/parametersname: id in: query description: 'a complex object which should not validate' required: true schema: $ref: Pet golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/resourceWithExamplePayload.yaml000066400000000000000000000026141321231237200334430ustar00rootroot00000000000000swagger: '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}}} resourceWithLinkedDefinitions.yaml000066400000000000000000000016671321231237200340700ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resourcesswagger: '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}}} resourceWithLinkedDefinitions_part1.yaml000066400000000000000000000007051321231237200351670ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resourcesget: 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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/resourceWithRelativeHost.yaml000066400000000000000000000023311321231237200331430ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/reusableParameters.yaml000066400000000000000000000026061321231237200317610ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/securityExample.yaml000066400000000000000000000126361321231237200313220ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/stringPathParamResource.yaml000066400000000000000000000023541321231237200327470ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/taggedResource.yaml000066400000000000000000000030061321231237200310710ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/resources/vendorExtensionExamples.yaml000066400000000000000000000027571321231237200330330ustar00rootroot00000000000000swagger: '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}}} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/000077500000000000000000000000001321231237200252525ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/complexArrayResponse.yaml000066400000000000000000000001461321231237200323240ustar00rootroot00000000000000description: 'A complex object array response' schema: type: array items: {$ref: VeryComplexType} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/dateTimeResponse.yaml000066400000000000000000000001171321231237200314100ustar00rootroot00000000000000description: 'A date-time response' schema: type: string format: date-time golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/int32Response.yaml000066400000000000000000000001201321231237200306050ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int32 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/int64Response.yaml000066400000000000000000000001201321231237200306120ustar00rootroot00000000000000description: 'A simple string response' schema: type: integer format: int64 golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/multipleResponses.yaml000066400000000000000000000002651321231237200316760ustar00rootroot00000000000000'200': description: 'simple string response' schema: {type: string} '201': description: 'object created' default: description: oops schema: {type: integer, format: int32} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/stringArrayResponse.yaml000066400000000000000000000001251321231237200321600ustar00rootroot00000000000000description: 'A string array response' schema: type: array items: {type: string} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/stringResponse.yaml000066400000000000000000000000771321231237200311670ustar00rootroot00000000000000description: 'A simple string response' schema: type: string golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/stringResponseWithHeader.yaml000066400000000000000000000001741321231237200331320ustar00rootroot00000000000000description: 'A simple string response' schema: type: string headers: is-dog: {type: boolean} is-cat: {type: boolean} golang-github-go-openapi-loads-0.15.0/fixtures/yaml/yaml/responses/voidResponse.yaml000066400000000000000000000000361321231237200306150ustar00rootroot00000000000000description: 'object created' golang-github-go-openapi-loads-0.15.0/fmts/000077500000000000000000000000001321231237200204255ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/fmts/fixture_test.go000066400000000000000000000207471321231237200235130ustar00rootroot00000000000000// 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" "io/ioutil" "path/filepath" "strings" "testing" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" ) var extensions = []string{"json"} func assertSpecJSON(t testing.TB, specJSON []byte) bool { var expected map[string]interface{} if !assert.NoError(t, json.Unmarshal(specJSON, &expected)) { return false } obj := spec.Swagger{} if !assert.NoError(t, json.Unmarshal(specJSON, &obj)) { return false } cb, err := json.MarshalIndent(obj, "", " ") if assert.NoError(t, err) { return false } var actual map[string]interface{} if !assert.NoError(t, json.Unmarshal(cb, &actual)) { return false } 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 } 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 := ioutil.ReadFile(fileName) if !assert.NoError(t, err) { return false } var expected map[string]interface{} if !assert.NoError(t, json.Unmarshal(b, &expected)) { return false } if !assert.NoError(t, json.Unmarshal(b, schema)) { return false } cb, err := json.MarshalIndent(schema, "", " ") if !assert.NoError(t, err) { return false } var actual map[string]interface{} if !assert.NoError(t, json.Unmarshal(cb, &actual)) { return false } 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) if !assert.NoError(t, err) { return false } var expected map[string]interface{} if !assert.NoError(t, json.Unmarshal(b, &expected)) { return false } if !assert.NoError(t, json.Unmarshal(b, schema)) { return false } cb, err := json.MarshalIndent(schema, "", " ") if !assert.NoError(t, err) { return false } var actual map[string]interface{} if !assert.NoError(t, json.Unmarshal(cb, &actual)) { return false } return assert.EqualValues(t, expected, actual) } func TestPropertyFixtures(t *testing.T) { for _, extension := range extensions { path := filepath.Join("..", "fixtures", extension, "models", "properties") files, err := ioutil.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") if assert.NoError(t, err) { var expected map[string]interface{} if assert.NoError(t, json.Unmarshal(b, &expected)) && assert.NoError(t, json.Unmarshal(b, schema)) { cb, err := json.MarshalIndent(schema, "", " ") if assert.NoError(t, err) { var actual map[string]interface{} if assert.NoError(t, json.Unmarshal(cb, &actual)) { assert.Equal(t, expected, actual) } } } } } func TestModelFixtures(t *testing.T) { path := filepath.Join("..", "fixtures", "json", "models") files, err := ioutil.ReadDir(path) if err != nil { t.Fatal(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 } } //fmt.Println("trying", f.Name()) roundTripTest(t, "model", "json", filepath.Join(path, f.Name()), &spec.Schema{}) } path = filepath.Join("..", "fixtures", "yaml", "models") files, err = ioutil.ReadDir(path) if err != nil { t.Fatal(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 } } // fmt.Println("trying", f.Name()) 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 := ioutil.ReadDir(path) if err != nil { t.Fatal(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 := ioutil.ReadDir(path) if err != nil { t.Fatal(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 := ioutil.ReadDir(path) if err != nil { t.Fatal(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 := ioutil.ReadDir(path) if err != nil { t.Fatal(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 := ioutil.ReadFile(filepath.Join(path, f.Name())) if assert.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 := ioutil.ReadFile(filepath.Join(path, f.Name())) if assert.NoError(t, err) { assertSpecJSON(t, b2) } } } golang-github-go-openapi-loads-0.15.0/fmts/yaml.go000066400000000000000000000021421321231237200217150ustar00rootroot00000000000000// 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 ) golang-github-go-openapi-loads-0.15.0/fmts/yaml_test.go000066400000000000000000000244341321231237200227640ustar00rootroot00000000000000// 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.v2" "github.com/go-openapi/swag" "github.com/stretchr/testify/assert" ) type failJSONMarhal struct { } func (f failJSONMarhal) MarshalJSON() ([]byte, error) { return nil, errors.New("expected") } func TestLoadHTTPBytes(t *testing.T) { _, err := swag.LoadFromFileOrHTTP("httx://12394:abd") assert.Error(t, err) serv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusNotFound) })) defer serv.Close() _, err = swag.LoadFromFileOrHTTP(serv.URL) assert.Error(t, err) ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusOK) rw.Write([]byte("the content")) })) defer ts2.Close() d, err := swag.LoadFromFileOrHTTP(ts2.URL) assert.NoError(t, err) assert.Equal(t, []byte("the content"), d) } func TestYAMLToJSON(t *testing.T) { sd := `--- 1: the int key value name: a string value 'y': some value ` var data yaml.MapSlice yaml.Unmarshal([]byte(sd), &data) d, err := YAMLToJSON(data) if assert.NoError(t, err) { assert.Equal(t, `{"1":"the int key value","name":"a string value","y":"some value"}`, string(d)) } data = append(data, yaml.MapItem{Key: true, Value: "the bool value"}) d, err = YAMLToJSON(data) assert.Error(t, err) assert.Nil(t, d) data = data[:len(data)-1] tag := yaml.MapSlice{{Key: "name", Value: "tag name"}} data = append(data, yaml.MapItem{Key: "tag", Value: tag}) d, err = YAMLToJSON(data) assert.NoError(t, err) assert.Equal(t, `{"1":"the int key value","name":"a string value","y":"some value","tag":{"name":"tag name"}}`, string(d)) tag = yaml.MapSlice{{Key: true, Value: "bool tag name"}} data = append(data[:len(data)-1], yaml.MapItem{Key: "tag", Value: tag}) d, err = YAMLToJSON(data) assert.Error(t, err) assert.Nil(t, d) var lst []interface{} lst = append(lst, "hello") d, err = YAMLToJSON(lst) assert.NoError(t, err) assert.Equal(t, []byte(`["hello"]`), []byte(d)) lst = append(lst, data) d, err = YAMLToJSON(lst) assert.Error(t, err) assert.Nil(t, d) // _, err := yamlToJSON(failJSONMarhal{}) // assert.Error(t, err) _, err = BytesToYAMLDoc([]byte("- name: hello\n")) assert.Error(t, err) dd, err := BytesToYAMLDoc([]byte("description: 'object created'\n")) assert.NoError(t, err) d, err = YAMLToJSON(dd) assert.NoError(t, err) assert.Equal(t, json.RawMessage(`{"description":"object created"}`), d) } func TestLoadStrategy(t *testing.T) { loader := func(p string) ([]byte, error) { return []byte(yamlPetStore), nil } remLoader := func(p 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) assert.NoError(t, err) assert.NotNil(t, s) ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusNotFound) rw.Write([]byte("\n")) })) defer ts2.Close() _, err = YAMLDoc(ts2.URL) assert.Error(t, err) } var yamlPestoreServer = func(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusOK) rw.Write([]byte(yamlPetStore)) } func TestWithYKey(t *testing.T) { doc, err := BytesToYAMLDoc([]byte(withYKey)) if assert.NoError(t, err) { _, err := YAMLToJSON(doc) if assert.Error(t, err) { doc, err := BytesToYAMLDoc([]byte(withQuotedYKey)) if assert.NoError(t, err) { jsond, err := YAMLToJSON(doc) if assert.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"` } if assert.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 ` golang-github-go-openapi-loads-0.15.0/hack/000077500000000000000000000000001321231237200203625ustar00rootroot00000000000000golang-github-go-openapi-loads-0.15.0/hack/build-drone.sh000077500000000000000000000014751321231237200231340ustar00rootroot00000000000000#!/bin/bash set -e -o pipefail mkdir -p /drone/{testresults,coverage,dist} go test -race -timeout 20m -v ./... | go-junit-report -dir /drone/testresults # Run test coverage on each subdirectories and merge the coverage profile. echo "mode: ${GOCOVMODE-count}" > profile.cov # Standard go tooling behavior is to ignore dirs with leading underscores # skip generator for race detection and coverage for dir in $(go list ./...) do pth="$GOPATH/src/$dir" go test -covermode=${GOCOVMODE-count} -coverprofile=${pth}/profile.out $dir if [ -f $pth/profile.out ] then cat $pth/profile.out | tail -n +2 >> profile.cov # rm $pth/profile.out fi done go tool cover -func profile.cov gocov convert profile.cov | gocov report gocov convert profile.cov | gocov-html > /drone/coverage/coverage-${CI_BUILD_NUM-"0"}.htmlgolang-github-go-openapi-loads-0.15.0/hack/coverage000077500000000000000000000011231321231237200221000ustar00rootroot00000000000000#!/bin/bash set -e -o pipefail # Run test coverage on each subdirectories and merge the coverage profile. echo "mode: ${GOCOVMODE-atomic}" > coverage.txt # Standard go tooling behavior is to ignore dirs with leading underscores # skip generator for race detection and coverage for dir in $(go list ./...) do pth="$GOPATH/src/$dir" go test -race -timeout 20m -covermode=${GOCOVMODE-atomic} -coverprofile=${pth}/profile.out $dir if [ -f $pth/profile.out ] then cat $pth/profile.out | tail -n +2 >> coverage.txt rm $pth/profile.out fi done go tool cover -func coverage.txt golang-github-go-openapi-loads-0.15.0/json_test.go000066400000000000000000000161351321231237200220210ustar00rootroot00000000000000// 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/assert" ) func TestLoadJSON(t *testing.T) { serv := httptest.NewServer(http.HandlerFunc(jsonPestoreServer)) defer serv.Close() s, err := JSONSpec(serv.URL) assert.NoError(t, err) assert.NotNil(t, s) ts2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusNotFound) rw.Write([]byte("{}")) })) defer ts2.Close() _, err = JSONSpec(ts2.URL) assert.Error(t, err) } var jsonPestoreServer = func(rw http.ResponseWriter, r *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" } } }` golang-github-go-openapi-loads-0.15.0/spec.go000066400000000000000000000144551321231237200207460ustar00rootroot00000000000000// 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/json" "fmt" "net/url" "github.com/go-openapi/analysis" "github.com/go-openapi/spec" "github.com/go-openapi/swag" ) // 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 } // 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 var ( loaders *loader defaultLoader *loader ) func init() { defaultLoader = &loader{Match: func(_ string) bool { return true }, Fn: JSONDoc} loaders = defaultLoader spec.PathLoader = loaders.Fn AddLoader(swag.YAMLMatcher, swag.YAMLDoc) } // AddLoader for a document func AddLoader(predicate DocMatcher, load DocLoader) { prev := loaders loaders = &loader{ Match: predicate, Fn: load, Next: prev, } spec.PathLoader = loaders.Fn } type loader struct { Fn DocLoader Match DocMatcher Next *loader } // JSONSpec loads a spec from a json document func JSONSpec(path string) (*Document, error) { data, err := JSONDoc(path) if err != nil { return nil, err } // convert to json return Analyzed(json.RawMessage(data), "") } // Document represents a swagger spec document type Document struct { // specAnalyzer Analyzer *analysis.Spec spec *spec.Swagger specFilePath string origSpec *spec.Swagger schema *spec.Schema raw json.RawMessage } // Embedded returns a Document based on embedded specs. No analysis is required func Embedded(orig, flat json.RawMessage) (*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, }, nil } // Spec loads a new spec document func Spec(path string) (*Document, error) { specURL, err := url.Parse(path) if err != nil { return nil, err } var lastErr error for l := loaders.Next; l != nil; l = l.Next { if loaders.Match(specURL.Path) { b, err2 := loaders.Fn(path) if err2 != nil { lastErr = err2 continue } doc, err := Analyzed(b, "") if err != nil { return nil, err } if doc != nil { doc.specFilePath = path } return doc, nil } } if lastErr != nil { return nil, lastErr } b, err := defaultLoader.Fn(path) if err != nil { return nil, err } document, err := Analyzed(b, "") if document != nil { document.specFilePath = path } return document, err } // Analyzed creates a new analyzed spec document func Analyzed(data json.RawMessage, version string) (*Document, error) { if version == "" { version = "2.0" } if version != "2.0" { return nil, fmt.Errorf("spec version %q is not supported", version) } raw := data trimmed := bytes.TrimSpace(data) if len(trimmed) > 0 { if trimmed[0] != '{' && trimmed[0] != '[' { 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) } raw = d } } swspec := new(spec.Swagger) if err := json.Unmarshal(raw, swspec); err != nil { return nil, err } origsqspec := new(spec.Swagger) if err := json.Unmarshal(raw, origsqspec); err != nil { return nil, err } d := &Document{ Analyzer: analysis.New(swspec), schema: spec.MustLoadSwagger20Schema(), spec: swspec, raw: raw, origSpec: origsqspec, } 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] } else { expandOptions = &spec.ExpandOptions{ RelativeBase: d.specFilePath, } } 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 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 } func (d *Document) OrigSpec() *spec.Swagger { return d.origSpec } // ResetDefinitions gives a shallow copy with the models reset 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 { dd, _ := Analyzed(d.Raw(), d.Version()) return dd } // SpecFilePath returns the file path of the spec if one is defined func (d *Document) SpecFilePath() string { return d.specFilePath } golang-github-go-openapi-loads-0.15.0/spec_test.go000066400000000000000000000422701321231237200220010ustar00rootroot00000000000000package loads import ( "encoding/json" "testing" "github.com/stretchr/testify/assert" ) func TestUnknownSpecVersion(t *testing.T) { _, err := Analyzed([]byte{}, "0.9") assert.Error(t, err) } func TestDefaultsTo20(t *testing.T) { d, err := Analyzed(PetStoreJSONMessage, "") assert.NoError(t, err) assert.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)), "") if assert.NoError(t, err) { if assert.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) assert.NoError(t, err) assert.NotNil(t, document) d, err := document.Expanded() assert.NoError(t, err) assert.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) assert.NoError(t, err) assert.NotNil(t, document) d, err := document.Expanded() assert.NoError(t, err) assert.NotNil(t, d) b, _ := d.Spec().MarshalJSON() assert.JSONEq(t, cascadeRefExpanded, string(b)) } func TestFailsInvalidJSON(t *testing.T) { _, err := Analyzed(json.RawMessage([]byte("{]")), "") assert.Error(t, err) } var 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" ], "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" } } } } `