Skip to content

DSL for documenting JSON structure.

Notifications You must be signed in to change notification settings

sobstel/jsondocr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsondocr

DSL for documenting JSON schema.

Gem Version Code Climate

Element types

  • doc
  • object (document)
  • property (field)
  • array

Usage

schema = JSONdocr::Builders::Doc.new

schema.doc do
  name "Example"
  desc "general desc"

  object :sample do
    term "Sample object (document)"
    desc "document is an alias for object"

    field :id do
      term "Unique identifier"
      type :int
    end

    field :type do
      term "Samle type"
      type :string
      validates inclusion: { in: %w{real fake other}, message: "Wrong type" }
    end

    array :list_of_documents do
      term "List of documents"
      item object do
        field :content do
          term "Document content"
          type :string
        end
      end
    end

    object :author do
      term "Object author"

      field :first_name do
        term "Author first name"
        type :string
      end

      field :last_name do
        term "Author last name"
        type :string
      end
    end
  end
end

Example

Football schema (golazon) for mongodb

https://github.com/sobstel/golazon.universo/tree/master/developer.golazon.slate/lib

About

DSL for documenting JSON structure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages