uranusjr commented on code in PR #74748:
URL: https://github.com/apache/airflow/pull/74748#discussion_r4310474144


##########
airflow-core/docs/authoring-and-scheduling/yaml-dags.rst:
##########
@@ -0,0 +1,349 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _yaml-dags:
+
+Writing Dags in YAML
+====================
+
+|experimental|
+
+.. versionadded:: 3.4.0
+
+Airflow can build a Dag from a YAML document. One YAML document describes one
+Dag, and the YAML Dag importer turns it into the same Dag structure that 
Airflow
+runs like any other source. The tasks can be ordinary Airflow operators, so
+every provider operator is available without writing code.
+
+A document is declarative. Everything in it is a value, and the shape of each
+value decides what it means. Since the format round-trips through JSON, a
+document may equally be written as JSON.
+
+The following is a example YAML file defining a Dag:
+
+.. code-block:: yaml
+
+    $schema: https://airflow.apache.org/schemas/dag/2026-10-30.json
+    dag_id: daily_report
+    schedule: "0 3 * * *"
+    start_date: 2024-01-01
+
+    tasks:
+      - id: extract
+        uses: airflow.providers.standard.operators.bash.BashOperator
+        with:
+          bash_command:
+            $t: "extract.sh {{ ds }}"
+
+      - id: publish
+        uses: airflow.providers.standard.operators.bash.BashOperator
+        needs: [extract]
+        with:
+          bash_command: "publish.sh"
+
+This Dag runs every day at 03:00, The first task ``extract`` renders the date
+into its command. The second ``publish`` waits for ``extract`` through
+``needs`` and runs a fixed command.
+
+Enabling the importer
+---------------------
+
+The YAML importer is opt-in. Register it in
+:ref:`config:dag_processor__dag_importer_configs`:
+
+.. code-block:: ini
+
+    [dag_processor]
+    dag_importer_configs = [{"classpath": 
"airflow.sdk.importers.yaml_importer.YamlDagImporter"}]
+
+The importer handles ``.yaml`` and ``.yml`` files that declare a Dag 
``$schema``
+(see below). For per-bundle registration and other options, see
+:doc:`../administration-and-deployment/dag-importers`.
+
+The shape of a document
+-----------------------
+
+``$schema`` (required)
+    The format version the document is written against, given as the URL of a
+    published schema. The version it names selects the rules the document is
+    parsed with. ``$schema`` is also how Airflow recognizes the file
+    as a Dag; a file without it is silently skipped. Editors that understand
+    ``$schema`` will offer validation and completion with no extra setup.

Review Comment:
   The importer never fetches the URL (discovery only matches the prefix), so 
nothing breaks at runtime unpublished. We’ll try to figure out publishing 
before the 3.4.0 release is GA.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to