bangank36 / WP-Builder

JSON Schema-based forms with Wordpress Components renderer
https://gutenbuilder.wordpress.com
GNU General Public License v2.0
0 stars 0 forks source link

📗 WP-Builder: Schema Collections #25

Open bangank36 opened 1 year ago

bangank36 commented 1 year ago

Summary

Reference

bangank36 commented 1 year ago

Description

Schema

{
  type: "object",
  properties: {
    address: {
      type: 'object',
      properties: {
        street_address: { type: 'string' },
        city: { type: 'string' },
        state: { type: 'string' },
        country: {
          type: 'object',
          properties: {
            name: { type: 'string' },
          }
        }
      }
    },
    business: {
      type: 'object',
      properties: {
        job: { type: 'string' }
      }
    }
  },
};

UISchema

{
  type: "NavigatorLayout",
  elements: [
    {
      type: 'VerticalLayout',
      elements: [
        {
          type: 'Control',
          scope: '#/properties/address',
        },
        {
          type: 'Control',
          scope: '#/properties/business',
        }
      ],
    }
  ],
}

Data

{
    "address": {
        "street_address": "4/3 Malibu",
        "city": "Vice City",
        "country": {
            "name": "US"
        },
        "state": "Florida"
    },
    "business": {
        "job": "Engineer"
    }
}