/
How to define the schema and context for a DIAL?

How to define the schema and context for a DIAL?

How to define the schema and context?

  • There are two ways to define and upload the schema in blob.

    1. Fork sunbird-dial-service repo

    2. Create the your own repo and follow the same structure of schemas folder as in sunbird-dial-service repo.

Steps:

  1. Create the new folder inside schemas folder with the context-name. e.g. we have the context name content and collection.

  2. Create the file context.json and schema.json inside context folder.


    Sample schema.json

    { "$id": "file:./schemas/<context_name>/schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "<context_name>", "type": "object", "properties": { "<attribute_1>" : { "type": "string" }, "<attribute_2>" : { "type": "array" }, "<attribute_3>" : { "type": "array" }, "<attribute_4>" : { "type": "string" } } }

    Sample context.json

    { "@context": { "schema": "http://schema.org/", "<attribute_1>": { "@id": "schema:name#<attribute_1>", "@type": "schema:name" }, "<attribute_4>": { "@id": "schema:name#<attribute_1>", "@type": "schema:name" }, "<attribute_2>": { "@id": "schema:name#<attribute_2>", "@type": "@id", "@container": "@list" }, "<attribute_3>": { "@id": "schema:name#<attribute_3>", "@type": "@id", "@container": "@list" } } }

     

  3. Upload schema and context in blob storage using jenkins job
    Deploy/Kubernetes/DialUploadSchemas - Configure the schemas folder path in jenkins job to upload all the available schema and context to blob storage.

    Configure the dial_plugin_container_name in devops private repo. e.g.

    dial_plugin_container_name: "sunbird-dial-dev"


Configure the dial_service_schema_base_path in devops private repo. e.g.

  1. Verify the uploaded schema/context by accessing the following URL format

    e.g. for collection

  2. Set the schema path in sunbird-dial-service application.config with the blob storage path and do the dial-service deployment.

e.g.

DIAL update API


Request: Sample request with context

DIAL read API

Response:

 

Related content

Update the DIAL code context in content-service
Update the DIAL code context in content-service
More like this
Adoption of Sunbird DIAL Context
Adoption of Sunbird DIAL Context
More like this
Dialcode context
Dialcode context
More like this
Schema Implementation Design
Schema Implementation Design
More like this
Schema Definition - Version support
Schema Definition - Version support
More like this
Program Configuration
Program Configuration
More like this