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

Add framework to support more optional types #206

Merged
merged 2 commits into from
Feb 2, 2024
Merged

Conversation

jangko
Copy link
Contributor

@jangko jangko commented Feb 2, 2024

This PR add a framework to rpc server by using more templates than macros to handle optional types.
RPC server recognize both std/options and results.Opt as optional type for the parameters.
If needed user can add more optional types by overloading rpc_isOptional template. e.g. add support for or ptr/ref object as optional.
Now aliases to optional types also works.

Optional object fields is handled by nim-json-rpc as usual. This PR is targeting optional parameters of RPC methods.

fix #202

This PR add a framework to rpc server by using more templates than macros to handle optional types.
Now rpc server recognize both `std/options` and `results.Opt` as optional type for the parameters.
If needed user can add more optional types by overloading `rpc_isOptional` template.
Now aliases to optional types also works.
@jangko jangko merged commit 165e541 into master Feb 2, 2024
12 checks passed
@jangko jangko deleted the support-more-optionals branch February 2, 2024 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for additional option library should be configurable at compile time
1 participant