Draft a data model

Steps to create your new data model in json schema

Supposedly you know how many fields you want your data model to have and what data types they would be.

1.- Copy this text

click on the plus
// Instructions for creating your schema
// 1.- respect the HEADER
// 2.- there are 8 types of examples field1 to field8
// HEADER ***Do not change any of these till next warning***
$schema =   http://json-schema.org/schema
$schemaVersion = 0.0.1
$id = https://smart-data-models.github.io/XXXSubjectXXX/XXXDataModelXXX/schema.json
title = Smart Data models -XXXdataModelXXX schema",
description = description of a generic airport
type = object
required[] = id, type
allOf[0]
  $ref=https://smart-data-models.github.io/data-models/common-schema.json#/definitions/GSMA-Commons
allOf[1]
  $ref=https://smart-data-models.github.io/data-models/common-schema.json#/definitions/Location-Commons
// HEADER  ***this is the next warning***
// you can start configuring this 
allOf[2]
  properties
// Create a numeric
    field1XXX
      type = number
      minimum number = 0
      maximum number = 1
      description = Property. Model:'https://schema.org/Number'. Example of definition of a numerical attributeXXX
// Create a simple string
    field2XXX
      type = string
      description = Property. Model:'https://schema.org/Text'. Example of definition of a numerical attributeXXX

// Create a date time
    field3XXX 
      type = string
      format = date-time
      description = Property. Model:'https://schema.org/Text'. Example of definition of a date-time attributeXXX

//Create an enumeration of strings
    field4XXX
      type = string
      enum[] s = val1, val2, val3
      description = Property. Model:'https://schema.org/Text. Example of definition of a enumeration of stringsXXX

//Create an enumeration of numbers
    field5XXX
      type = string
      enum[] number = 1, 2, 3
      description = Property. Model:'https://schema.org/Text. Example of definition of a enumeration of numbersXXX

//Create an enumeration of an object
    field6XXX
      type = object
      description = Property. Model:'https://schema.org/Text. Example of definition of a enumeration of numbersXXX
      properties
        subproperty1XXX
          type = string
        subproperty2XXX
          type = number

//Create an array of strings
    field7XXX
      type = array
      description = Property. Model:'https://schema.org/Text. Example of definition of a arrayXXX
      items
        type = string
        minitems number = 3

//Create an array of numbers
    field8XXX
      type = array
      description = Property. Model:'https://schema.org/Text. Example of definition of a arrayXXX
      items
        type = number
        minitems number = 1
 required[] string = id, type

2.- Open in a new window this web.
3.- Paste the text in the left form and in the right you’ll have the json schema version.
4.- Modify according to your needs (copy and rename attributes). XXX string helps you to see what should be changed Use this help
5.- You’ll have the code for your json schema on the right text box.
6.- You can validate in this link (paste in the left text box) and you will see the result below. On the right you shoul paste the example in keyvalues format. (leave emtpy) Better if you use chrome browser.

Comments are closed.