As a user, I need validation for required fields
Summary
Add a property to plugin settings configuration called 'required'
Proposed benefits
Once available, deployments of the taps/targets/other plugins will be able to validate required settings.
Proposal details
required Setting Field
The required setting field should define the conditions under which the setting is required.
- If not present, the setting should be considered always required implicitly
- If present with a value of
true, the setting should be considered always required - If present with a value of
false, the setting should be considered never required (optional) - If present with a value conforming to a SpEL expression, the setting should be considered required if the expression evaluates to
trueand not required if the expression evaluates tofalse
Example
credential_type Setting
Specifiying a credential_type setting should define options for use in required_when expression.
tap-google-analytics Example
extractors:
- name: tap-google-analytics
label: Google Analytics
description: App and website analytics platform hosted by Google
namespace: tap_google_analytics
variant: meltano
docs: "https://hub.meltano.com/extractors/google-analytics.html"
repo: https://gitlab.com/meltano/tap-google-analytics
pip_url: "git+https://gitlab.com/meltano/tap-google-analytics.git"
capabilities:
- catalog
- discover
settings:
- name: credential_type # required when using 'credentials_file' credential_type
kind: options
options:
- label: OAuth
value: oauth
- label: Credentials File
value: credentials_file
- name: key_file_location # required when using 'credentials_file' credential_type
env_aliases: [GOOGLE_ANALYTICS_API_CLIENT_SECRETS]
kind: file
value: $MELTANO_PROJECT_ROOT/client_secrets.json
label: Client Secrets
placeholder: Ex. client_secrets.json
required_when: credential_type == 'credentials_file'
- name: oauth_credentials.client_id # required when using 'oauth' credential_type
env_aliases: [GOOGLE_ANALYTICS_API_OAUTH_CLIENT_ID]
kind: password
label: OAuth Client ID
required_when: credential_type == 'oauth'
- name: oauth_credentials.client_secret # required when using 'oauth' credential_type
env_aliases: [GOOGLE_ANALYTICS_API_OAUTH_CLIENT_SECRET]
kind: password
label: OAuth Client Secret
required_when: credential_type == 'oauth'
- name: oauth_credentials.access_token # required when using 'oauth' credential_type
env_aliases: [GOOGLE_ANALYTICS_API_OAUTH_ACCESS_TOKEN]
kind: password
label: OAuth Access Token
required_when: credential_type == 'oauth'
- name: oauth_credentials.refresh_token # required when using 'oauth' credential_type
env_aliases: [GOOGLE_ANALYTICS_API_OAUTH_REFRESH_TOKEN]
kind: password
label: OAuth Refresh Token
required_when: credential_type == 'oauth'
- name: view_id # always required
env_aliases: [GOOGLE_ANALYTICS_API_VIEW_ID]
label: View ID
placeholder: Ex. 198343027
required_when: true
- name: reports # not required (optional)
env_aliases: [GOOGLE_ANALYTICS_API_REPORTS]
label: Reports
placeholder: Ex. my_report_definition.json
- name: start_date # always required
env_aliases: [GOOGLE_ANALYTICS_API_START_DATE]
kind: date_iso8601
description: This property determines how much historical data will be extracted. Please be aware that the larger the time period and amount of data, the longer the initial extraction can be expected to take.
required_when: true
- name: end_date # not required (optional)
env_aliases: [GOOGLE_ANALYTICS_API_END_DATE]
kind: date_iso8601
description: Date up to when historical data will be extracted.Best reasons not to build
This feature will improve upon, and deprecate the settings group validation from discovery.yaml use.