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

fix: message of the error type in required fields contains "or not to be present" #667

Closed
wants to merge 1 commit into from
Closed

fix: message of the error type in required fields contains "or not to be present" #667

wants to merge 1 commit into from

Conversation

micronull
Copy link
Contributor

issue: #666

}

if !markRequiredProperty(r.Value, k, schema.Required) {
for _, a := range schema.AnyOf {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only handle anyof?

msg.WriteString("Field must be set to ")
msg.WriteString(schema.Type)

if !schema.isThisRequired {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to figure out this boolean only when building the error, not beforehand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Then at each error you will have to make calculations. This is an additional expense of computing resources.
  2. At this point we don't know anything about parent Schemas. They will have to be wired somehow.

Do you have any ideas how to do it better?

Copy link
Collaborator

@fenollp fenollp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments

@micronull micronull closed this Nov 23, 2022
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

Successfully merging this pull request may close these issues.

Message of the error type in required fields contains "or not to be present"
2 participants