Skip to content

Latest commit

 

History

History
99 lines (71 loc) · 2.48 KB

README.md

File metadata and controls

99 lines (71 loc) · 2.48 KB

Schema Registry Tools

Dependencies

Setup

  • Navigate to tools directory from root directory:
    cd tools
  • Setup virtual environment(recommended):
    python3 -m venv venv
  • Activate virtual environment:
    source venv/bin/activate
  • If required, update pip in the virtual environment:
    python3 -m pip install --upgrade pip
  • Install dependencies:
    pip install -r requirements.txt

Schema Registry API Server

Run Server

  • Run Schema Registry API server, default port is 7723 :
    schema_registry_server -r registry.json

Endpoints

  • Get list of schema SAIDs:
    http://localhost:7723/schema 
  • Get Schema data as CESR using OOBI:
    http://localhost:7723/oobi/{schema_said} 

Schema CLI

Commands

register_all

register_all runs the other commands on all relevant files in the repo, updating whatever SADs and schemas are out-of-date, and re-writing the registry.json file. It takes no arguments.

saidify_schema

saidify_schema command computes self addressing identifier (SAID) of ACDC schema json. It updates value of $id property in a, e, r objects(if present) and the $id property at root level with the SAIDs.

Usage
  • Execute saidify_schema command from tools directory:

    saidify_schema -f <file path of schema file(JSON) to saidify>
  • Examples:

    saidify_schema -f tn/tn.schema.json
    
    # OR
    
    saidify_schema -f a2p-campaign/a2p-campaign.schema.json

saidify_sad

saidify_sad command computes self addressing identifier (SAID) of the provided self addressing data(SAD) JSON. It updates computed SAID as the value of SAID field label in the JSON as per the argument field-label. Possible field label options are $id, @id, id, i, d.

Usage
  • Execute saidify_sad command from tools directory:

    saidify_sad -f <full file path of file containing SAD JSON to saidify> -l <SAID field label>
  • Examples:

    ## saidify tn/rules.json file
    saidify_sad -f ~/Projects/public-schema/tn/rules.json -l 'd'
    
    # OR
    
    saidify_sad -f ~/Projects/public-schema/tn/rules.json -l '$id'