Skip to content

Conformance Examples 0.1.0 — Transforms: soft-fail-events

abs-non-numeric-input-reports-kb-5001

abs on a non-numeric input soft-fails to null and reports a KB-5001 TypeMismatch soft failure.

Template

{{ x | abs }}

Context

{
    "x": "not-a-number"
}

Output

null

plus-non-numeric-argument-reports-kb-5001

plus with a non-numeric argument soft-fails to null and reports a KB-5001 TypeMismatch soft failure.

Template

{{ x | plus: "nope" }}

Context

{
    "x": 5
}

Output

null

compact-non-list-input-reports-kb-5001

compact on a non-list input soft-fails to null and reports a KB-5001 TypeMismatch soft failure.

Template

{{ x | compact }}

Context

{
    "x": "not-a-list"
}

Output

null

divided-by-zero-reports-kb-5002

divided_by 0 soft-fails to null and reports a KB-5002 DegenerateValue soft failure.

Template

{{ x | divided_by: 0 }}

Context

{
    "x": 10
}

Output

null

modulo-by-zero-reports-kb-5002

modulo 0 soft-fails to null and reports a KB-5002 DegenerateValue soft failure.

Template

{{ x | modulo: 0 }}

Context

{
    "x": 10
}

Output

null

round-negative-places-reports-kb-5002

round with a negative places argument is degenerate; soft-fails to null and reports KB-5002 DegenerateValue.

Template

{{ x | round: -1 }}

Context

{
    "x": 12.3
}

Output

null

truncate-negative-length-reports-kb-5002

truncate with a negative length argument is degenerate; soft-fails to null and reports KB-5002 DegenerateValue.

Template

{{ x | truncate: -1 }}

Context

{
    "x": "hello"
}

Output

null

parse-date-time-unparseable-input-reports-kb-5003

parse_date_time on a string that is not a valid ISO-8601 instant soft-fails to null and reports a KB-5003 UnparseableInput soft failure.

Template

{{ x | parse_date_time }}

Context

{
    "x": "not-a-date"
}

Output

null

url-decode-malformed-percent-encoding-reports-kb-5003

url_decode on a malformed percent-encoded sequence soft-fails to null and reports a KB-5003 UnparseableInput soft failure.

Template

{{ x | url_decode }}

Context

{
    "x": "%zz"
}

Output

null

find-no-match-reports-kb-5006

find whose predicate matches no element soft-fails to null and reports a KB-5006 NoMatch soft failure.

Template

{{ items | find: "k" "nope" }}

Context

{
    "items": [
        {
            "k": "a"
        },
        {
            "k": "b"
        }
    ]
}

Output

null

find-index-no-match-reports-kb-5006

find_index whose predicate matches no element soft-fails to null and reports a KB-5006 NoMatch soft failure.

Template

{{ items | find_index: "k" "nope" }}

Context

{
    "items": [
        {
            "k": "a"
        },
        {
            "k": "b"
        }
    ]
}

Output

null

Source fixture: transforms/soft-fail-events.json