You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/01/23 13:22:17 UTC

[airflow] 23/24: Doc: Added an enum param example (#20841)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit d5870f0d644d957654f70fee53597651a67a2d8a
Author: Matt Rixman <58...@users.noreply.github.com>
AuthorDate: Wed Jan 12 23:48:35 2022 -0700

    Doc: Added an enum param example (#20841)
    
    More examples makes it easier to compare our docs with the json-schema docs and figure out how they work together.
    I ended up doing something similar to this in my code and figured I'd contribute an example.
    
    Co-authored-by: Matt Rixman <Ma...@users.noreply.github.com>
    (cherry picked from commit 8dc68d47048d559cf4b76874d8d5e7a5af6359b6)
---
 docs/apache-airflow/concepts/params.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/apache-airflow/concepts/params.rst b/docs/apache-airflow/concepts/params.rst
index ef266ea..fd4a167 100644
--- a/docs/apache-airflow/concepts/params.rst
+++ b/docs/apache-airflow/concepts/params.rst
@@ -134,6 +134,9 @@ JSON Schema Validation
             # a required param which can be of multiple types
             "dummy": Param(type=["null", "number", "string"]),
 
+            # an enum param, must be one of three values
+            "enum_param": Param("foo", enum=["foo", "bar", 42]),
+
             # a param which uses json-schema formatting
             "email": Param(
                 default="example@example.com",