This module looks incredibly useful but it isn't picking up my custom entity types. Is there a way to plug into the module so that my entity types appear in the UI?

Thanks!

Comments

othermachines created an issue. See original summary.

balsama’s picture

Status: Active » Postponed (maintainer needs more info)

Hi. This module should _just work_ with custom entity types. It's possible that a previous version had a different bug, but I just tested with 2.0.3 and confirmed that custom entity types (and their bundles) show up in the Query Builder.

interlated’s picture

I get an error. I think it is because of custom entity types.

Message Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "entity" for route "jsonapi.bond--bond.individual" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 223 of /web/core/lib/Drupal/Core/Routing/UrlGenerator.php).

Backtrace
#0 /web/core/lib/Drupal/Core/Routing/UrlGenerator.php(270): Drupal\Core\Routing\UrlGenerator->doGenerate(Array, Array, Array, Array, Array, 'jsonapi.bond--b...')
#1 /web/core/lib/Drupal/Core/Routing/UrlGenerator.php(310): Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute('jsonapi.bond--b...', Object(Symfony\Component\Routing\Route), Array, Array)
#2 /web/core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php(105): Drupal\Core\Routing\UrlGenerator->generateFromRoute('jsonapi.bond--b...', Array, Array, true)
#3 /web/core/lib/Drupal/Core/Url.php(773): Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('jsonapi.bond--b...', Array, Array, true)
#4 /web/core/modules/jsonapi/src/Normalizer/EntityAccessDeniedHttpExceptionNormalizer.php(51): Drupal\Core\Url->toString(true)
#5 /web/core/modules/jsonapi/src/Normalizer/HttpExceptionNormalizer.php(59): Drupal\jsonapi\Normalizer\EntityAccessDeniedHttpExceptionNormalizer->buildErrorObjects(Object(Drupal\jsonapi\Exception\EntityAccessDeniedHttpException))
#6 /vendor/symfony/serializer/Serializer.php(152): Drupal\jsonapi\Normalizer\HttpExceptionNormalizer->normalize(Object(Drupal\jsonapi\Exception\EntityAccessDeniedHttpException), 'api_json', Array)
#7 /web/core/modules/jsonapi/src/Serializer/Serializer.php(66): Symfony\Component\Serializer\Serializer->normalize(Object(Drupal\jsonapi\Exception\EntityAccessDeniedHttpException), 'api_json', Array)
#8 /web/core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php(260): Drupal\jsonapi\Serializer\Serializer->normalize(Object(Drupal\jsonapi\Exception\EntityAccessDeniedHttpException), 'api_json', Array)
#9 [internal function]: Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer->{closure:Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::normalizeOmissionsLinks():259}(Object(Drupal\jsonapi\Exception\EntityAccessDeniedHttpException))
#10 /web/core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php(259): array_map(Object(Closure), Array)
#11 /web/core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php(203): Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer->normalizeOmissionsLinks(Object(Drupal\jsonapi\JsonApiResource\OmittedData), 'api_json', Array)
#12 /web/core/modules/serialization/src/Normalizer/SchematicNormalizerTrait.php(31): Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer->doNormalize(Object(Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel), 'api_json', Array)
#13 /vendor/symfony/serializer/Serializer.php(152): Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer->normalize(Object(Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel), 'api_json', Array)
#14 /web/core/modules/jsonapi/src/Serializer/Serializer.php(66): Symfony\Component\Serializer\Serializer->normalize(Object(Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel), 'api_json', Array)
#15 /web/core/modules/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php(120): Drupal\jsonapi\Serializer\Serializer->normalize(Object(Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel), 'api_json', Array)
#16 /web/core/modules/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php(85): Drupal\jsonapi\EventSubscriber\ResourceResponseSubscriber->renderResponseBody(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\jsonapi\CacheableResourceResponse), Object(Drupal\jsonapi\Serializer\Serializer), 'api_json')
#17 /vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\jsonapi\EventSubscriber\ResourceResponseSubscriber->onResponse(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#18 /vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#19 /vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'kernel.response', Object(Symfony\Component\HttpKernel\Event\ResponseEvent))
#20 /vendor/symfony/http-kernel/HttpKernel.php(216): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response')
#21 /vendor/symfony/http-kernel/HttpKernel.php(204): Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object(Drupal\jsonapi\CacheableResourceResponse), Object(Symfony\Component\HttpFoundation\Request), 1)
#22 /vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#23 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /web/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#35 {main}
interlated’s picture

The trace above was caused by not having uuid annotated on the class:

#[ContentEntityType(
  id: "bond",
  label: new TranslatableMarkup('bond'),
  entity_keys: [
    "id" => "id",
    "uuid" => "node_uuid",
  ],
  base_table: 'bond',
)]