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

Fields marked as required using schema.path('x').required(true) are not marked as required. #16

Open
makinde opened this issue Jul 9, 2019 · 3 comments
Assignees
Milestone

Comments

@makinde
Copy link

makinde commented Jul 9, 2019

If you have a schema, then add a field as being required programmatically, the resulting jsonschema doesn't mark the field as required.

@DScheglov DScheglov self-assigned this Apr 15, 2020
@DScheglov DScheglov added this to the r/1.3 milestone Apr 15, 2020
@DScheglov
Copy link
Owner

Fixed in v1.3.0

@VdeVentura
Copy link

Hello @DScheglov, I haven't dig too deep into this, however I don't think the current behaviour is correct:

I assume that when we say "programmatically required" we are talking about something like: required: () => someLogic

Then if a field is programmatically required, we can't tell at build time what will be the value of required, so I'd argue that it should default to the field being optional.

@DScheglov
Copy link
Owner

@irvingv8 , actually it makes sense.
So, if required is a function let's treat it as optional.

What do you think?

@DScheglov DScheglov reopened this Sep 20, 2020
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

No branches or pull requests

3 participants