- 🇳🇱Netherlands Rene Bakx Netherlands
Adding the backwards compatible as suggested in #14 actually breaks it again.
'oneOf' => [ ['type' => 'array'], ['type' => 'object'], ],
The check on array fails in the external library mentioned in #6
JsonSchema\Exception\InvalidArgumentException: Array is an invalid type for Array in JsonSchema\Constraints\TypeConstraint->validateType()
- Status changed to Needs review
over 1 year ago 3:46pm 8 May 2023 - last update
over 1 year ago Composer require-dev failure - 🇪🇸Spain budalokko Girona
the backwards compatible code in #13 or #15 fails because an empty array is also considered an object:
https://github.com/justinrainbow/json-schema/blob/5174319bd0f45fe90bb88e...
and
oneOf
only allows one of the items to be valid. ReplacingoneOf
byanyOf
as in the attached patch fixes the issue in a backwards-compatible way. - 🇩🇪Germany osopolar 🇩🇪 GER 🌐
I have a similar issue but my problem is with title. On a migration I only set the link uri but not the link title, therefore the link title is NULL (not empty string). Looking at the link fields table in the database suggest says that NULL is allowed for uri, title and options. Should we modify the schema respectively? At least for title?
public function getOutputJsonSchema() { return [ 'type' => 'object', 'properties' => [ 'uri' => ['type' => 'string'], 'title' => [ 'anyOf' => [ ['type' => 'null'], ['type' => 'string'], ], ], 'options' => [ 'anyOf' => [ ['type' => 'array'], ['type' => 'object'], ], ], 'url' => ['type' => 'string'], ], ]; }
My current workaround is to set title to empty string in migration.
- last update
about 1 year ago 17 pass - last update
about 1 year ago 17 pass - 🇮🇹Italy dgsiegel
When you create a node and put it into a menu via the sidebar, the
title
will benull
. When you create or update a menu entry viaadmin/structure/menu
, thetitle
will be""
. As we're not using any options, https://www.drupal.org/project/jsonapi_extras/issues/3232279#comment-146... 🐛 Invalid output JSON schema in UrlLinkEnhancer Fixed works for us. - Status changed to Fixed
about 1 year ago 2:17pm 6 September 2023 - 🇳🇱Netherlands bbrala Netherlands
Ok, seems like extending is the way to go, i wish we had better test coverage here, but not gonna ask to fix that right now.
Thanks for the help everyone.
Automatically closed - issue fixed for 2 weeks with no activity.