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

Message of the error type in required fields contains "or not to be present" #666

Closed
micronull opened this issue Nov 16, 2022 · 2 comments
Closed

Comments

@micronull
Copy link
Contributor

Spec:

components:
  schemas:
    Something:
      type: object
      required: [field]
      properties:
        field:
          title: Some field
          type: string

We send incorrect type value:

err := doc.Components.Schemas["Something"].Value.VisitJSON(map[string]interface{}{"field": 123})

and get an error Error at "/field": Field must be set to string or not be present.

This is critical case for us, since the error message must strictly follow the specification.
We return it to our customers.

@micronull
Copy link
Contributor Author

Too many changes need to be made in the code to get rid of this piece of the error message.
Maybe just remove it from the text? So that the error message "Field must be set to sometype" is always returned?

What do you think about this @fenollp?

@micronull
Copy link
Contributor Author

micronull commented Nov 23, 2022

It is now possible to redefine the text of error messages (#679), so the task is not relevant.

However, I think it makes sense to remove the phrase "or not to be present" in the message.

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 a pull request may close this issue.

1 participant