Open joachimvh opened 3 years ago
Oh did not know that this was hardcoded. I did write a test for csv input, but then I best look at this test what’s been done wrong that makes this test succeed.
If you call the handle function directly you wouldn't notice this. Setting the input type is only relevant for the canHandle
call. The value gets checked there and the request gets rejected if it does not match one of the input types.
Currently the
AnyToRdfConverter
is hardcoded to only support JSON: https://github.com/RMLio/solid-rml-store/blob/239cfd7ed7b63a263771007cc7ab29d67d807082/src/any-to-rdf-converter.ts#L31The super call also supports arrays so you can have multiple entries there. If the types it supports depend on other factors you probably just want to extend
RepresentationConverter
and have a customcanHandle
implementation.One potential issues when supporting all types is that this converter might be chosen for conversions it actually can't handle. For example, converting from JSON-LD to Turtle in the CSS works by having one converter convert the JSON-LD to quad objects, and then chain a second converter that converts quad objects to Turtle. But if there is also an
AnyToRdfConverter
in that array, that one would be chose instead since it says it can do the conversion in 1 step.There are some ways around this. One of them is to just not put this converter in the main array of converters but put it somewhere further in the store stack, after a regex router rule for example. Another way is to have a more advanced
canHandle
function so it can detect if it can actually do the conversion or not.