weldx.asdf.extension.WeldxExtension.tag_mapping

property WeldxExtension.tag_mapping

A list of 2-tuples or callables mapping YAML tag prefixes to JSON Schema URL prefixes.

For each entry:

  • If a 2-tuple, the first part of the tuple is a YAML tag prefix to match. The second part is a string, where case the following are available as Python formatting tokens:

    • {tag}: the complete YAML tag.

    • {tag_suffix}: the part of the YAML tag after the matched prefix.

    • {tag_prefix}: the matched YAML tag prefix.

  • If a callable, it is passed the entire YAML tag must return the entire JSON schema URL if it matches, otherwise, return None.

Note that while JSON Schema URLs uniquely define a JSON Schema, they do not have to actually exist on an HTTP server and be fetchable (much like XML namespaces).

For example, to match all YAML tags with the tag:nowhere.org:custom` prefix to the ``http://nowhere.org/schemas/custom/ URL prefix:

return [('tag:nowhere.org:custom/',
         'http://nowhere.org/schemas/custom/{tag_suffix}')]