Add possible values for data types

Created on 10 January 2023, over 2 years ago
Updated 27 October 2023, over 1 year ago

Problem/Motivation

The resource URL for a content entity bundle shows possible values for fields which are lists:

                "my_field": {
                    "type": "string",
                    "title": "Type",
                    "oneOf": [
                        {
                            "const": "one",
                            "title": "One"
                        },
                        {
                            "const": "two",
                            "title": "Two"
                        }
                    ]
                }

However, if a config entity uses a data type which has options (if the DataType plugin implements OptionsProviderInterface), then that doesn't show in the schema.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom joachim

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.

  • 🇺🇸United States m.stenta

    I wanted to bring attention to this new issue I just opened, which aims to improve the current allowed_values logic so that it supports any field that implements OptionsProviderInterface.

    ✨ Use OptionsProviderInterface::getPossibleOptions() for allowed field values (anyOf / oneOf) Needs review

    While working on that, I came across this issue, which I noticed also uses getPossibleOptions(), but for a different case.

    I'm not sure if it would be possible to merge our logic together somehow, to cover all cases where getPossibleOptions() is needed. But I figured I would at least start by cross-linking the issues so everyone is aware of both. :-)

  • Status changed to Postponed: needs info 5 days ago
  • 🇺🇸United States m.stenta

    I tried replicating this in the new automated tests, but wasn't able to get the code in the MR to trigger, so I think we would need to add more test coverage for this case.

    Chatted briefly with @joachim in Slack:

    @joachim: Sorry, it’s so long ago I don’t remember
    @joachim: My issue came up with a custom data type, not a field type

    I'm going to postpone this as "maintainer needs more info" for now. If anyone else runs into this and can provide a failing test to demonstrate it then we can reopen and work on adding support.

Production build 0.71.5 2024