Schema Implementation Design

Problem Definition:

As part of Knowledge Platform 2.0, definition schema should give provision of implementing version support in future.

Design:



Definition Data Model:

  • IL_UNIQUE_ID - DEFINITION_NODE_Content
  • description - Schema definition object for Content
  • status - Draft/Live
  • createdOn - Date
  • lastUpdatedOn - Date
  • IL_SYS_NODE_TYPE - DEFINITION_NODE
  • IL_FUNC_OBJECT_TYPE - Content
  • version - 1.0
  • artifactUrl - Draft version URL link
  • downloadUrl - Published version URL link


Schema API Request Response:

Schema Create API:

  • It will always expect object Type in request
  • If there is no entry for IL_SYS_NODE_TYPE: DEFINITION_NODE and IL_FUNC_OBJECT_TYPE: Content:
    • It will create Content definition object with version 1.0
    • Identifier will be DEFINITION_NODE_Content
  • If object present - will throw Client Error.
  • Apart from objectType (IL_FUNC_OBJECT_TYPE), no other field is expected.
{
	"request": {
		"schema": {
			"objectType": "Content"
		}
	}
}


Schema Update API:

  • No other field apart from description can be updated.
{
	"request": {
		"schema": {
			"description": "Schema definition object for Content",
		}
	}
}


Schema Upload API:

  • Zipped file containing 'schema.josn' and 'config.json' will be uploaded.
  • If object status is Live:
    • Upload and extract the zipped file in path schemas/content/snapshot.
    • It will create replica of published definition.
    • Identifier will be 'DEFINITION_NODE_Content.img'
    • VersionKey will be same of version key.
    • Status will be Draft
    • artifactUrl will be link of snapshot path link.
  • If object status is Draft:
    • Upload and extract the zipped file in path schemas/content/snapshot.

Schema Publish API:

  • It will copy the snapshot files to the directory named 'schemas/content/1.0'
  • DownloadUrl will be updated with new url.
  • Status will be Live.
{
	"request": {
		"schema": {}
	}
}