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

Report all types of error at the same time (constraints and concreteness) #1998

Closed
edouard-lopez opened this issue Oct 12, 2022 · 2 comments
Closed
Labels
FeatureRequest New feature or request

Comments

@edouard-lopez
Copy link

Is your feature request related to a problem? Please describe.
When writing a validation schema for a Keycloak config file, I was confused as a rule that check the correctness of my item stop throw error after I added a new item that break another constraint.

Describe the solution you'd like
I would like the correctness error to be thrown ASAP, and not have to wait for the whole document to be well-formed.
The YAML document is big, so I progress node by node.

Describe alternatives you've considered
fixing issues unrelated to the topic I'm working on to have feedback on my primary goal is a pain and create lots of context switching.

Additional context

Only view constraint error

One of the role is malformed, we got the related error, that's fine. But the error related to the description field is not visible (field is mandatory).

#Role: {
	description: string
	realm_name:  string
	name?:       string
}

#Roles: {
    [=~#"^ROLE_\w+"#]: #Role
}


roles: #Roles & {
    ROLE_WORKBENCH_USER: {
        realm_name: "Marketplace"
    }
    ROLE_WORKER: {
        description: "Role to access on all workers of MM."
        realm_name: "Marketplace"
    }
        "/payment/refund/reader": {
        description: "Grants read only access to refund domain."
        realm_name: "Marketplace"
    }
}

Malformed role Error

roles: field not allowed: "/payment/refund/reader":
    -:7:9
    -:12:8
    -:20:9

Missing field error

Only when the malformed role "/payment/refund/reader" is removed do we see the error about the missing description field.

roles.ROLE_WORKBENCH_USER.description: incomplete value string:
    -:2:15
@edouard-lopez edouard-lopez added FeatureRequest New feature or request Triage Requires triage/attention labels Oct 12, 2022
@myitcv myitcv removed the Triage Requires triage/attention label Oct 12, 2022
@myitcv myitcv changed the title Throw all types of error at the same time (correctness and constrains) Report all types of error at the same time (constraints and concreteness) Oct 12, 2022
@myitcv
Copy link
Member

myitcv commented Oct 12, 2022

Thanks @edouard-lopez.

For others following along, this discussion started on Slack.

My understanding is that even under changes proposed in the required fields proposal v2, a concreteness check would only happen after validation of constraints. Today this necessarily requires that a CUE configuration be valid with respect to constraints before concreteness is checked. However, it struct me that this need not necessarily be the case.

So @edouard-lopez kindly raised this issue as an exploration of whether both could be reported at the same time.

@myitcv
Copy link
Member

myitcv commented Oct 14, 2022

I totally forgot that #1319 existed. I'll close this in favour of that issue, linking to this issue from #1319.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants