LogoLogo
  • Internet Object 1.0
  • Internet Object
    • Abstract
    • The Poetic Principles of Internet Object
    • Objectives
    • Introducing Internet Object
  • The Structure
    • Internet Object Document
      • Header
      • Data Sections
    • Structural Elements
      • Structural Characters and Literals
      • Literals
      • Other Special Characters
      • Whitespaces
    • Values Representations
      • Objects
      • Arrays
      • Strings
        • Open Strings
        • Regular Strings
        • Raw Strings
      • Numeric Values
        • Number
        • BigInt
        • Decimal
        • Special Numeric Integer Formats
          • Hexadecimal
          • Octal
          • Binary
        • NaN and Infinity
      • Binary
      • Date and Time
      • Booleans
      • Nulls
    • Comments
    • Encoding
  • The Collections
    • Collection
    • Creating Collection
    • Collection Rules
    • Data Streaming
  • The Definitions
    • Definitions
    • Variables
    • Complex Schema
  • Schema Definition Language
    • Internet Object Schema
    • The structure
    • Data Types
      • Any
      • String
        • String Derived Types
          • Email
          • URL
          • Date
          • Time
          • DateTime
      • Number
        • Derived Types
          • int
          • byte
          • int16
          • int32
      • Object
      • Array
      • Bool
    • Dynamic Schema
    • Is Object, a MemberDef or a Schema?
  • Other
    • Best Practices
    • FAQs
    • Contributors
    • License
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Schema Definition Language

Is Object, a MemberDef or a Schema?

PreviousDynamic SchemaNextBest Practices

Last updated 1 year ago

Was this helpful?

An object can be represented as a MemberDef or a Schema. Object as a MemberDef can be easily differentiated from Object as a schema using some rules expressed in the flowchart below.

When the first value is a datatype

name: { string, maxLen:100 } # MemberDef

When the object contains type

If the object has a type member then it is parsed as MemberDef. In the following example, testScore is a MemberDef, as it defines the type of object.

dataType: { schema:{type:string, len:number}, type: object } # MemberDef

If the object contains schema

If the object contains schema then it is a MemberDef. In the following example, testData is a MemberDef, because it contains schema.

testData: {  default: { }, schema: {a, b, c}  } # MemberDef

If the schema is set to an array in the object

If the schema inside the object is set to an array then it is a MemberDef. In the following example, subjectMarks is a MemberDef, because it contains the schema of an array.

subjectMarks: {  default: { }, schema: [int]  } # MemberDef

If the object does not fall under any conditions given above

If the object does not fall under any of the above conditions then it is not a MemberDef. It is a schema of an object. The following example represents the object schema.

name, age, address, isActive, remark # schema of an object

If the first value in the object is a string and such as number, string, object, bool, etc. then the object is a MemberDef. In the following example, the name is a MemberDef, because it defines the string value.

valid datatype