Managing the assets order Dealing with priority issues

Default assets order

While building thecodingmachine/discovery, a great deal of work has been done to make sure that assets are returned in a useful and predictable order.

By default, assets are returned in an order respecting the dependencies between packages.

If packages have no dependencies, they are returned in alphabetical order.

In the example above, assets will be returned in this order:

  • Package B assets will be returned before Package A assets (because of the dependency)
  • Package C assets will be returned last (because of the alphabetical ordering)

Altering assets priority

You can however alter this order using the priority modifier.

discovery.json
{
    "some_asset_type": [
        {
            "value": "some_value",
            "priority": 99
        }
    ]
}

The default priority is 0.

Values with higher priorities will come first in the array.

Values with the same priority are ordered first by package dependency order, then by alphabetical order.

Found a typo? Something is wrong in this documentation? Just fork and edit it!