Skip to content

oneOf ambiguities in schema cause validation to always fail for effects and precomp assets #84

@kudanai

Description

@kudanai

hit a few oneOf issues in the schema while building a validator. three separate bugs, all related:

1. effect-values/no-value matches everything

no-value is defined as {"type": "object"} which matches any object — including typed effect values like slider, checkbox, etc. so in the all-effect-values oneOf, every effect value matches both its own type AND no-value, which violates the exactly-one-match rule.

same issue also shows up in the base effect schema's ef.items.oneOf — it includes no-value alongside the typed refs there too.

Extra bit that really tripped me up: pro-levels-effect uses no-value refs in its prefixItems for spacer slots, and those slots DO have "ty": 0 in real AE exports. so you can't just globally add "not": {"required": ["ty"]} to no-value — it breaks pro-levels validation. the constraint needs to be scoped to the oneOf contexts only.

2. base effect in all-effects oneOf has no ty constraint

the base effect schema has no ty const, so it matches alongside every specific effect type (gaussian-blur-effect, drop-shadow-effect, etc.) in the all-effects oneOf. another oneOf violation.

fix that works for us: collect all known ty values from sibling schemas and inject "not": {"enum": [...]} on the base entry. similar to the unknown-layer pattern already in lottie-spec.

3. Sound matches precomp assets

sound inherits from file-asset which only requires "id". precomp assets also have "id", so they match both Precomposition and Sound in the all-assets oneOf.

constraining sound to "not": {"required": ["layers"]} works since only precomps have layers.


we're patching these at runtime in our validator right now. just flagging in case it's useful upstream. the lottie-spec build (schema-merge.py) might already handle some of these (as previously noted offline)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions