Module: Html2rss::Config::Schema
- Defined in:
- lib/html2rss/config/schema.rb
Overview
Builds the exported configuration JSON Schema from the runtime validators.
Defined Under Namespace
Modules: Components, DeepStringifier, Selectors Classes: Builder
Constant Summary collapse
- SCHEMA_FILENAME =
'html2rss-config.schema.json'
Class Method Summary collapse
-
.json_schema ⇒ Hash<String, Object>
Returns the exported configuration JSON Schema.
- .load_json_schema_extension! ⇒ Object
-
.path ⇒ String
Resolves the packaged schema path used by downstream tools.
Class Method Details
.json_schema ⇒ Hash<String, Object>
Returns the exported configuration JSON Schema.
16 17 18 19 |
# File 'lib/html2rss/config/schema.rb', line 16 def json_schema load_json_schema_extension! Builder.call end |
.load_json_schema_extension! ⇒ Object
41 42 43 44 |
# File 'lib/html2rss/config/schema.rb', line 41 def load_json_schema_extension! require 'dry/schema/extensions/json_schema' Dry::Schema.load_extensions(:json_schema) end |
.path ⇒ String
Resolves the packaged schema path used by downstream tools.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/html2rss/config/schema.rb', line 25 def path search_path = File.(__dir__) loop do candidate = File.join(search_path, 'schema', SCHEMA_FILENAME) return candidate if File.exist?(candidate) parent_path = File.dirname(search_path) break if parent_path == search_path search_path = parent_path end File.("../../../schema/#{SCHEMA_FILENAME}", __dir__) end |