Skip to content

Commit

Permalink
Build: Support console-result language (elastic#45937)
Browse files Browse the repository at this point in the history
This adds support for verifying that snippets with the `console-result`
language are valid json. It also switches the response snippets on the
`docs/get` page from `js` to `console-result` which will allow clients
to provide "alternatives" for them like they can now do with
`// CONSOLE` snippets.
  • Loading branch information
nik9000 committed Aug 26, 2019
1 parent 5a17987 commit a564cef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class SnippetsTask extends DefaultTask {
}
}
if (snippet.testResponse
&& 'js' == snippet.language
&& ('js' == snippet.language || 'console-result' == snippet.language)
&& null == snippet.skip) {
String quoted = snippet.contents
// quote values starting with $
Expand Down Expand Up @@ -162,7 +162,7 @@ public class SnippetsTask extends DefaultTask {
}
return
}
matcher = line =~ /\["?source"?,\s*"?(\w+)"?(,.*)?].*/
matcher = line =~ /\["?source"?,\s*"?([-\w]+)"?(,.*)?].*/
if (matcher.matches()) {
lastLanguage = matcher.group(1)
lastLanguageLine = lineNumber
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/docs/get.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ GET twitter/_doc/0

The API returns the following result:

[source,js]
[source,console-result]
--------------------------------------------------
{
"_index" : "twitter",
Expand Down Expand Up @@ -359,7 +359,7 @@ GET twitter/_doc/1?stored_fields=tags,counter

The API returns the following result:

[source,js]
[source,console-result]
--------------------------------------------------
{
"_index": "twitter",
Expand Down Expand Up @@ -403,7 +403,7 @@ GET twitter/_doc/2?routing=user1&stored_fields=tags,counter

The API returns the following result:

[source,js]
[source,console-result]
--------------------------------------------------
{
"_index": "twitter",
Expand Down

0 comments on commit a564cef

Please sign in to comment.