Skip to content

Commit

Permalink
Fix example code in Doc (apache#19824)
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy authored Nov 25, 2021
1 parent 5482b6a commit 76c598a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions docs/apache-airflow/concepts/params.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ which won't be doing any such validations.
from airflow.models.param import Param
with DAG(
'my_dag',
params: {
'int_param': Param(10, type='integer', minimum=0, maximum=20), # a int param with default value
'str_param': Param(type='string', minLength=2, maxLength=4), # a mandatory str param
'dummy_param': Param(type=['null', 'number', 'string']) # a param which can be None as well
'old_param': 'old_way_of_passing', # i.e. no data or type validations
'simple_param': Param('im_just_like_old_param'), # i.e. no data or type validations
'email_param': Param(
default='[email protected]',
type='string',
format='idn-email',
minLength=5,
maxLength=255,
),
}
'my_dag',
params={
'int_param': Param(10, type='integer', minimum=0, maximum=20), # a int param with default value
'str_param': Param(type='string', minLength=2, maxLength=4), # a mandatory str param
'dummy_param': Param(type=['null', 'number', 'string']) # a param which can be None as well
'old_param': 'old_way_of_passing', # i.e. no data or type validations
'simple_param': Param('im_just_like_old_param'), # i.e. no data or type validations
'email_param': Param(
default='[email protected]',
type='string',
format='idn-email',
minLength=5,
maxLength=255,
),
},
)
``Param`` make use of `json-schema <https://json-schema.org/>`__ to define the properties and doing the
validation, so one can use the full json-schema specifications mentioned at
Expand Down

0 comments on commit 76c598a

Please sign in to comment.