OpenSearch/docs/plugins
Nik Everett 6d2c40e546 Enforce that responses in docs are valid json (#26249)
All of the snippets in our docs marked with `// TESTRESPONSE` are
checked against the response from Elasticsearch but, due to the
way they are implemented they are actually parsed as YAML instead
of JSON. Luckilly, all valid JSON is valid YAML! Unfurtunately
that means that invalid JSON has snuck into the exmples!

This adds a step during the build to parse them as JSON and fail
the build if they don't parse.

But no! It isn't quite that simple. The displayed text of some of
these responses looks like:
```
{
    ...
    "aggregations": {
        "range": {
            "buckets": [
                {
                    "to": 1.4436576E12,
                    "to_as_string": "10-2015",
                    "doc_count": 7,
                    "key": "*-10-2015"
                },
                {
                    "from": 1.4436576E12,
                    "from_as_string": "10-2015",
                    "doc_count": 0,
                    "key": "10-2015-*"
                }
            ]
        }
    }
}
```

Note the `...` which isn't valid json but we like it anyway and want
it in the output. We use substitution rules to convert the `...`
into the response we expect. That yields a response that looks like:
```
{
    "took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,
    "aggregations": {
        "range": {
            "buckets": [
                {
                    "to": 1.4436576E12,
                    "to_as_string": "10-2015",
                    "doc_count": 7,
                    "key": "*-10-2015"
                },
                {
                    "from": 1.4436576E12,
                    "from_as_string": "10-2015",
                    "doc_count": 0,
                    "key": "10-2015-*"
                }
            ]
        }
    }
}
```

That is what the tests consume but it isn't valid JSON! Oh no! We don't
want to go update all the substitution rules because that'd be huge and,
ultimately, wouldn't buy much. So we quote the `$body.took` bits before
parsing the JSON.

Note the responses that we use for the `_cat` APIs are all converted into
regexes and there is no expectation that they are valid JSON.

Closes #26233
2017-08-17 09:02:10 -04:00
..
alerting.asciidoc Drops any plugins that haven't been updated since 2.0. Updates 5.0 links/verbiage 2016-11-02 06:38:50 -07:00
analysis-icu.asciidoc Update experimental labels in the docs (#25727) 2017-07-18 14:06:22 +02:00
analysis-kuromoji.asciidoc Enforce that responses in docs are valid json (#26249) 2017-08-17 09:02:10 -04:00
analysis-phonetic.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
analysis-smartcn.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
analysis-stempel.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
analysis-ukrainian.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
analysis.asciidoc Drops any plugins that haven't been updated since 2.0. Updates 5.0 links/verbiage 2016-11-02 06:38:50 -07:00
api.asciidoc Drops any plugins that haven't been updated since 2.0. Updates 5.0 links/verbiage 2016-11-02 06:38:50 -07:00
authors.asciidoc Rewrite the scripting security docs (#23930) 2017-04-07 11:46:41 -04:00
discovery-azure-classic.asciidoc Add compatibility versions to main action response (#25799) 2017-07-20 13:01:41 -07:00
discovery-ec2.asciidoc Docs: Cleanup docs for ec2 discovery (#26065) 2017-08-15 10:14:51 -07:00
discovery-file.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
discovery-gce.asciidoc Machine Permission update on Google Compute 2017-05-11 07:52:34 +02:00
discovery.asciidoc Drops any plugins that haven't been updated since 2.0. Updates 5.0 links/verbiage 2016-11-02 06:38:50 -07:00
index.asciidoc Centralised doc versions in docs/Versions.asciidoc 2017-02-04 11:16:19 +01:00
ingest-attachment.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
ingest-geoip.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
ingest-user-agent.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
ingest.asciidoc ingest: Renamed from `ingest-useragent` to `ingest-user-agent` and processor from `useragent` to `user_agent` 2016-07-07 09:43:43 +02:00
install_remove.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
integrations.asciidoc [DOCS] Update docs to use shared attribute file (#25403) 2017-06-27 08:33:28 -07:00
management.asciidoc Drops any plugins that haven't been updated since 2.0. Updates 5.0 links/verbiage 2016-11-02 06:38:50 -07:00
mapper-murmur3.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
mapper-size.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
mapper.asciidoc Remove mapper attachments plugin 2016-09-19 09:01:16 +02:00
plugin-script.asciidoc Rename CONF_DIR to ES_PATH_CONF 2017-08-15 06:19:06 +09:00
redirects.asciidoc [DOCS] Added note about Elastic Cloud to improve 'elastic aws' SERP results. 2017-04-12 17:57:03 -07:00
repository-azure.asciidoc Azure repository: Move to named configurations as we do for S3 repository 2017-08-08 15:14:47 +02:00
repository-gcs.asciidoc [DOCS] Fixed cross doc xref in plugin docs. 2017-05-16 17:55:47 -07:00
repository-hdfs.asciidoc [DOCS] Clarify expected availability of HDFS for the HDFS Repository (#25220) 2017-06-16 09:47:44 -04:00
repository-s3.asciidoc Docs: Update s3 repository docs with client settings (#26033) 2017-08-04 11:22:49 -07:00
repository.asciidoc Add Google Cloud Storage repository plugin 2016-05-19 13:26:23 +02:00
security.asciidoc Drops any plugins that haven't been updated since 2.0. Updates 5.0 links/verbiage 2016-11-02 06:38:50 -07:00
store-smb.asciidoc Added "release-state" support to plugin docs 2017-04-20 15:04:20 +02:00
store.asciidoc [cloud-azure] Split azure plugin in 3 plugins 2015-09-21 17:55:23 +02:00