Doesn't it yet have the ability to add arbitrary tags?
kbaba1001 opened this issue · 3 comments
I tried using tags like next, but I got an error.
(require '[clj-yaml.core :as yaml])
(yaml/parse-string "
- name: !foo Mary Smith
")
error:
Execution error (ConstructorException) at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructUndefined/construct (SafeConstructor.java:539).
could not determine a constructor for the tag !foo
in 'string', line 2, column 9:
- name: !foo Mary Smith
I read the source code, I found the TODO comment:
https://github.com/clj-commons/clj-yaml/blob/master/src/clojure/clj_yaml/core.clj#L59
Does this comment mean that it doesn't yet have the ability to add arbitrary tags?
I think clj-yaml
doesn't expose the addImplicitResolver()
method of snakeyaml. See https://bitbucket.org/asomov/snakeyaml/src/5e41c378e49c9b363055ac8b0386b69cb3f389d2/src/main/java/org/yaml/snakeyaml/resolver/Resolver.java#lines-89
That's OK, you might be able to call it manually (haven't checked the code), or you might be able to just create a class called foo
using deftype
.
Better question for https://ask.clojure.org/ :)
clj-yaml should probably support this. Feel free to make proposals, starting with a clear problem statement and with several alternatives.