directus icon indicating copy to clipboard operation
directus copied to clipboard

Parse dynamic variables in preset and field validation uses

Open u12206050 opened this issue 3 years ago • 6 comments

Description

Fixes both dynamic variables eg. $NOW in presets and field validation on create and update requests. Tests also added.

Fixes #14759, fixes #13198

Type of Change

  • [x] Bugfix
  • [ ] Improvement

Requirements Checklist

  • [x] New / updated tests are included
  • [x] All tests are passing locally
  • [x] Performed a self-review of the submitted code

u12206050 avatar Aug 02 '22 10:08 u12206050

@qborisb This touches the same validation logic as we were discussing the other day. I don't think this change affects that update in any way, but good to have on your radar regardless 🙂

rijkvanzanten avatar Aug 02 '22 13:08 rijkvanzanten

@rijkvanzanten Was there anything left to discuss on this? We could merge this and start on a new PR to support $CURRENT_ITEM or?

u12206050 avatar Aug 03 '22 19:08 u12206050

I think the changes are good to go. @licitdev Could you check if this path is covered in the blackbox and if not advise on how to add proper tests there?

rijkvanzanten avatar Aug 03 '22 20:08 rijkvanzanten

@rijkvanzanten Just ran the black box tests and they all passed. But also couldn't find that it was testing any of the services test. So seems like it is independent of the tests defined in api/tests.

u12206050 avatar Aug 04 '22 08:08 u12206050

@rijkvanzanten The blackbox tests currently do not cover the dynamic variables and functions in filtering tests. I'm adding additional permissions testing capabilities which will then allow for the testing of the presets and validations to be included.

@u12206050 The test you've added runs under the Unit Tests.

licitdev avatar Aug 04 '22 09:08 licitdev

@licitdev so this PR can be merged now and all tests will be included later right?

u12206050 avatar Aug 04 '22 19:08 u12206050

Closing in favour of https://github.com/directus/directus/pull/14887. 👍

licitdev avatar Aug 19 '22 04:08 licitdev

To bad the $CURRENT_ITEM is taking so long, should have just merged this smaller fix I guess

u12206050 avatar Mar 12 '23 08:03 u12206050