Class: AgentClientProtocol::SchemaRegistry
- Inherits:
-
Object
- Object
- AgentClientProtocol::SchemaRegistry
- Defined in:
- lib/agent_client_protocol/schema_registry.rb
Constant Summary collapse
- ROOT =
File.("../..", __dir__)
- STABLE_SCHEMA_PATH =
File.join(ROOT, "schema", "schema.json")
- UNSTABLE_SCHEMA_PATH =
File.join(ROOT, "schema", "schema.unstable.json")
- STABLE_META_PATH =
File.join(ROOT, "schema", "meta.json")
- UNSTABLE_META_PATH =
File.join(ROOT, "schema", "meta.unstable.json")
Class Method Summary collapse
- .agent_methods(unstable: false) ⇒ Object
- .client_methods(unstable: false) ⇒ Object
- .defs(unstable: false) ⇒ Object
- .method_catalog(unstable: false) ⇒ Object
- .protocol_methods(unstable: false) ⇒ Object
- .schema_for(definition_name, unstable: false) ⇒ Object
- .stable_meta ⇒ Object
- .stable_schema ⇒ Object
- .unstable_meta ⇒ Object
- .unstable_schema ⇒ Object
Class Method Details
.agent_methods(unstable: false) ⇒ Object
41 42 43 44 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 41 def agent_methods(unstable: false) = unstable ? : ([:agentMethods] || {}).dup end |
.client_methods(unstable: false) ⇒ Object
46 47 48 49 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 46 def client_methods(unstable: false) = unstable ? : ([:clientMethods] || {}).dup end |
.defs(unstable: false) ⇒ Object
30 31 32 33 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 30 def defs(unstable: false) schema = unstable ? unstable_schema : stable_schema schema.fetch("$defs") end |
.method_catalog(unstable: false) ⇒ Object
35 36 37 38 39 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 35 def method_catalog(unstable: false) key = unstable ? :unstable : :stable @method_catalog ||= {} @method_catalog[key] ||= build_method_catalog(defs(unstable: unstable)) end |
.protocol_methods(unstable: false) ⇒ Object
51 52 53 54 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 51 def protocol_methods(unstable: false) = unstable ? : ([:protocolMethods] || {}).dup end |
.schema_for(definition_name, unstable: false) ⇒ Object
56 57 58 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 56 def schema_for(definition_name, unstable: false) defs(unstable: unstable).fetch(definition_name) end |
.stable_meta ⇒ Object
22 23 24 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 22 def @stable_meta ||= symbolize_keys(load_json(STABLE_META_PATH)) end |
.stable_schema ⇒ Object
14 15 16 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 14 def stable_schema @stable_schema ||= load_json(STABLE_SCHEMA_PATH) end |
.unstable_meta ⇒ Object
26 27 28 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 26 def @unstable_meta ||= symbolize_keys(load_json(UNSTABLE_META_PATH)) end |
.unstable_schema ⇒ Object
18 19 20 |
# File 'lib/agent_client_protocol/schema_registry.rb', line 18 def unstable_schema @unstable_schema ||= load_json(UNSTABLE_SCHEMA_PATH) end |