open_api
Version, currently 1.2.15 versions
github.com/repomaa/open_api.cr
Type safe OpenAPI spec library
13 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
open_api:
github: repomaa/open_api.cr
version: ~> 1.2.1Then run:
shards installshard.yml
- Crystal
0.26.0- License
- MIT
- Author
- Joakim Reinert <mail@jreinert.com>
Dependencies
This version declares no dependencies.
README
# OpenAPI
Aims at providing a complete more or less type safe mapping of
[OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification. Currently
supported version: 3.0.1. Use it to either write or parse OpenAPI specs.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
open_api:
github: jreinert/open_api.cr
```
## Usage
### Writing specs
```crystal
require "open_api"
OpenAPI.build do |api|
doc = api.document(
openapi: "3.0.1"
info: {
title: "Catlib",
version: "0.1"
},
paths: {
"/meow" => api.path_item(
get: {
tags: ["cats"],
request_body: {
ref: "#/components/schemas/cat"
}
}
)
},
components: {
schemas: {
:cat => api.schema(
type: "object",
description: "A cat"
)
}
}
)
puts doc.to_json
)
```
### Parsing specs
```crystal
require "open_api"
File.open("openapi.yml") do |file|
doc = OpenAPI.from_yaml(file)
puts doc.to_json
end
```
## Contributing
1. Fork it (<https://github.com/jreinert/open_api.cr/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [jreinert](https://github.com/jreinert) Joakim Reinert - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.2.1- Tagged
- Oct 31, 2019
- Commit
fae170d3f0e0- Crystal
0.26.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/repomaa/open_api.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 5