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
Issue fork jsonapi_schema-3332360
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
joachim commentedAha! The reason it doesn't work is because of this:
and in my scenario, it's a custom data type.
If I create a simple normaliser service in the custom module that declares the data type, and have that declare that it handles my data type, like this:
then it all works!
Comment #4
joachim commentedComment #5
m.stentaI wanted to bring attention to this new issue I just opened, which aims to improve the current
allowed_valueslogic so that it supports any field that implementsOptionsProviderInterface.#3397275: Use OptionsProviderInterface::getPossibleOptions() for allowed field values (anyOf / oneOf)
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. :-)Comment #6
m.stentaI 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:
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.