-
Notifications
You must be signed in to change notification settings - Fork 89
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 to add metas in the schema #341
Conversation
I found some problems with this approach ... that I will need to investigate . First, delete will modify schema if schema is an object (reference is keep if it's an object, so, delete will delete on the reference) Second, it seems the schema is passed to check function . It need to be passed untouched . So, I will need to dig more on this . |
So, @icebob . I think I'm ready . I've added tests on each rules checking if the changes doesn't impact the rule . Also, I'm testing it when testing another library (writings examples that use this modified version), and doesn't get bugs (feel free to tag me if you found a bug on this in the future) Also, I've found that sometimes you will handle the schemas with care, and sometimes not (like deleting $$async on source object), not sure if it's normal ? |
LGTM, but could you add some sentences and example about it into the docs/README.md, please? moreover, I should check what happened with GH actions, because CI is not executed on this PR. |
@icebob is the little documentation added, ok/enough ? |
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.
Cool, thanks!
Fix #338
I think it can be useful to add some metas in the schemas / rules
like :
I think it can be usefull to reuse the validation params to do others things ( like here, generating openapi from params ) .
The keys starting with $$ can be just skipped from the validation, categorized as "system properties" ? (this can also allow to add other systems properties without breaking changes) .
I've checked with the already existing keys, to remove the metas after they are used
$$async
seems to be used only incompile
(so beforegetRuleFromSchema
) / same for$$root
/ seems the same for$$strict
$$type
seems to be used inresolveType
(ingetRuleFromSchema
) only, and only on current schema ( it will callgetRuleFromSchema
only on sub rules ), and so I removed the $$ afterI also update typescript to allow other libraries to do things like :
TODO :