-
Notifications
You must be signed in to change notification settings - Fork 107
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
allow wildcard properties in type statement #235
base: master
Are you sure you want to change the base?
Conversation
src/rules-generator.ts
Outdated
return v[0] === '$'; | ||
}); | ||
|
||
if (hasProps && !hasWildProps ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you format the spacing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted the spacing
samples/issue-212.bolt
Outdated
num: Number; | ||
str: String; | ||
any: Any; | ||
$extras: Any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use $XXX with a type other than Any
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added example with String type
@rbellens Are you still maintaining this PR? If not I might have some free time to continue where you left off |
@dengjeffrey feel free to do so |
Can we have this feature soon, please :) |
Hey can we revive this PR? |
The continuous-integration/travis-ci/pr failure from the integration check isn't related to this PR--it's an issue with [email protected]'s dependency on graceful-fs. Here's a detailed explanation on StackOverflow with some workarounds: https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node. |
Currently it is not allowed to have both wildcard properties and fields. Therefore, it is not possible to define types that allow properties other than the ones defined in the type statement. Only workaround is to not use type statements and manually define the validate rules, which is very cumbersome. See also issues #212 and #213 .
This pull request allows a single wildcard property inside a type definition and when present disables the generation of the default validation rule that does not allow any field other than the ones defined.