Class: OpenStax::Api::RepresentableSchemaPrinter
- Inherits:
-
Object
- Object
- OpenStax::Api::RepresentableSchemaPrinter
- Defined in:
- lib/openstax/api/representable_schema_printer.rb
Class Method Summary collapse
Class Method Details
.json(representer, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/openstax/api/representable_schema_printer.rb', line 5 def self.json(representer, ={}) [:include] ||= [:readable, :writeable] [:indent] ||= ' ' definitions = {} schema = json_schema(representer, definitions, ) schema[:definitions] = definitions json_string = JSON.pretty_generate(schema, {indent: [:indent]}) "\nSchema {##{SecureRandom.hex(4)} .schema}\n------\n" + "<pre class='code'>\n#{json_string}\n</pre>\n" end |