Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to validate if input is actually a YAML #2

Closed
vmatt opened this issue Dec 4, 2024 · 1 comment
Closed

Way to validate if input is actually a YAML #2

vmatt opened this issue Dec 4, 2024 · 1 comment

Comments

@vmatt
Copy link
Collaborator

vmatt commented Dec 4, 2024

CHECK_YAML only return the error message, if the input contains some YAML, but it's malformed. However, it silently fails, if we just pass a single string, without any newlines, or tabulation.

Current behavior

SELECT CHECK_YAML('"not a valid YAML"'); -> null
SELECT YAML_TO_JSON('not a valid YAML'); -> "not a valid YAML".

Expected behavior

SELECT CHECK_YAML('"not a valid YAML"'); -> "ERROR: invalid YAML"
SELECT YAML_TO_JSON('not a valid YAML'); -> null (maybe "ERROR: Invalid YAML" would be better)

@hunyadi
Copy link
Owner

hunyadi commented Dec 4, 2024

I am not sure I understand. A single quoted string is a valid YAML document. By definition, CHECK_YAML should return NULL only if the input is well-formed, in alignment with Snowflake's own CHECK_JSON.

@vmatt vmatt closed this as completed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants