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

docs/howto: Validating YAML using the Go API #150

Open
jpluscplusm opened this issue May 23, 2024 · 1 comment
Open

docs/howto: Validating YAML using the Go API #150

jpluscplusm opened this issue May 23, 2024 · 1 comment
Labels
howto For content that in the "howto" diataxis quadrant

Comments

@jpluscplusm
Copy link
Collaborator

jpluscplusm commented May 23, 2024

In https://cuelang.org/cl/1194700 we added "How to validate JSON using the Go API".

I tried to create a YAML counterpart by copying the JSON guide, and simply swapping JSON (and its other cases) for YAML throughout the page.

I discovered that encoding/json.Extract() and encoding/yaml.Extract() aren't symmetric, being told that

./main.go:36:29: cannot use dataExpr (variable of type *ast.File) as ast.Expr value in argument to ctx.BuildExpr: *ast.File does not implement ast.Expr (missing method declNode)

This issue tracks the creation of that YAML counterpart.

@jpluscplusm jpluscplusm added the howto For content that in the "howto" diataxis quadrant label May 23, 2024
@jpluscplusm
Copy link
Collaborator Author

Perhaps the tested code example present at https://cuelang.org/docs/concept/how-cue-works-with-go/#loading-non-cue-data can help a non-expert write this guide.

cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue May 23, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue May 23, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
Dispatch-Trailer: {"type":"trybot","CL":1194700,"patchset":2,"ref":"refs/changes/00/1194700/2","targetBranch":"master"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
Dispatch-Trailer: {"type":"trybot","CL":1194700,"patchset":4,"ref":"refs/changes/00/1194700/4","targetBranch":"master"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
Dispatch-Trailer: {"type":"trybot","CL":1194700,"patchset":5,"ref":"refs/changes/00/1194700/5","targetBranch":"master"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
Dispatch-Trailer: {"type":"trybot","CL":1194700,"patchset":6,"ref":"refs/changes/00/1194700/6","targetBranch":"master"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Jun 3, 2024
This adds a guide demonstrating how to validate JSON data files against
an embedded CUE schema.

A YAML counterpart is requested in cue-lang/docs-and-content#150, as it
was discovered during this change that the YAML equivalent couldn't be
created simply by performing "s/json/yaml/g" on the source.

Preview-Path: /docs/howto/validate-json-using-go-api/
Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I53c3112650f36a32b86a5d89f670f738d1b798c8
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1194700
TryBot-Result: CUEcueckoo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
howto For content that in the "howto" diataxis quadrant
Projects
Status: Backlog
Development

No branches or pull requests

1 participant