๐ปCreating Schema using UI
Last updated
Last updated
To create a new Schemas, click on the New button at the top right corner.
After clicking on the New button, you will be asked to enter Schema details such as Schema Name, Policy Dropdown, Entity : VC/MRV/NONE, Schema Description and any other required fields.
In addition to the basic Schema details we also have an option to add Field and Condition to each field.
We can also add Property dropdown field to each field in Schema. these properties are defined by IWA and are in standardized format.
We can select respective property for that specific field by searching by entering starting alphabet:
We can also customize the Field keys and Field Title by clicking on Advanced Tab.
Instead of creating a new Schema from scratch, there is also an option to import it via File or via IPFS.
To import the Schema, click on the Import button.
Files with .schema extension are only accepted. These files are in zip format, i.e. they are zip archives of the text file.
You can also import Schema from IPFS by entering the correct Schema timestamp.
Sample iREC Schema timestamp is below:
Once the Schema is imported, we need to select the Policy from the Policy dropdown to connect the Schema and the Policy.
Note: The major difference between creating / importing System Schema and Policy Schema is that we only get policy selection dropdown when policy schema is imported.
After selecting the required Policy, click on the Import button.
When the Schema is imported, it will be in draft status.
Note: Initially when the Schema is created/imported, it will be in draft status.
Once the Schema is imported, we will have the following options: 1. Export the Schema and save it as .zip file in the local machine
2. Editing the Schema
3. Deleting the Schema
4. Displaying JSON document
To Publish the Schema, click on Publish button.
After clicking on Publish, you will be prompted to enter the version. After entering the Version and pressing the submit button, the status will change to Published.
Note: All Schemas connected to a Policy gets published automatically when Policy gets published.
There are different types of Schema Types:
None
Verifiable Credential
Encrypted Verifiable Credential
To know more details regarding encrypted Verifiable Credential please look at Selective Disclosure Demo
There are different types of Field Types:
Number
Integer
String
Boolean
Date
Time
DateTime
Duration
URL
Image
Account
Units of Measure
Prefix
Postfix
Enum
Help Text
GeoJSON
URI
Sentinel Hub
Each of the above field types can be marked as either Marked or optional by checking the Required Field checkbox.
Note: Important points to be noted when "Account" type is selected:
Account field type need to be referred in โtokenConfirmationBlockโ and โtokenActionBlockโ. They can be present both in the parent and child documents.
If there are multiple fields of the โAccountโ with the same name, then the value from the most immediate scope, i.e. from the current (โchildโ) document is used.
Note: Important points to be noted when "Enum" type is selected:
Enum values can be added by editing or by importing it from link or from file.
If we are importing files by URL. The response should be ({"enum": ["Option1", "Option2", "Option3"]}) or has same format such as importing file (Options separated by new line symbol).
Example of URL which has correct format: https://ipfs.io/ipfs/bafkreihgbx6fsqup4psfbzjcf57zjdbfwisbjbsqzvwlg4hgx5s5xyqwzm
3. If we put more than five options, it will be automatically loaded to IPFS.
Note: Important points to be noted when "GeoJSON" type is selected:
Click on map and place the markerโs, polygons, lines.
Polygons and lines can be placed by double clicking on map.
Right Click on the map will remove temporary points for polygons and lines
View type can also be changed by pasting the GeoJSON.
Note: Important points to be noted when "String" type is selected:
Pattern input field is added in the advanced mode configuration.
Detailed information for patterns is available on https://json-schema.org/understanding-json-schema/reference/regular_expressions.html.
Once the above details are added, click on the Create button.
Once the System Schema is created, we have options for activating, deleting, editing and viewing JSON documents.