Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

どうやって使うのでしょうか...? #1

Open
yukitoto opened this issue Jun 29, 2016 · 1 comment
Open

どうやって使うのでしょうか...? #1

yukitoto opened this issue Jun 29, 2016 · 1 comment

Comments

@yukitoto
Copy link

yukitoto commented Jun 29, 2016

こちらのスライドを見てとても興味を持ったので、ぜひUsageを教えていただきたいです!

https://speakerdeck.com/kenchan/real-world-json-hyper-schema

@kenchan
Copy link
Owner

kenchan commented Jun 29, 2016

興味をもっていただいてありがとうございます!

私はこれの存在を数ヶ月ぶりに思いだしたレベルなので、週末あたりにREADME書きます!

基本的には標準入力からJSONをうけとって、標準出力にJSON Schemaをはきだすような作りになっています。ただ、gemとしてリリースしていなかったことに気付いたのでGemfileにgithub指定すると使えます…

こんなかんじです。

$ cat Gemfile
source "https://rubygems.org"

gem 'schemize', github: 'kenchan/schemize'

$ bundle exec schemize < test.json
---
schema:
  type: array
  items:
    type: object
    properties:
      firstName:
        type: string
      lastName:
        type: string
      age:
        type: integer

また、cliではなくプログラム中で使いたい場合は https://github.com/kenchan/schemize/blob/master/test/acceptance/converter_test.rb こちらが参考になるかと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants