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
Fix ajv version to 5.0.0.beta-15 #15426
Conversation
Changed Packages
|
Thanks for the contribution! |
Uffizzi Preview Environment
|
72deec0
to
d994a1d
Compare
Ah wait - my bad - looks like they've fixed the issues. Perfect. rjsf-team/react-jsonschema-form#3309 @dagda1 do you wanna give this PR a twirl and see if it's working as expected now with the |
@benjdlambert If you look at the PR, the validation messages in the @rjsf PR point to the field name, which means I personally cannot use them or at least our clients won't accept that. There is this old PR in I might be missing something, but how can anyone have validation messages that point to the non-human readable field name? I totally understand if you want to merge this PR. |
@dagda1 so maybe if we provide the option to also configure a validator, but default to the v8 one as it works for the |
@benjdlambert Here is the validation with Here is the validation with The inclusion of the fieldName makes this a no go for me but this is totally working correctly as far as We could have a union string type added to the formProps: {
validator: 'ajv6' | 'ajv8' I could create a PR for this next week if we can agree on the approach now? |
@dagda1 I wonder though if you can use the |
@benjdlambert Yes, that definitely works. Something like this <NextScaffolderPage
FormProps={{
noHtml5Validate: true,
transformErrors: errors =>
errors.map(e =>
typeof e.message === 'string' &&
/^must have required property '(.*)'/.test(e.message)
? { ...e, message: 'is a required property' }
: e,
),
}}
/> But are you saying anyone wanting this has to supply their own But publicly exposing Then again, I'm not too fond of the default experience of not offering a way to fix it OOTB. |
@dagda1 I wonder if we provide a default one that you can override still, but if you wanted to override it you would have to account for the required case too. Ideally I'd like to move off the ajv6 one as it's deprecated anyways, so the sooner we can get on to v8 with decent messages the better. I also wonder if this is kind of moot if we can get that other work done so that it will use the title instead of the key name and then it could be more human readable? Maybe we can look at porting that work to the v5 branch instead? |
@benjdlambert I agree ajv8 is the goal. I think we should do both. As the |
Do you think we can ask "ajv" to add an ability to customize error message? https://ajv.js.org/packages/ajv-errors.html#messages-for-properties-and-items |
c8b1484
to
143d917
Compare
Signed-off-by: Testo Nakada <test1@doramail.com>
@dagda1 - feeling that rjsf-team/react-jsonschema-form#3337 is going to fix your issues right? So wondering if we should let this go ahead, given the fact that it will eventually be fixed upstream? Hopefully v5 will reach stable this week, so thinking once that happens we can start to roll out the |
There is still more to do on that PR if you look at this comment. I'm trying to see if I can get the extra work done another PR. Would it be possible to wait until my PR is definitely merged before merging this? I don't want to make any assumptions about when my PR for But I totally understand if you want to merge it now |
@dagda1 na - it's fine to wait here until we've got some answers. All good. |
@benjdlambert @testn I got my PR merged. It has not been published yet, but it will either be |
@dagda1 nice work on that! I pinged to get an update on when 5.0.0 is going to be released and hopefully should be within a week rjsf-team/react-jsonschema-form#3144 (comment) and I think once that is done we can replace this issue with the bump to v5.0.0 or even re-purpose this PR. That's kind of the last blocker before we can roll out the |
Perhaps related, but upon updating to Backstage
|
@carl-reverb hmm that's unfortunate, could you maybe remove all occurences of |
@carl-reverb |
Mmm, since upgrading backstage isn't an urgent matter, I'm not willing to resort to hacks like editing the lockfile or manipulating sub-sub-sub-package resolutions. I'll wait for |
@carl-reverb happy to come up with a fix for a 1.10.1 release to try and make this easier, could you send me your |
Ok so I think from your comment @dagda1 I can see whats happened. v1.9 we had the I think I can just bump all of them to the latest beta, and it should work as expected I think. Just confirming that now. |
Let's close this and rework the PR then |
@carl-reverb |
Hey, I just made a Pull Request!
Upgrade ajv to version 5.0.0-beta15 and make sure that we use ajv8 rather than ajv6
✔️ Checklist
Signed-off-by
line in the message. (more info)