Support allowed_values_function

Created on 13 June 2022, about 2 years ago
Updated 27 October 2023, 8 months ago

Problem/Motivation

The DataDefinitionNormalizer class currently ignores fields with a allowed_values_function setting, and only handles fields with the simpler allowed_values setting.

See relevant code here: https://git.drupalcode.org/project/jsonapi_schema/-/blob/3cb2268798131cc...

Steps to reproduce

Create a module that provides a new base field of type list_string with an allowed_values_function setting pointing to a function that returns an array. Observe that the JSON Schema for this field does not include the enum property outlining the available options.

Proposed resolution

I'm not sure if this was omitted for a reason. Perhaps the dynamic nature of allowed_values_function makes this more difficult. I decided to open an issue both to discuss options and discover if there was prior work or thought on this topic.

Remaining tasks

User interface changes

None.

API changes

Fields that are defined with allowed_values_function will now have a oneOf or anyOf property added in their JSON Schema.

Data model changes

None.

✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States m.stenta

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024