From 6a1d917a5ee8d8306f7b21165732dc54466c3ef9 Mon Sep 17 00:00:00 2001 From: Jeff Kinard Date: Thu, 25 Jul 2024 08:03:18 -0400 Subject: [PATCH] [yaml] Fix yaml provider schema validation and merging (#31974) Signed-off-by: Jeffrey Kinard --- sdks/python/apache_beam/yaml/pipeline.schema.yaml | 6 ++++-- sdks/python/apache_beam/yaml/yaml_transform.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sdks/python/apache_beam/yaml/pipeline.schema.yaml b/sdks/python/apache_beam/yaml/pipeline.schema.yaml index f68a7306d941..c3937e611317 100644 --- a/sdks/python/apache_beam/yaml/pipeline.schema.yaml +++ b/sdks/python/apache_beam/yaml/pipeline.schema.yaml @@ -168,8 +168,10 @@ $defs: providerOrProviderInclude: if: - properties: - include {} + allOf: [ + { properties: { include: { type: string }}}, + { required: [ "include" ] } + ] then: $ref: '#/$defs/providerInclude' else: diff --git a/sdks/python/apache_beam/yaml/yaml_transform.py b/sdks/python/apache_beam/yaml/yaml_transform.py index c1c509ebde2c..ffef9bbcd8f0 100644 --- a/sdks/python/apache_beam/yaml/yaml_transform.py +++ b/sdks/python/apache_beam/yaml/yaml_transform.py @@ -1064,5 +1064,5 @@ def expand_pipeline( return YamlTransform( pipeline_as_composite(pipeline_spec['pipeline']), yaml_provider.merge_providers( - pipeline_spec.get('providers', []), providers or - {})).expand(beam.pvalue.PBegin(pipeline)) + yaml_provider.parse_providers(pipeline_spec.get('providers', [])), + providers or {})).expand(beam.pvalue.PBegin(pipeline))