简体   繁体   中英

How to validate incoming JSON using AWS Event Bridge Schema Registry

I am trying to validate an incoming JSON event into AWS Event Bridge.

I have followed the docs on how to download the code bindings. Which all works ok.

I have also tested the event bridge with the schema discovery and it works fine and puts my data to the correct target using Firehose as the target.

What I want to achieve is to be able to validate the event json coming in with an already existing schema in the schema registry. However this doc on the faq for question;

How does the schema registry reduce the amount of code I need to write?

Says:

First, you can use schema discovery to automatically identify schema for any events sent to your EventBridge event bus, and storing them in the registry, saving you from having to manually manage your event schema. Second, when you write applications that handle events on your bus, you can generate and download code bindings for this schema so you can use strongly-typed objects directly in your code. This saves overhead for deserialization, validation, and guesswork for your event handler.

However in my event handler fn, I do not see how this is possible, unless I install an external json schema validator (similar to how I have done before but just in a lambda transformation fn from Kinesis Firehose).

I thought the schema validation would happen itself if a particular version number of the schema is provided in the event.

Is there a way to achieve this?

Check this out , I had a similar issue to this when I was coding a complex mod menu, and this website helped me a ton. Other than this, you may just want to go with your proposed external json schema validator solution. Good luck with your issue mate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM