Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Latest commit

 

History

History
55 lines (42 loc) · 1.01 KB

notes.md

File metadata and controls

55 lines (42 loc) · 1.01 KB

API Braindump

Just some random stuff to help me clear my head

Schema

Ark::Schema.add(schema_json)

or

s = Ark::Schema.new
s.definition = schema_json
s.valid?
s.save # also calls Ark::Schema#valid?

Record

class Host; include Ark::Record; end
# works if host is a valid schema
# this also works
class My::Random::Namespace::Host; include Ark::Record; end

however you might want to use a class name different from the schema name:

class MyHost
  include Ark::Record
  validates_as :host
end
# this should give validate you against the `host` schema

I think there's a valid use case for schema+record creation at once like so

class Host
  include Ark::Record

  attributes ["name","status"]

  validation :unique, ["name"]
  validation :require, ["name"]
  validation :member, "status", ["up","down","pending"]

end

RecordCollection

This doesn't even exist yet but I need to do it.

Repo

I'm not entirely happy with how this is API works but it's fine for now