Module: Tamara::JsonSchemas::Consumer
- Defined in:
- lib/tamara/json_schemas/consumer.rb
Class Method Summary collapse
Class Method Details
.schema(allows_null: false) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tamara/json_schemas/consumer.rb', line 4 def self.schema(allows_null: false) { "$schema": "http://json-schema.org/draft-06/schema", type: ["object", (allows_null ? "null" : nil)].compact, properties: { first_name: Types::String.schema, last_name: Types::String.schema, email: { pattern: URI::MailTo::EMAIL_REGEXP }, phone_number: Types::String.schema }, required: %w[first_name last_name email phone_number] } end |