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

describe() on schema with default value null results in "Cannot read property 'Symbol(literal)' of null" #2207

Closed
everhardt opened this issue Nov 4, 2019 · 0 comments · Fixed by #2208
Assignees
Labels
bug Bug or defect
Milestone

Comments

@everhardt
Copy link
Contributor

everhardt commented Nov 4, 2019

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): yes
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: v12.12.0
  • module version with issue: 16.1.7
  • last module version without issue: 14.3.1 (not checked versions in between)
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

I try to get the describe() output of a string schema that has null as its allowed default.

const Joi = require('@hapi/joi');

const schema = Joi.string().allow(null).default(null);

console.log(schema.describe());

What was the result you got?

TypeError: Cannot read property 'Symbol(literal)' of null

What result did you expect?

A nice describe output

@everhardt everhardt added the support Questions, discussions, and general support label Nov 4, 2019
@everhardt everhardt changed the title Allowed non-array default value on Joi.array() results in "Cannot read property 'Symbol(literal)' of null" describe() on schema with default value null results in "Cannot read property 'Symbol(literal)' of null" Nov 4, 2019
@hueniverse hueniverse added bug Bug or defect and removed support Questions, discussions, and general support labels Nov 4, 2019
@hueniverse hueniverse self-assigned this Nov 4, 2019
@hueniverse hueniverse added this to the 16.1.8 milestone Nov 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants