Created
October 8, 2015 07:31
-
-
Save r7kamura/f399fc45c58347b201d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem i json_world | |
Fetching: json_world-0.2.2.gem (100%) | |
Successfully installed json_world-0.2.2 | |
1 gem installed | |
$ pry -r json_world | |
[1] pry(main)> class A | |
[1] pry(main)* include JsonWorld::DSL | |
[1] pry(main)* property(:x, type: Array, items: { type: String }) | |
[1] pry(main)* end | |
=> [#<JsonWorld::PropertyDefinition:0x007f9fffa9bb08 | |
@options={:type=>Array, :items=>{:type=>String}, :parent=>A}, | |
@property_name=:x>] | |
[2] pry(main)> puts A.to_json_schema | |
{ | |
"properties": { | |
"x": { | |
"items": { | |
"type": "string" | |
}, | |
"type": "array" | |
} | |
}, | |
"required": [ | |
"x" | |
] | |
} | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment