Sha256: 595cf2c014fc656567a2996f0332f08c64813eca8954b5cb21bfb8cb8b629743

Contents?: true

Size: 680 Bytes

Versions: 6

Compression:

Stored size: 680 Bytes

Contents

module Examples
  class MixedAnyOfs
    include JSON::SchemaBuilder

    def example
      object do
        integer :blankable, any_of: [string], null: true

        object :nullable, null: true do
          string :test
        end

        object_or_array :mixed_type, any_of: [string, null], null: true do
          string :property
        end

        entity :flexible, any_of: [string(min_length: 100), empty_string, integer], null: true do
          any_of [
            an_object(self),
            array { items { an_object(self) } }
          ]
        end
      end
    end

    def an_object(root)
      root.object do
        string :one
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
json-schema_builder-0.8.2 spec/support/examples/mixed_any_ofs.rb
json-schema_builder-0.8.1 spec/support/examples/mixed_any_ofs.rb
json-schema_builder-0.8.0 spec/support/examples/mixed_any_ofs.rb
json-schema_builder-0.7.1 spec/support/examples/mixed_any_ofs.rb
json-schema_builder-0.7.0 spec/support/examples/mixed_any_ofs.rb
json-schema_builder-0.6.1 spec/support/examples/mixed_any_ofs.rb