Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drujensen/jsonapi
JSONAPI support in Crystal
https://github.com/drujensen/jsonapi
Last synced: 10 days ago
JSON representation
JSONAPI support in Crystal
- Host: GitHub
- URL: https://github.com/drujensen/jsonapi
- Owner: drujensen
- License: mit
- Created: 2016-03-26T05:37:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-04T06:20:14.000Z (over 8 years ago)
- Last Synced: 2024-10-25T01:35:51.938Z (about 2 months ago)
- Language: Crystal
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonapi
Provides the ability to map fields in an object and call `to_jsonapi`. This
will allow support for jsonapi.## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
jsonapi:
github: drujensen/jsonapi
branch: master
```## Usage
include JSONAPI in a class. The class needs to have an @id defined.
Next, create a `jsonapi_mapping` for the fields in your object.
```crystal
require "jsonapi"class Test
include JSONAPI
def initialize(@id = 0, @name = "", @body = "")
endjsonapi_mapping({
name: String,
body: String
})
end```
## Development
This is a Work In Progress.
RoadMap:
- support links
- relationships## Contributing
1. Fork it ( https://github.com/[your-github-name]/jsonapi/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
- [drujensen](https://github.com/drujensen) Dru Jensen - creator, maintainer