You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying out the linkml-renderer with the b2ai-standards data and in most cases, it works very well. For some schemas (or some data?) it will throw a TypeError when rendering HTML, like this:
$ linkml-render -s src/schema/standards_schema_all.yaml -r UseCaseContainer -o test.html src/data/UseCase.yaml
Traceback (most recent call last):
File "/home/harry/b2ai-standards-registry/.venv/bin/linkml-render", line 8, in <module>
sys.exit(main())
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/cli.py", line 81, in main
out = renderer.render(obj, sv, source_element_name=root)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 70, in render
self.generate(element, ctxt)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 98, in generate
return self.generate_document(element, context)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 183, in generate_document
self.generate(element, context.extend(None, "body"))
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 134, in generate
return self.generate_object(element, context)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 235, in generate_object
self.generate(v, context.extend(slot))
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 119, in generate
return self.elements_to_table(elements, context)
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 300, in elements_to_table
self.generate(v, context.extend(slot, "table"))
File "/home/harry/b2ai-standards-registry/.venv/lib/python3.9/site-packages/linkml_renderer/renderers/html_renderer.py", line 107, in generate
raise TypeError(f"Unexpected type for collection: {type(element)}")
TypeError: Unexpected type for collection: <class 'str'>
The same error is raised when attempting to render this data as markdown.
The schema and data are both valid as far as I can tell.
Turns out this was an issue on my end: linkml-validate wasn't catching that some data in multivalued slots was provided as strings instead of lists. Rewriting the offending values as lists abolished this error.
Would be nice to know what the value of the unexpected type is in this case instead of just getting the whole stack trace, though!
I've been trying out the
linkml-renderer
with the b2ai-standards data and in most cases, it works very well. For some schemas (or some data?) it will throw a TypeError when rendering HTML, like this:The same error is raised when attempting to render this data as markdown.
The schema and data are both valid as far as I can tell.
For comparison, this completes as expected:
This is with version 0.1.2.
The text was updated successfully, but these errors were encountered: