Skip to content

Conversation

RoselaineMarquesMontero
Copy link
Collaborator

@RoselaineMarquesMontero RoselaineMarquesMontero commented Jun 9, 2025

Add the "Entity Type Field" to the Object "Data Set Selection Filter", this feature also fix the issue when sending the filter param always as String, as we are adding and validating whether this field is not null in the CustomFDSSerializer class, it should not generate any breaking change.

Copy link
Collaborator

@markocikos markocikos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RoselaineMarquesMontero LGTM, but @dsanz should take a look

Copy link
Collaborator

@dsanz dsanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Rose, I think this is mostly ok, just see inline comment as we might need some polishing on the way we generate the value


if (success) {
let formData: any = {
entityFieldType: selectedField?.type,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might need to extend this in order to set the actual entityFieldType value as expected by the FDS. Most likely, this works like that for the case of striung and integers, nevertheless, for arrays and objects we are using collection as the entity type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are working on this use case now, for array of String and Integers

@dsanz
Copy link
Collaborator

dsanz commented Jun 12, 2025

Rose told us she plans to send a followup. So no additional review is needed here

@RoselaineMarquesMontero
Copy link
Collaborator Author

Hi @dsanz , @markocikos I've finished the changes, could you please review the PR, take into account that this one is to fix the issue sending always String for the OData Query, so we have added the Entity Field Type for Data Set Selection Filter and compatibility with older filters.

@RoselaineMarquesMontero
Copy link
Collaborator Author

ci:test:sf

@RoselaineMarquesMontero
Copy link
Collaborator Author

ci:test:frontend

Copy link
Collaborator

@dsanz dsanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rose, thanks for sending this. I believe we should change some logic in the serializer in order to avoid a breaking change. Please take a look to the inline comments and let me know. Best


return fieldName.substring(0, index);
}
"id", fieldName
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this code was removed? Is now object REST api able to filter by a picklist field using parent/child format in the field name and using a non-collection entity type?

We had to add this special case for picklist because object REST api expects the parent field name (as exposed by the REST) even if the value used for comparison is a child field indeed.

});
}

field.entityFieldType = type;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, this piece of code will make data set manager to store types like 'object' or 'array' as valid values for the entityFieldType field, in addition to the well known string, date or integer

This is fine 👍 . At this level, we don't want to "translate" anything to the FDS domain but just persist information provided by REST openapi metadata.

"entityFieldType",
() -> {
if (Validator.isNotNull(entityFieldType)) {
return entityFieldType;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change represents a breaking change, as follows:

  • Consider a new filter over a child-leaf field of a root-level field of type object or array (let's imagine they are announced as filterable)
  • Prior to this change, the method _isCollection() was able to guess the type using the field name.
  • In case it was considered a collection, we returned FDSEntityFieldTypes.COLLECTION
  • However, this code now returns literally the field type as coming in the filter object entry, that is, object or array in this example

Another example:

  • Consider a pre-existing filter (say, created a month ago) over a child-leaf field of a root-level field of type object or array (older versions of Data Set Manager allowed this)
  • Open the filter in the DSM, then save. This updates entityFieldType in the filter object entry, to object or array
  • Now, the serializer would send literally the field type as coming in the filter object entry, that is, object or array

Note FDS can't handle these values for entity field type, so odata query would be generated in a different way. This is the breaking change we'd like to avoid.

We can fix it bu translating both object and array field types to FDSEntityFieldTypes.COLLECTION to keep backwards compatibility

entityFieldType === EEntityFieldType.STRING
? `'${item.value}'`
: item.value
entityFieldType === EEntityFieldType.INTEGER
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 this is great, now we don't need to guess.

This logic should be fine for old data sets which have STRING as default entity field type. Also, situation in case of a collection looks fine for the purposes of calculating quotedSelectedItems 👍

@RoselaineMarquesMontero
Copy link
Collaborator Author

Hi @dsanz , I've added the changes here, just missing the one to control the name when there is a parent/child, since as I said, I didn't finde any use case, in fact it's breaking now the query if we add it. We can discuss in a call if you want quickly. Thanks a million, Rose

@RoselaineMarquesMontero
Copy link
Collaborator Author

ci:test:frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants