generated from coulomb/repo-seed
Complete graph explorer projection
This commit is contained in:
@@ -267,13 +267,16 @@ def _escape_mermaid(value: str) -> str:
|
||||
|
||||
def _export_attributes(declaration: Declaration) -> dict[str, Any]:
|
||||
spec = declaration.spec
|
||||
base = _base_export_attributes(declaration)
|
||||
if declaration.kind == "ServiceDeclaration":
|
||||
return {
|
||||
**base,
|
||||
"provides_capabilities": list(spec.get("provides_capabilities", [])),
|
||||
"exposes_interfaces": list(spec.get("exposes_interfaces", [])),
|
||||
}
|
||||
if declaration.kind == "CapabilityDeclaration":
|
||||
return {
|
||||
**base,
|
||||
"capability_type": spec.get("capability_type", ""),
|
||||
"service_id": spec.get("service_id", ""),
|
||||
"interface_ids": list(spec.get("interface_ids", [])),
|
||||
@@ -281,6 +284,7 @@ def _export_attributes(declaration: Declaration) -> dict[str, Any]:
|
||||
}
|
||||
if declaration.kind == "InterfaceDeclaration":
|
||||
return {
|
||||
**base,
|
||||
"interface_type": spec.get("interface_type", ""),
|
||||
"service_id": spec.get("service_id", ""),
|
||||
"capability_ids": list(spec.get("capability_ids", [])),
|
||||
@@ -291,6 +295,7 @@ def _export_attributes(declaration: Declaration) -> dict[str, Any]:
|
||||
requires = spec.get("requires", {})
|
||||
interface = spec.get("interface", {})
|
||||
return {
|
||||
**base,
|
||||
"consumer_service_id": spec.get("consumer_service_id", ""),
|
||||
"requires_capability_id": requires.get("capability_id", ""),
|
||||
"requires_capability_type": requires.get("capability_type", ""),
|
||||
@@ -300,9 +305,20 @@ def _export_attributes(declaration: Declaration) -> dict[str, Any]:
|
||||
}
|
||||
if declaration.kind == "BindingAssertion":
|
||||
return {
|
||||
**base,
|
||||
"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 {}
|
||||
return base
|
||||
|
||||
|
||||
def _base_export_attributes(declaration: Declaration) -> dict[str, Any]:
|
||||
source_links = declaration.metadata.get("source_links", [])
|
||||
return {
|
||||
"owner": declaration.metadata.get("owner", ""),
|
||||
"description": declaration.spec.get("description", ""),
|
||||
"source_path": str(declaration.path),
|
||||
"source_links": source_links if isinstance(source_links, list) else [],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user