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 generic jsonendpoint adapter #333

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dkotik
Copy link
Contributor

@dkotik dkotik commented Feb 3, 2023

Package jsonendpoint provides a generic adapter that converts a validated JSON request into a [message.Message] published to a certain topic. Use together with an HTTP router to build gateways to any [message.Publisher].

Had to bump Golang version to 1.18 in the go.mod file to support generics.

This is my first contribution.

@dkotik dkotik changed the title Add generic jsoendpoint adapter Add generic jsonendpoint adapter Feb 4, 2023
@@ -1,6 +1,6 @@
module github.com/ThreeDotsLabs/watermill

go 1.17
go 1.18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required for generics support

Previously, the endpoint adapter would return `nil` on success, which
is invalid JavaScript Object Notation format. It should be "{}".

Added UUID to make the adapter useful in more use cases.
For example, the returned value can serve as a shopping cart order ID.
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.

1 participant