API vocabulary: MethodInfo spelled out, sessionId everywhere, legacy registration obsolete - #161
Merged
Merged
Conversation
…registration obsolete "method" is the JSON-RPC callable named on the wire and a MethodInfo is always spelled MethodInfo: RpcMethod.FromMethod is FromMethodInfo and RpcInterfaceMethod.Method is MethodInfo. The session parameter is spelled sessionId on every overload; BindService, Handler.RegisterInstance and the JsonRpcService(string) constructor used sessionID. Handler gets a class summary and SessionSelector's summary says the selection is independent of ASP.NET Core session state. Handler.RegisterFuction and UnRegisterFunction keep their names and behaviour and are obsolete; the message says that BindMethod throws on a duplicate name where RegisterFuction replaces it. Tests that exercise the legacy pair suppress CS0618 locally. The README defines "method" at the top of Defining methods and "session" at the top of Sessions and context; the package README gets the method sentence; CHANGELOG and the upgrade guide record the renames.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the API vocabulary decisions in AUS-986, reached in a debate on the naming of "method" and "session" and accepted by both sides. Before 2.0.0 final; no aliases for preview names.
The rule
"method" is always the JSON-RPC callable named on the wire; a
MethodInfois always spelledMethodInfo; the CLR side of a method is its implementation (a delegate, or a[JsonRpcMethod]member of a class or interface); a "service" is an object or type whose members become methods. A "session" is a named set of methods with its own configuration.ServiceBinder.BindMethodandUnbindMethodkeep their names.Code
RpcMethod.FromMethod(three overloads) isRpcMethod.FromMethodInfo;FromDelegateis unchanged.RpcInterfaceMethod.MethodisRpcInterfaceMethod.MethodInfo. This removes "inspectm.Method" on anRpcInterfaceMethodfrom the README, the double meaning the rule exists to remove.Handler.RegisterFuctionandUnRegisterFunctionkeep their names and behaviour and are[Obsolete]; the message on the first says thatBindMethodthrows on a duplicate name whereRegisterFuctionreplaces it. Tests that exercise the legacy pair suppress CS0618 locally.sessionIdon every overload;BindService,Handler.RegisterInstanceand theJsonRpcService(string)constructor usedsessionID. Only a named argumentsessionID:breaks; the tree has none.Handlergets a class summary;JsonRpcOptions.SessionSelector's summary says the selection is independent of ASP.NET Core session state.Documentation
ServiceBindernever asks for aMethodInfo; the Delegates lead sentence is rewritten; "Sessions and context" opens with a definition of session.Verification
dotnet build AustinHarris.JsonRpc.sln -c Release: 0 errors.dotnet test AustinHarris.JsonRpcTestN -c Release: 1,191 passed on net8.0 and 1,191 on net10.0, 0 failed.site/build.py,render.py --checkandtest_render.pypass; no benchmark figure changed.