Module: Tamara::JsonSchemas::Types::Url

Defined in:
lib/tamara/json_schemas/types/url.rb

Class Method Summary collapse

Class Method Details

.schema(allows_null: false) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/tamara/json_schemas/types/url.rb', line 5

def self.schema(allows_null: false)
  {
    "$schema": "http://json-schema.org/draft-06/schema",
    type: ["string", (allows_null ? "null" : nil)].compact,
    pattern: URI::DEFAULT_PARSER.make_regexp
  }
end