Application-specific tags not supported #68

Closed
christianbreynolds opened this Issue Aug 12, 2016 · 2 comments

Projects

None yet

3 participants

@christianbreynolds

In a yaml file such as:


---
key: !mytag value

The tag !mytag is ignored by the parser. I'd like to be able to affect the parser's behavior or give it a hint of the parsing method as is described in the YAML spec (http://www.yaml.org/spec/1.2/spec.html#tag), and demonstrated in Example 2.23 (http://www.yaml.org/spec/1.2/spec.html#id2761292).

Specifically, the use case I'm trying to achieve is to allow modification of string values regardless of their container class. So for instance if the same yaml file above is used, I might want the parsed tree to contain (key: "modified_value") instead of (key: "value").

@cowtowncoder
Member

Tags are actually allowed as "type id" indicators, to work with @JsonTypeInfo.

Other than that, tag values are accessible via JsonParser (or rather, it's sub-class YAMLParser) using method getTypeId(), but no other support exists, or is planned.

With custom deserializers you should be able to access tag using getTypeId(), so perhaps that would work for your case?

@tokuhirom

Some library implements "including" feature on YAML's custom tag.

hosts:
  "example.com":
    listen:
      port: 443
      ssl: !file default_ssl.conf
    paths:
      ...

If jackson-dataformat-yaml supports this, user can implement custom tag handler for this purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment