-
Notifications
You must be signed in to change notification settings - Fork 301
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
encoding/jsonschema: create definitions for all nested schemas #390
Comments
Original reply by @proppy in cuelang/cue#390 (comment) In:
Where would the #job comes from? (since it wouldn't be defined in the underlying jsonschema). I wonder if
|
Original reply by @myitcv in cuelang/cue#390 (comment)
It was just a very loose idea to illustrate that we need to be able to address these schemas/constraints in some way. @rogpeppe also pointed out that we should be able to address the field name constraint too, i.e.:
|
This was originally copy/pasted from the demonstration video, and I found a later version discussed in an issue discussing the usage of the github-workflows.json schema. See: - cue-lang/cue#390
This was originally copy/pasted from the demonstration video, and I found a later version discussed in an issue discussing the usage of the github-workflows.json schema. See: - cue-lang/cue#390
I believe I'm struggling with an issue related to this and validation against the github-workflow.cue as well. Similar to the field name constraint, the #name: =~"^[_a-zA-Z][a-zA-Z0-9_-]*$"
#jobNeeds: [...#name] & [_, ...] | #name Using a concrete list of names works just fine, but if I try to generate a list of all existing job names: let allJobIds = [ for k, _ in jobs if k != "merge_queue" {k}] ...and then use it in a job's
Here's my repo for reference, although this is the working version where I manually specify the job names, but I'd like to replace this line in particular with the above: |
Note: in JSON Schema itself, it's possible to address subschemas by their position in the JSON using a URL fragment containing a JSON Pointer. For example, |
Originally opened by @myitcv in cuelang/cue#390
Is your feature request related to a problem? Please describe.
Per discussion with @mpvl. cc @proppy given our previous exchange on this topic.
As part of 65163a0 we flipped to use CUE for this repository's GitHub Actions Workflow specifications. As you can see from that commit, this change relies on the GitHub-defined workflow JSON schema.
Within this schema is a
"jobs"
field of type struct that is defined usingpatternProperties
:This gets translated to:
https://github.com/cuelang/cue/blob/8fcefc84bf1d6868608beb7680a916f57181d9ed/cue.mod/pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue#L306-L307
The issue is that it is now very tricky to refer to the schema that defines the value that can appear in fields in this
"jobs"
struct:Full repro:
https://gist.github.com/myitcv/4ef3d99aea77882ac460e3aaf76622c3
Output is:
Describe the solution you'd like
Something that looks like this:
i.e. the schemas used within
jobs
andsteps
to be defined inline, and easily reference-able.Describe alternatives you've considered
There is a workaround... but it's not pretty :)
Additional context
n/a
The text was updated successfully, but these errors were encountered: