OctopusDeploy / Halibut

| Public | A secure communication stack for .NET using JSON-RPC over SSL.
Other
12 stars 44 forks source link

Add support for derived types to the default TypeRegistry #514

Closed APErebus closed 1 year ago

APErebus commented 1 year ago

Background

If you supply a complex base type as part of the request message, the TypeRegistry doesn't know how to resolve any derived types.

This PR updates the TypeRegistry to check the assembly the base type is in as well as any extra assemblies provided during setup for any derived types.

Results

I chose to implement a new TypeRegistryBuilder to allow consumers to configure the built-in type registry without having to create their own (similar to how we can configure the Message Serializer as part of the HalibutRuntimeBuilder.

We also only look for ExportedTypes() in the assemblies, so types that are private/protected/internal are not registered.

I've added some unit tests to cover the new serialization behaviour.

Shortcut story: [sc-62805]

How to review this PR

Quality :heavy_check_mark:

Pre-requisites

shortcut-integration[bot] commented 1 year ago

This pull request has been linked to Shortcut Story #62805: Update Halibut to support derived types in request messages.