18 lines
429 B
Python
18 lines
429 B
Python
import json
|
|
|
|
class DataContractRegistry:
|
|
def __init__(self):
|
|
self._contracts = {}
|
|
|
|
def register(self, name: str, schema: dict, version: int = 1):
|
|
self._contracts[name] = {
|
|
"version": version,
|
|
"schema": schema,
|
|
}
|
|
|
|
def get(self, name: str):
|
|
return self._contracts.get(name)
|
|
|
|
def list_contracts(self):
|
|
return {k: v for k, v in self._contracts.items()}
|