generated from coulomb/repo-seed
Start ecosystem registry service
This commit is contained in:
@@ -194,6 +194,7 @@ class FabricGraph:
|
||||
"repo": declaration.metadata.get("repo", ""),
|
||||
"domain": declaration.metadata.get("domain", ""),
|
||||
"lifecycle": declaration.spec.get("lifecycle", ""),
|
||||
"attributes": _export_attributes(declaration),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -262,3 +263,46 @@ def _mermaid_id(value: str) -> str:
|
||||
|
||||
def _escape_mermaid(value: str) -> str:
|
||||
return value.replace('"', '\\"')
|
||||
|
||||
|
||||
def _export_attributes(declaration: Declaration) -> dict[str, Any]:
|
||||
spec = declaration.spec
|
||||
if declaration.kind == "ServiceDeclaration":
|
||||
return {
|
||||
"provides_capabilities": list(spec.get("provides_capabilities", [])),
|
||||
"exposes_interfaces": list(spec.get("exposes_interfaces", [])),
|
||||
}
|
||||
if declaration.kind == "CapabilityDeclaration":
|
||||
return {
|
||||
"capability_type": spec.get("capability_type", ""),
|
||||
"service_id": spec.get("service_id", ""),
|
||||
"interface_ids": list(spec.get("interface_ids", [])),
|
||||
"environments": list(spec.get("environments", [])),
|
||||
}
|
||||
if declaration.kind == "InterfaceDeclaration":
|
||||
return {
|
||||
"interface_type": spec.get("interface_type", ""),
|
||||
"service_id": spec.get("service_id", ""),
|
||||
"capability_ids": list(spec.get("capability_ids", [])),
|
||||
"version": spec.get("version", ""),
|
||||
"auth": spec.get("auth", ""),
|
||||
}
|
||||
if declaration.kind == "DependencyDeclaration":
|
||||
requires = spec.get("requires", {})
|
||||
interface = spec.get("interface", {})
|
||||
return {
|
||||
"consumer_service_id": spec.get("consumer_service_id", ""),
|
||||
"requires_capability_id": requires.get("capability_id", ""),
|
||||
"requires_capability_type": requires.get("capability_type", ""),
|
||||
"interface_type": interface.get("type", ""),
|
||||
"environments": list(spec.get("environments", [])),
|
||||
"criticality": spec.get("criticality", ""),
|
||||
}
|
||||
if declaration.kind == "BindingAssertion":
|
||||
return {
|
||||
"dependency_id": spec.get("dependency_id", ""),
|
||||
"provider_capability_id": spec.get("provider_capability_id", ""),
|
||||
"provider_interface_id": spec.get("provider_interface_id", ""),
|
||||
"status": spec.get("status", ""),
|
||||
}
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user