how to validate provided email address is in correct format either in string or strings

ananth
Level 3
how to validate provided email address is in correct format either in string or strings

how to validate provided email address is in correct format?

in below case i can try anything without any format, can do validation here with certain domain?

{
"name": "requester_email",
"label": "Requester's email id",
"type": "STRINGS",
"allowDuplicates": false,
"description": "Please enter the requester's email id",
"mandatory": true
}

0 Kudos
4 Replies
Clรฉment_Stenac

Hi,

There are no capabilities to validate emails in the frontend. You would need to do that in the backend (i.e. in your Python code) at runtime.

You could for example use the standard Python library function email.utils.parseaddr for that (https://docs.python.org/3/library/email.utils.html#email.utils.parseaddr)

ananth
Level 3
Author

can we access JSON frontend from python in DSS plug in , any example would help

0 Kudos
Clรฉment_Stenac

The exact manner depends on what kind of plugin component you are developing (recipe, macro, dataset, trigger, step, ...).

But ultimately, every custom component will receive its configuration, since that's the foundational way that plugins work, and you can do this validation at the time of running and outputing a clear error message.

Validating at edition time would require you to write a fully custom UI and backend. It is a significant challenge and is a lengthy process. We have a documentation here https://doc.dataiku.com/dss/latest/plugins/reference/other.html#custom-settings-ui

ananth
Level 3
Author

we are using macros, how to  outputing a clear error message? any examples available.

0 Kudos