Improve resiliency to formatting JSON in server#48553
Merged
pugnascotia merged 6 commits intoelastic:masterfrom Oct 30, 2019
Merged
Improve resiliency to formatting JSON in server#48553pugnascotia merged 6 commits intoelastic:masterfrom
pugnascotia merged 6 commits intoelastic:masterfrom
Conversation
Make a number of changes so that JSON in the server directory is more
resilient to automatic formatting. This covers:
* Reformatting multiline JSON to embed whitespace in the strings
* Add helper method reformatJson(), to strip whitespace from a JSON
document using XContent methods. This is sometimes necessary where
a test is comparing some machine-generated JSON with an expected
value.
Collaborator
|
Pinging @elastic/es-core-infra (:Core/Infra/Core) |
pugnascotia
added a commit
to pugnascotia/elasticsearch
that referenced
this pull request
Oct 26, 2019
These have moved to PR elastic#48553.
Contributor
Author
|
@elasticmachine run elasticsearch-ci/2 |
alpar-t
reviewed
Oct 29, 2019
| * @return reformatted JSON | ||
| * @throws IOException if the reformatting fails, e.g. because the JSON is not well-formed | ||
| */ | ||
| public static String reformatJson(String json) throws IOException { |
Contributor
There was a problem hiding this comment.
I think a name that better reflects what the reformat actually does would be better, something like stripWhitespace maybe ?
Contributor
Author
There was a problem hiding this comment.
Thanks @atorok, I renamed the method as you suggested.
Contributor
Author
|
@elasticmachine run elasticsearch-ci/bwc |
Contributor
Author
|
@elasticmachine run elasticsearch-ci/bwc |
alpar-t
approved these changes
Oct 30, 2019
pugnascotia
added a commit
to pugnascotia/elasticsearch
that referenced
this pull request
Oct 30, 2019
Make a number of changes so that JSON in the server directory is more
resilient to automatic formatting. This covers:
* Reformatting multiline JSON to embed whitespace in the strings
* Add helper method `stripWhitespace()`, to strip whitespace from a JSON
document using XContent methods. This is sometimes necessary where
a test is comparing some machine-generated JSON with an expected
value.
pugnascotia
added a commit
that referenced
this pull request
Oct 31, 2019
Backport of #48553. Make a number of changes so that JSON in the server directory is more resilient to automatic formatting. This covers: * Reformatting multiline JSON to embed whitespace in the strings * Add helper method `stripWhitespace()`, to strip whitespace from a JSON document using XContent methods. This is sometimes necessary where a test is comparing some machine-generated JSON with an expected value.
This was referenced Feb 3, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out from #48450. Make a number of changes so that JSON in the server directory is more resilient to automatic formatting. This covers:
document using XContent methods. This is sometimes necessary where
a test is comparing some machine-generated JSON with an expected
value.