-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-10936: Implemented fetching field definitions from an expression #1765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.6
Are you sure you want to change the base?
Conversation
src/bundle/Controller/ContentTypeFieldsByExpressionController.php
Outdated
Show resolved
Hide resolved
tests/integration/REST/PostLoadFieldDefinitionsFromExpression.php
Outdated
Show resolved
Hide resolved
src/lib/REST/Output/ValueObjectVisitor/ContentType/FieldDefinitionInfoList.php
Outdated
Show resolved
Hide resolved
konradoboza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from other remarks.
src/bundle/Controller/ContentTypeFieldsByExpressionController.php
Outdated
Show resolved
Hide resolved
8ee52df to
0e365cc
Compare
src/bundle/Controller/ContentTypeFieldsByExpressionController.php
Outdated
Show resolved
Hide resolved
| $contentTypeFieldIds = $this->fieldsExtractor->extractFieldsFromExpression($expression); | ||
|
|
||
| $configuration = $configuration !== null | ||
| ? $this->configResolver->getParameter("content_type_fields_by_expression.configurations.$configuration") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is the location where LogicException happens?
This should be handled / validated properly, since in this case configuration is coming from REST query. External data should not be capable of triggering LogicExceptions. You can use any exception (like InvalidArgumentException), but definitely not this one.
|
| * | ||
| * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException | ||
| * @throws \Ibexa\AdminUi\Exception\FieldTypeExpressionParserException | ||
| * @throws \LogicException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be declared for the interface. It has to be a different type of exception, if needed.
| * @throws \LogicException |



Related PRs:
ibexa/core#676
https://github.com/ibexa/taxonomy/pull/382
Description:
Why?
The need is to create a possibility to fetch content type fields based on provided content type group identifiers and content type identifiers, please see the related Figma: https://www.figma.com/design/WkIyhysX3ZGSRwwxnPcFXE/-AI-Features--AI?node-id=8808-117516&t=50I4ptpZFht2TAps-0
As we don't have APIs for fetching field definitions, and we already have a service that allows fetching it using field expression: e.g.
{Content}/{folder}/{name}the decision was to expose theContentTypeFieldsByExpressionServiceto REST. Possible need: frontend requestsvectorizable_fieldsconfiguration and provides the expression to backend, backend responds with field definition info objects.REST
Summary
ContentTypeFieldsByExpressionServiceInterface/api/ibexa/v2/content-type/load-field-definitions-from-expressionapplication/vnd.ibexa.api.FieldDefinitionExpression+json(or+xml)application/vnd.ibexa.api.FieldDefinitionInfoList+json(or+xml)Request Payload
{ "FieldDefinitionExpression": { "expression": "{Content}/{folder}/{name}", "configuration": "vectorizable_fields" // Optional } }Example JSON Response
{ "FieldDefinitions": { "_media-type": "application/vnd.ibexa.api.FieldDefinitionInfoList+json", "FieldDefinitionInfo": [ { "_media-type": "application/vnd.ibexa.api.FieldDefinitionInfo+json", "id": "__FIXED_ID__", "identifier": "name", "position": 1, "names": { "value": [ { "_languageCode": "eng-US", "#text": "Name" } ] } } ] } }In order to use
configurationone needs to have the following configuration defined https://github.com/ibexa/taxonomy/pull/382For QA:
Documentation:
Internal, NDR