Skip to content

build sanitise schema per item to restore subclass dispatch #100

Description

@taylortom

PR #97 hoisted the getSchema call out of the per-item loop in sanitise() on the basis that getSchema is idempotent for a given schemaName. That holds for the base AbstractApiModule.getSchema but not for subclasses that override it to dispatch on the data argument — notably ContentModule.getSchema, which returns a different schema per content type / _component / enabled-plugin set.

With the hoisted call, ContentModule.getSchema receives the array as its data argument, can't extract _component/_id/_type, falls back to the base content schema, and drops all component-specific and extension fields when sanitising GET responses. Concretely, GET /api/content/<componentId> for a graphic component returns only base fields — _graphic, _vanilla, _pageLevelProgress etc. are stripped, so the editor shows no asset thumbnail on revisit even though the data is in the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions