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

Change default function second argument to full helpers (from prefs) #2189

Closed
sekko27 opened this issue Oct 18, 2019 · 0 comments
Closed

Change default function second argument to full helpers (from prefs) #2189

sekko27 opened this issue Oct 18, 2019 · 0 comments
Assignees
Labels
breaking changes Change that can breaking existing code feature New functionality or improvement
Milestone

Comments

@sekko27
Copy link

sekko27 commented Oct 18, 2019

Support plan

  • which support plan is this issue covered by? Community
  • is this issue currently blocking your project? (yes/no): yes
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: 10.13.0
  • module version: 16.1.7
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information: -

How can we help?

Is it possible to pass the current state to the default value provider. It should be a help when using the pattern method (set default value based on the path for example)

const schema = Joi.object({})
  .pattern(
    /^.+$/, 
    Joi.object({
      type: Joi.string().default((ctx, options, state) => {
        // default value can be calculated based on state, for example env values
      })
    })
  );
@hueniverse hueniverse added the support Questions, discussions, and general support label Oct 30, 2019
@hueniverse hueniverse added breaking changes Change that can breaking existing code feature New functionality or improvement and removed support Questions, discussions, and general support labels Nov 17, 2019
@hueniverse hueniverse added this to the 17.0.0 milestone Nov 17, 2019
@hueniverse hueniverse self-assigned this Nov 17, 2019
@hueniverse hueniverse changed the title State in default value provider Change default function second argument to full helpers (from prefs) Nov 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking changes Change that can breaking existing code feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

2 participants