Add a way to validate XContent rendering produces valid JSON/YAML #13157
Labels
:Core/Infra/REST API
REST infrastructure and utilities
>enhancement
help wanted
adoptme
Team:Core/Infra
Meta label for core/infra team
>test
Issues or PRs that are addressing/adding tests
It's common in tests to have a method that tests serialization and deserialization of the actual Java objects, however, it's quite possible to make a mistake in the
toXContent
method that does not produce either valid JSON or YAML. Right now the only real way to do this is with a REST test (other than a lot of string comparison in a unit test), which is a lot of overhead for something like this.It would be great if we could have some kind of AssertingToXContent wrapper that could test this to ensure we don't ever generate JSON like:
The text was updated successfully, but these errors were encountered: