https://github.com/michinaoshimizu/oas_contrib
Open API Specification related commands and libraries.
https://github.com/michinaoshimizu/oas_contrib
gem json oas openapi-specification ruby swagger-ui yaml
Last synced: 2 months ago
JSON representation
Open API Specification related commands and libraries.
- Host: GitHub
- URL: https://github.com/michinaoshimizu/oas_contrib
- Owner: MichinaoShimizu
- License: mit
- Created: 2018-07-03T12:00:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T02:52:17.000Z (almost 3 years ago)
- Last Synced: 2025-03-13T03:51:12.356Z (3 months ago)
- Topics: gem, json, oas, openapi-specification, ruby, swagger-ui, yaml
- Language: Ruby
- Size: 96.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# oas_contrib
[](https://badge.fury.io/rb/oas_contrib)
Libraries and Commands for Open API (2.0, 3.0) Specification.
* Divide OAS file.
* Merge OAS divided files.
* Preview OAS file with SwaggerUI.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'oas_contrib'
```And then execute:
bundle
Or install it yourself as:
gem install oas_contrib
## Usage
### sub commands
```bash
$ oas_contrib
Commands:
oas_contrib divide () # Divide the spec_file into path units and schema units.
oas_contrib help [COMMAND] # Describe available commands or one specific command
oas_contrib merge () # Merge multiple divided files into an spec_file.
oas_contrib preview () # Preview the spec_file using Swagger-UI official Docker image.
```### divide command
```bash
$ oas_contrib help divide
Usage:
oas_contrib divide ()Options:
[--out-ext=OUT_EXT] # output file ext (.yml or .yaml or .json)
# Default: .ymlDivide the spec_file into path units and schema units.
```#### example
##### input
[v3.yml](/example/v3.yml)##### execution
```
$ oas_contrib divide v3.yml sample
Load: v3.yml
Dist: sample/meta
Dist: sample/meta/001_openapi.yml
Dist: sample/meta/002_info.yml
Dist: sample/meta/003_servers.yml
Dist: sample/path
Dist: sample/path/001_pets.yml
Dist: sample/path/002_pets_{petId}.yml
Dist: sample/model
Dist: sample/model/001_Pet.yml
Dist: sample/model/002_Error.yml
Dist: sample/model/003_Pets.yml
complete!
```##### output
```
$ tree sample/
sample/
├── meta
│ ├── 001_openapi.yml
│ ├── 002_info.yml
│ └── 003_servers.yml
├── model
│ ├── 001_Pet.yml
│ ├── 002_Error.yml
│ └── 003_Pets.yml
└── path
├── 001_pets.yml
└── 002_pets_{petId}.yml
```
[output sample dir](/example/dist/v3)### merge command
```bash
$ oas_contrib help merge
Usage:
oas_contrib merge ()Options:
[--in-ext=IN_EXT] # input file ext (.yml or .yaml or .json)
# Default: .ymlMerge multiple divided files into an spec_file.
```### preview command
```bash
$ oas_contrib help preview
Usage:
oas_contrib preview ()Options:
[--port=N] # Swagger UI listen port
# Default: 50010Preview the spec_file using Swagger-UI official Docker image.
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/MichinaoShimizu/oas_contrib. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the OasContrib project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/MichinaoShimizu/oas_contrib/blob/master/CODE_OF_CONDUCT.md).