Skip to content

yaml_ld.expand.expand

expand(
    document: JsonLdInput,
    options: ExpandOptions = DEFAULT_EXPAND_OPTIONS,
) -> list[JsonLdRecord]

Expand a YAML-LD document.

Examples


from pathlib import Path
import pyyaml
import yaml_ld

pyyaml.dumps(
    yaml_ld.expand(
        document=Path(
            'specifications/yaml-ld/tests/cases/streams/two-documents-in.yamlld'
        ),
        options=yaml_ld.ExpandOptions(extract_all_scripts=True),   # (1)
    ),
)
  1. Or,
    options={'extractAllScripts': True},
    
    if you wish to be closer to the letter of the JSON-LD API Specification.