Skip to content

Comments

Add generic jsonendpoint adapter#333

Closed
dkotik wants to merge 3 commits intoThreeDotsLabs:masterfrom
dkotik:jsonendpoint
Closed

Add generic jsonendpoint adapter#333
dkotik wants to merge 3 commits intoThreeDotsLabs:masterfrom
dkotik:jsonendpoint

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
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.
@dkotik dkotik closed this May 5, 2025
@dkotik dkotik deleted the jsonendpoint branch May 5, 2025 09:41
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