Workflo...redField(3)

πŸ“¦
version 2.09 Β· 2 versions
, in fedora 44

πŸ’– NAME πŸ’–

Workflow::Validator::HasRequiredField β€” the validator bestie that makes sure the data you said had to be there... is actually there. No vibes-based skipping. πŸ’…

(Also, if you're squinting at the man page name all truncated like Workflo...redField(3), that's just the manual name getting cropped β€” the real one is Workflow::Validator::HasRequiredField(3), and she is thriving. ✨)


πŸŽ€ VERSION πŸŽ€

This documentation describes version 2.09 of this package. Yes, she's got a number and she's proud of it. 🌸


✨ SYNOPSIS ✨

okay so here's the tea: this validator basically builds itself when you go is_required: yes on a field in your action. Look:

# Validator is created automatically when you mark a field as
# 'is_required: yes' in the action, such as:

action:
- name: CreateUser
  field:
  - name: username
    is_required: yes
    source_class: App::Field::ValidUsers
  ...

Like... you don't even have to do anything?? She just shows up. Iconic behaviour, honestly. πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

This is a simple validator whose whole job is making sure that every field you tagged with the 'is_required' property set to 'yes' is genuinely present before the action it belongs to goes and executes. Vibe check first, action second. πŸ¦‹

So for instance, if your configuration looks like this:

action:
- name: CreateUser
  field:
  - name: username
    is_required: yes
  - name: email
    is_required: yes
  - name: office

...and then an action gets executed with a context like this:

my $wf = FACTORY->get_workflow( $id );
$wf->context( username => 'foo' );
$wf->context( office => 'Ottumwa' );
$wf->execute_action( 'CreateUser' );

she is gonna fail it, with the message:

The following fields require a value: email

Like yes bestie, username and office are cute and accounted for, but where is email?? Nowhere. Not me catching that. 😭

You normally do not need to configure this validator yourself. She gets generated automatically when the Action configuration is read in, based on the 'is_required: yes' attribute. She's self-assembling. Main character energy fr fr.

However, if you do need to create it yourself for whatever reason:

action:
- name: Foo
  validator:
  - name: HasRequiredField
    arg:
    - fieldOne
    - field_two
Important note, don't skip this one: we do not try to match the value in the context against a set of known values or against any algorithm. We literally just check whether the value is defined β€” using the Perl notion of defined, not true/false. Which means both '0' and the empty string count as valid. No cap. πŸ’―

🌈 METHODS 🌈

validate

Validates whether a given set of required fields are defined. That's the whole assignment, and she ate. πŸ”₯

Takes two parameters: a workflow object and an array of names of fields.

The provided fields get matched against the workflow in question, and Workflow::Exception's get thrown in case of missing fields. So if something's absent, bestie is gonna tell you. Loudly. 🫢


Copyright (c) 2003-2021 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Please see the LICENSE


🌸 AUTHORS 🌸

Please see Workflow


and that's the whole page, bestie!! πŸ’– One last thing before you go: this lil doc is from perl v5.42.0, dated 2026-01-17 β€” and it's filed under Workflo...redField(3) in the manual, which is just the truncated version of her full name. Slay, stay defined, and never let your required fields ghost you. πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from