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

yup.date().nullable() field does not result in nullable date prop in the JSON schema #19

Open
stijnjanmaat opened this issue Aug 29, 2024 · 0 comments

Comments

@stijnjanmaat
Copy link

A schema like this:

const yupSchema = yup.object().shape({
  someDate: yup.date().nullable(),
  someString: yup.string().nullable(),
});

...results in a json schema like this:

{
  "type": "object",
  "default": {},
  "properties": {
    "someDate": {
      "type": "string",
      "format": "date-time"
    },
    "someString": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}

I expect it to respect the nullable method on date(). So should result in:

{
  "type": "object",
  "default": {},
  "properties": {
    "someDate": {
      "type": [
        "string", 
        "null",
      ],
      "format": "date-time"
    },
    "someString": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}

Could you add support for this?

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

1 participant