Sha256: 5972024f111c7132043c1c14df4b7295699eab10b7e97cd6aedbbdb0bd157dee

Contents?: true

Size: 676 Bytes

Versions: 22

Compression:

Stored size: 676 Bytes

Contents

module Examples
  class EntityLiterals
    include JSON::SchemaBuilder

    def example
      object do
        entity 'one', required: true do
          enum [:string, :null]
        end

        entity 'two' do
          all_of positive_int, string
        end

        entity 'three' do
          any_of [positive_int, null]
        end

        entity 'four' do
          not_a null
        end

        entity 'five' do
          one_of string, number
        end
      end
    end

    def bad_example
      object do
        entity 'bad' do
          not_a undefined_method
        end
      end
    end

    def positive_int
      integer minimum: 1
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
json-schema_builder-0.8.2 spec/support/examples/entity_literals.rb
json-schema_builder-0.8.1 spec/support/examples/entity_literals.rb
json-schema_builder-0.8.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.7.1 spec/support/examples/entity_literals.rb
json-schema_builder-0.7.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.6.1 spec/support/examples/entity_literals.rb
json-schema_builder-0.6.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.5.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.4.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.3.1 spec/support/examples/entity_literals.rb
json-schema_builder-0.3.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.2.1 spec/support/examples/entity_literals.rb
json-schema_builder-0.2.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.1.0 spec/support/examples/entity_literals.rb
json-schema_builder-0.0.9 spec/support/examples/entity_literals.rb
json-schema_builder-0.0.8 spec/support/examples/entity_literals.rb
json-schema_builder-0.0.7 spec/support/examples/entity_literals.rb
json-schema_builder-0.0.6 spec/support/examples/entity_literals.rb
json-schema_builder-0.0.5 spec/support/examples/entity_literals.rb
json-schema_builder-0.0.4 spec/support/examples/entity_literals.rb