Type "file name"?

I’d like a leaf to take the name of a file, possibly with a pre-defined ending (e.g. .myformat), among all matching files in a certain directory.
Let’s say:

leaf name {
    type X;
    description "An existing .myformat file in the directory /var/myfiles";

Is it possible?

this depends on more details of your requirement…

The most simple is to have string with a file ending pattern only:

type string {
    pattern "*\.myformat";

This by itself does not validate that file exists on your system of course…
You can add this verification to a validation callback via tailf:validate "...";

If you want the values to be “proposed” to user entering the data, you can look into
tailf:cli-completion-actionpoint, though this is limited to CLI northbound API only…