Generic REST API fetchPlan _base parameter returns only _local fields (JMIX v.1.5.4)

“association” properties of the entity are not returned when fetchPlan=_base

Is this expected or a bug?

also when a fetchPlan is defined, properties are returned in random order, not the order defined in the fetchPlan. Can this reflect the defined order?

Hello,

Built-in _base fetch plan does not include association type fields, such fields must be specified in fetchPlan. More information about fetch plan is described in the documentation below.

FetchPlan does not display the order of the fields in the returned object.

Docs: Fetching Data :: Jmix Documentation

Regards,
Nikita

So it appears _local and _base return the same results, is that intentional?

They have a slight difference, here is a detailed description of fetch plans:

  • _local fetch plan includes all local attributes (immediate attributes that are not references).
  • _instance_name fetch plan includes all attributes forming the instance name. These can be local attributes and references. If instance name is not specified for an entity, this fetch plan is empty.
  • _base fetch plan includes all attributes of the _local and _instance_name fetch plans. It differs from _local only if the _instance_name fetch plan includes reference attributes.

Regards,
Nikita

aren’t reference attributes the association and composition?

Reference attributes are composition and association.

Regards,
Nikita

Thank you for confirming, does that imply it is a bug?

Could you explain what are you considering as a bug?

Hi Konstantin

I have the following results on the generic API:

1.) the order in which properties are returned are somewhat random in order, not the same as specified in the model or fetchPlan

2.) when using the _base fetchPlan the refence properties (composition and association) are not returned as expected, but returns the same results as _local

3.) the openapi.json file generated by the REST API does not include “rest” at the beginning of some of the urls and needs to be manually updated, when for example imported into Postman to work

4.) when using search in a POST request it does not seem to support the additional parameters (e.g. not limit is applied, or offset, or fetchPlan, etc)

Here is an example for 4 above:

curl --location ‘http://localhost:8888/rest/entities/ac8_BusinessContractParty/search?fetchPlan=party&limit=10&offset=5&sort=%2Bdescription&returnNulls=true
–header ‘Accept: application/json’
–header ‘Authorization: Bearer ePBF7cIqnpyocsMASGM7wqf7z0Y’
–header ‘Content-Type: text/plain’
–header ‘Cookie: JSESSIONID=ED85A6CCDF89B42B1AA8EC1D710E9575’
–data ‘{“filter”:
{
“conditions”: [
{
“property”: “active”,
“operator”: “=”,
“value”: true
}
]
}
}’

Should you have any questions feel free to set up a quick call for a demonstration.

Hi Marius,

Thank you for reporting the problems.

However, (2) is a correct behavior, _base fetch plan doesn’t include references until they are in _instance_name. See the docs.

For the other problems, could you please create separate issues at Issues · jmix-framework/jmix · GitHub.

Regards,
Konstantin