Class: Kabk::SchemaRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/kabk/schema_renderer.rb

Overview

Renders the JSON Schema manifest for the protocol v1.6.0

Instance Method Summary collapse

Constructor Details

#initialize(system_config: nil, validation_schema_url: nil) ⇒ SchemaRenderer

Returns a new instance of SchemaRenderer.



8
9
10
11
# File 'lib/kabk/schema_renderer.rb', line 8

def initialize(system_config: nil, validation_schema_url: nil)
  @system_config = system_config || default_system_config
  @validation_schema_url = validation_schema_url || "/schemas/admin-protocol-1.6.0.json"
end

Instance Method Details

#renderObject



13
14
15
16
17
18
19
20
# File 'lib/kabk/schema_renderer.rb', line 13

def render
  {
    "$schema_version": "1.6.0",
    system: @system_config,
    validation_schema_url: @validation_schema_url,
    resources: Registry.instance.all.map(&:to_h)
  }
end