-
Notifications
You must be signed in to change notification settings - Fork 57
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
Extend schema fixes #65 #69
Conversation
Looks like a bug to me.. how high is the chance of some code breaking because of this change? |
If you look the bug reported the snippet provided is broken after the upgrade #65.
|
Mark it as 1.0.2. I don't think the library is really usable without this fix. |
This does not work with multiple extend, and I think it could fail on some cases users are using. const SCHEMA_V1 = S.object()
.prop(
'reason',
S.string()
.minLength(1)
)
.extend(SCHEMA_BASE)
const SCHEMA_NEW = S.object()
.prop(
'reason',
S.string()
.minLength(1)
)
.extend(SCHEMA_V1) |
Tks for raise this. Can you add the expected result?
On Wed, 20 May 2020 at 09:51, Jure ***@***.***> wrote:
This does not work with multiple extend, and I think it could fail on some
cases users are using.
const SCHEMA_V1 = S.object()
.prop(
'reason',
S.string()
.minLength(1)
)
.extend(SCHEMA_BASE)
const SCHEMA_NEW = S.object()
.prop(
'reason',
S.string()
.minLength(1)
)
.extend(SCHEMA_V1)
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJN2LHNCROMXTMJBPGX5FDRSOKYHANCNFSM4M4O726A>
.
--
Sent from mobile phone
|
Expected behavior: SCHEMA_V1 should have all definitions defined in SCHEMA_BASE + prop "reason" |
Better merge strategy. Before, the merge was replacing the array element rather than merging the items.
I decided to block all the method after
.extend
to avoid incorrect usage.Wrong but no error raised by FluentSchema
Correct usage should be:
First, the schema is defined with all the props then it extends the base schema.
With the sealed schema after the
.extend
the only thing that can be done is callingvalueOf
I'm unsure if I should mark this as 1.0.2 because it's a bug fix or considering the sealing as breaking change. Feedback welcome.
Checklist
npm run test
andnpm run benchmark