Skip to content

SchemaStorage::addSchema() should call BaseConsstraint::arrayToObjectRecursive() on the provide schemas #408

Closed
@shtrom

Description

@shtrom

Without doing this, it might accept Array input from the caller without complaining, but the validation against those schemas will fail later with

get_object_vars() expects parameter 1 to be object, array given

at https://github.com/justinrainbow/json-schema/blob/6.0.0-dev/src/JsonSchema/SchemaStorage.php#L118

Calling BaseConsstraint::arrayToObjectRecursive() in addSchema before https://github.com/justinrainbow/json-schema/blob/6.0.0-dev/src/JsonSchema/SchemaStorage.php#L61, as Validator::validate() does https://github.com/justinrainbow/json-schema/blob/6.0.0-dev/src/JsonSchema/Validator.php#L49-L51 should solve the problem, and make handling it in Validator::validate() unecessary.

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