You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "shubham-j-sde (via GitHub)" <gi...@apache.org> on 2025/04/22 17:36:32 UTC
[PR] Improve validation error message for chain transform [beam]
shubham-j-sde opened a new pull request, #34708:
URL: https://github.com/apache/beam/pull/34708
addresses #34690
input
```
jsonschema.exceptions.ValidationError: 'input' should not be used along with 'chain' type transforms. 'Create' should not be valid under {} around line 9
```
output
```
jsonschema.exceptions.ValidationError: 'output' should not be used along with 'chain' type transforms. 'LogForTesting' should not be valid under {} around line 7
```
**Please** add a meaningful description for your change here
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2839627879
pull_request_target
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2055037317
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
+ exn.schema_path[-2] in ['input', 'output']):
+ exn.message = (
+ f"'{exn.schema_path[-2]}' should not be used "
+ "along with 'chain' type transforms. " + exn.message)
Review Comment:
can you write a test?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2838760538
> Run Yaml_Xlang_Direct PreCommit
This is perm-red now. No need to run this for now.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2066296738
##########
sdks/python/apache_beam/yaml/yaml_transform_unit_test.py:
##########
@@ -38,8 +38,14 @@
from apache_beam.yaml.yaml_transform import preprocess_flattened_inputs
from apache_beam.yaml.yaml_transform import preprocess_windowing
from apache_beam.yaml.yaml_transform import push_windowing_to_roots
+from apache_beam.yaml.yaml_transform import validate_against_schema
from apache_beam.yaml.yaml_utils import SafeLineLoader
+try:
+ import jsonschema
+except ImportError:
+ jsonschema = None
Review Comment:
Do we need this since https://github.com/apache/beam/blob/b9fa49a9827dd28349e382f479ebd1a8bbe27d07/sdks/python/setup.py#L356 means jsonschema should be installed in general.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2822321404
Run Python_Coverage PreCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2054962041
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
Review Comment:
should I remove?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2839223549
Run Python_Runners PreCommit 3.9
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2822192026
Run Python_Coverage PreCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad merged PR #34708:
URL: https://github.com/apache/beam/pull/34708
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2822430812
@liferoad, can u see if this message works?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2055035747
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
Review Comment:
I see. Fine to leave this for now.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2066402893
##########
sdks/python/apache_beam/yaml/yaml_transform_unit_test.py:
##########
@@ -38,8 +38,14 @@
from apache_beam.yaml.yaml_transform import preprocess_flattened_inputs
from apache_beam.yaml.yaml_transform import preprocess_windowing
from apache_beam.yaml.yaml_transform import push_windowing_to_roots
+from apache_beam.yaml.yaml_transform import validate_against_schema
from apache_beam.yaml.yaml_utils import SafeLineLoader
+try:
+ import jsonschema
+except ImportError:
+ jsonschema = None
Review Comment:
multiple yaml files use the same format
https://github.com/apache/beam/blob/5f2403c747b35a2892b63380ac707ea608ceefbe/sdks/python/apache_beam/yaml/yaml_provider.py#L501
https://github.com/apache/beam/blob/5f2403c747b35a2892b63380ac707ea608ceefbe/sdks/python/apache_beam/yaml/json_utils.py#L28
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2054961438
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
Review Comment:
the schema had output, so i included
https://github.com/apache/beam/blob/c8e5118d6d17d6df4a629a2b0f834df74b06d7e1/sdks/python/apache_beam/yaml/pipeline.schema.yaml#L92
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2066529747
##########
sdks/python/apache_beam/yaml/yaml_transform_unit_test.py:
##########
@@ -38,8 +38,14 @@
from apache_beam.yaml.yaml_transform import preprocess_flattened_inputs
from apache_beam.yaml.yaml_transform import preprocess_windowing
from apache_beam.yaml.yaml_transform import push_windowing_to_roots
+from apache_beam.yaml.yaml_transform import validate_against_schema
from apache_beam.yaml.yaml_utils import SafeLineLoader
+try:
+ import jsonschema
+except ImportError:
+ jsonschema = None
Review Comment:
Understood. It is a bit strange we still need them for the tests since jsonschema is required now.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2839002344
Can you rebase your PR? I merged a workaround fix for the YAML workflow.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2838027345
Run Yaml_Xlang_Direct PreCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2837301298
Run Yaml_Xlang_Direct PreCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2066330497
##########
sdks/python/apache_beam/yaml/yaml_transform_unit_test.py:
##########
@@ -38,8 +38,14 @@
from apache_beam.yaml.yaml_transform import preprocess_flattened_inputs
from apache_beam.yaml.yaml_transform import preprocess_windowing
from apache_beam.yaml.yaml_transform import push_windowing_to_roots
+from apache_beam.yaml.yaml_transform import validate_against_schema
from apache_beam.yaml.yaml_utils import SafeLineLoader
+try:
+ import jsonschema
+except ImportError:
+ jsonschema = None
Review Comment:
actually, I was getting this error without that
```NameError: name 'jsonschema' is not defined```
so, I refered from yaml_transform file https://github.com/apache/beam/blob/master/sdks/python/apache_beam/yaml/yaml_transform.py#L49-L52
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2822430322
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @claudevdm for label python.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2055063643
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
+ exn.schema_path[-2] in ['input', 'output']):
+ exn.message = (
+ f"'{exn.schema_path[-2]}' should not be used "
+ "along with 'chain' type transforms. " + exn.message)
Review Comment:
yeah sure.
it will be part of [transform_unit_test](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/yaml/yaml_transform_unit_test.py) or [transform_test](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/yaml/yaml_transform_test.py) ?
I checked, the function isn't called for any current tests in either files.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2822217531
Run Python_Runners PreCommit 3.9
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2054877279
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
Review Comment:
I do not think we have `output`?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34708:
URL: https://github.com/apache/beam/pull/34708#discussion_r2055128148
##########
sdks/python/apache_beam/yaml/yaml_transform.py:
##########
@@ -85,6 +85,12 @@ def validate_against_schema(pipeline, strictness):
jsonschema.validate(pipeline, pipeline_schema(strictness))
except jsonschema.ValidationError as exn:
exn.message += f" around line {_closest_line(pipeline, exn.path)}"
+ # validation message for chain-type transform
+ if (exn.schema_path[-1] == 'not' and
+ exn.schema_path[-2] in ['input', 'output']):
+ exn.message = (
+ f"'{exn.schema_path[-2]}' should not be used "
+ "along with 'chain' type transforms. " + exn.message)
Review Comment:
[transform_unit_test](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/yaml/yaml_transform_unit_test.py) should be fine.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve validation error message for chain transform [beam]
Posted by "shubham-j-sde (via GitHub)" <gi...@apache.org>.
shubham-j-sde commented on PR #34708:
URL: https://github.com/apache/beam/pull/34708#issuecomment-2839325207
Run Python_Coverage PreCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org