Skip to content

Now you can add sub array's with objects

Compare
Choose a tag to compare
@w3nl w3nl released this 19 Feb 19:36
· 306 commits to master since this release
99a0913

Example multi level schema:

const personSchema = {
    name: "string",
    age: "number",
    siblings: "array",
    metaData: "?object",
    active: "boolean",
    address: {
        street: "string",
        number: "number",
        postalCode: "string",
        city: "string",
        country: "string"
    },
    companies:  {
        name: "string",
        website: "?string"
    }
};

Example valid data for the person schema:

const personObj = {
    name: "James",
    age: 25,
    siblings: ["Johnnathan"],
    metaData: {},
    active: true,
    address: {
        street: "Streetname",
        number: 1,
        postalCode: "1234AB",
        city: "City",
        country: "Somewehere"
    },
    companies: [
        { name: "Example company 1", website: "https://hckr.news" }
        { name: "Example company 2" }
    ]
}