is there a need to match diagram name against a hardcoded list, rather than forwarding the argument to the kroki server?
danieleades opened this issue · 3 comments
what it says on the tin.
If checking the value against a hardcoded list wasn't required, then new diagram types would not need to be manually added (and no issues with absent maintainers either...)
The 'checking' mechanism could still be used for known aliases, but fall back to a direct pass through
I am also looking in to this.
I tired to look if kroki has a api for it but I can't find any.
I posted the question up to kroki https://kroki.zulipchat.com/#narrow/stream/232085-users/topic/Api.20endpoint.20to.20list.20supported.20diagrams.3F
i'm referring to these lines -
kroki/sphinxcontrib/kroki/kroki.py
Lines 19 to 64 in 2665ddf
seems to me the types
dict is redundant, and forces you to create a new PR to support every new diagram supported upstream. When you could instead have something like-
ALIASES = {
"bob": "svgbob",
"c4": "c4plantuml",
"c4puml": "c4plantuml",
"dot": "graphviz",
"dsl": "structurizr",
"er": "erd",
"gv": "graphviz",
"iuml": "plantuml",
"pu": "plantuml",
"puml": "plantuml",
"uxf": "umlet",
"vg": "vega",
"vgl": "vegalite",
"vl": "vegalite",
"wsd": "plantuml",
}
def diagram_name(name: str) -> str:
return ALIASES.get(name, name)
Yea I agree. I got back from kroki that we can use https://kroki.io/health to get a list of available diagrams. I will see if I can get a PR together