Skip to content

Loosen validation to fix error with empty objects #38

@feuerwagen

Description

@feuerwagen

When using this library with the Drupal sdc_display module, it chokes on YAML structures like:

props:
  type: object
  properties: {}

where it's not able to recognise the value of properties as valid. This is for two reasons:

  1. The value gets deserialised as an empty array, which fails strict validation
  2. Even if validation with type cast is enabled, it still fails because (bool) $data->properties is false (see JsonFormValidator, line 27)

Steps to reproduce

See issue for Single Directory Components: Display.

Package Versions

Proposed resolution

  1. Use Constraint::CHECK_MODE_TYPE_CAST in FormGeneratorDrupal, line 52.
  2. Remove (bool) $data->properties from JsonFormValidator, line 27.

I'm well aware that this might not be the correct solution and might have implications I can't see right now. Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions