Skip to content

Commit 1fd03de

Browse files
committed
Merge remote-tracking branch 'origin/main' into get-source-stored-fields
2 parents df3194d + 1fc197e commit 1fd03de

File tree

22 files changed

+1103
-1029
lines changed

22 files changed

+1103
-1029
lines changed

.github/validate-pr/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,18 @@ async function run() {
149149
}
150150
changedApis.sort((a, b) => a.api.localeCompare(b.api))
151151

152+
let comment = `Following you can find the validation changes against the target branch for the API${changedApis.length === 1 ? '' : 's'}.\n\n`
152153
if (changedApis.length > 0) {
153-
let comment = `Following you can find the validation changes for the API${changedApis.length === 1 ? '' : 's'} you have modified.\n\n`
154154
comment += '| API | Status | Request | Response |\n'
155155
comment += '| --- | --- | --- | --- |\n'
156156
for (const change of changedApis) {
157157
comment += buildDiffTableLine(change)
158158
}
159-
comment += `\nYou can validate ${changedApis.length === 1 ? 'this' : 'these'} API${changedApis.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n`
160-
161-
core.setOutput('has_results', 'true')
162-
core.setOutput('comment_body', comment)
163159
} else {
164-
core.setOutput('has_results', 'false')
160+
comment += '**No changes detected**.\n'
165161
}
162+
comment += `\nYou can validate ${changedApis.length === 1 ? 'this' : 'these'} API${changedApis.length === 1 ? '' : 's'} yourself by using the ${tick}make validate${tick} target.\n`
163+
core.setOutput('comment_body', comment)
166164

167165
core.info('Done!')
168166
}
@@ -236,4 +234,4 @@ function generateResponse (r) {
236234
run().catch((err) => {
237235
core.error(err)
238236
process.exit(1)
239-
})
237+
})

.github/workflows/validate-pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ jobs:
7575
body-includes: 'Following you can find the validation changes'
7676

7777
- name: Create or update comment
78-
if: steps.validation.outputs.has_results == 'true'
7978
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
8079
with:
8180
token: ${{ secrets.GITHUB_TOKEN }}

compiler-rs/clients_schema/src/lib.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub trait Documented {
5858
pub trait ExternalDocument {
5959
fn ext_doc_id(&self) -> Option<&str>;
6060
fn ext_doc_url(&self) -> Option<&str>;
61+
fn ext_doc_description(&self) -> Option<&str>;
6162
fn ext_previous_version_doc_url(&self) -> Option<&str>;
6263
}
6364

@@ -323,6 +324,9 @@ pub struct Property {
323324
#[serde(skip_serializing_if = "Option::is_none")]
324325
pub ext_doc_url: Option<String>,
325326

327+
#[serde(skip_serializing_if = "Option::is_none")]
328+
pub ext_doc_description: Option<String>,
329+
326330
#[serde(skip_serializing_if = "Option::is_none")]
327331
pub ext_previous_version_doc_url: Option<String>,
328332

@@ -375,6 +379,10 @@ impl ExternalDocument for Property {
375379
self.ext_doc_url.as_deref()
376380
}
377381

382+
fn ext_doc_description(&self) -> Option<&str> {
383+
self.ext_doc_description.as_deref()
384+
}
385+
378386
fn ext_previous_version_doc_url(&self) -> Option<&str> {
379387
self.ext_previous_version_doc_url.as_deref()
380388
}
@@ -536,6 +544,9 @@ pub struct BaseType {
536544
#[serde(skip_serializing_if = "Option::is_none")]
537545
pub ext_doc_url: Option<String>,
538546

547+
#[serde(skip_serializing_if = "Option::is_none")]
548+
pub ext_doc_description: Option<String>,
549+
539550
#[serde(skip_serializing_if = "Option::is_none")]
540551
pub ext_previous_version_doc_url: Option<String>,
541552

@@ -579,6 +590,7 @@ impl BaseType {
579590
spec_location: None,
580591
ext_doc_id: None,
581592
ext_doc_url: None,
593+
ext_doc_description: None,
582594
ext_previous_version_doc_url: None,
583595
}
584596
}
@@ -603,6 +615,10 @@ impl ExternalDocument for BaseType {
603615
self.ext_doc_url.as_deref()
604616
}
605617

618+
fn ext_doc_description(&self) -> Option<&str> {
619+
self.ext_doc_description.as_deref()
620+
}
621+
606622
fn ext_previous_version_doc_url(&self) -> Option<&str> {
607623
self.ext_previous_version_doc_url.as_deref()
608624
}
@@ -635,6 +651,10 @@ impl<T: WithBaseType> ExternalDocument for T {
635651
self.base().doc_url()
636652
}
637653

654+
fn ext_doc_description(&self) -> Option<&str> {
655+
self.base().ext_doc_description()
656+
}
657+
638658
fn ext_previous_version_doc_url(&self) -> Option<&str> {
639659
self.base().ext_previous_version_doc_url()
640660
}
@@ -915,6 +935,9 @@ pub struct Endpoint {
915935
#[serde(skip_serializing_if = "Option::is_none")]
916936
pub ext_doc_url: Option<String>,
917937

938+
#[serde(skip_serializing_if = "Option::is_none")]
939+
pub ext_doc_description: Option<String>,
940+
918941
#[serde(skip_serializing_if = "Option::is_none")]
919942
pub ext_previous_version_doc_url: Option<String>,
920943

@@ -968,6 +991,10 @@ impl ExternalDocument for Endpoint {
968991
self.ext_doc_url.as_deref()
969992
}
970993

994+
fn ext_doc_description(&self) -> Option<&str> {
995+
self.ext_doc_description.as_deref()
996+
}
997+
971998
fn ext_previous_version_doc_url(&self) -> Option<&str> {
972999
self.ext_previous_version_doc_url.as_deref()
9731000
}

compiler-rs/clients_schema_to_openapi/src/schemas.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a> TypesAndComponents<'a> {
215215
extensions.insert("x-previousVersionUrl".to_string(), serde_json::json!(previous_version_doc_url));
216216
}
217217
ExternalDocumentation {
218-
description: None,
218+
description: obj.ext_doc_description().map(|desc| { desc.to_string() }),
219219
url: url.trim().replace("{branch}", &branch.unwrap_or("current".to_string())),
220220
extensions,
221221
}
2.43 KB
Binary file not shown.

compiler-rs/openapi_to_clients_schema/src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ fn generate_interface_def(
404404
doc_url: None,
405405
ext_doc_id: None,
406406
ext_doc_url: None,
407+
ext_doc_description: None,
407408
ext_previous_version_doc_url: None,
408409
codegen_name: None, // FIXME: extension in workplace search
409410
description: None,

compiler/src/model/metamodel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ export class Endpoint {
443443
docId?: string
444444
extDocId?: string
445445
extDocUrl?: string
446+
extDocDescription?: string
446447
extPreviousVersionDocUrl?: string
447448
deprecation?: Deprecation
448449
availability: Availabilities

compiler/src/model/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,9 @@ export function hoistRequestAnnotations (
703703
const docUrl = docIds.find(entry => entry[0] === value.trim())
704704
assert(jsDocs, docUrl != null, `The @ext_doc_id '${value.trim()}' is not present in _doc_ids/table.csv`)
705705
endpoint.extDocUrl = docUrl[1].replace(/\r/g, '')
706+
if (docUrl[3].replace(/\r/g, '') !== '') {
707+
endpoint.extDocDescription = docUrl[3].replace(/\r/g, '')
708+
}
706709
} else if (tag === 'availability') {
707710
// The @availability jsTag is different than most because it allows
708711
// multiple values within the same docstring, hence needing to parse

output/openapi/elasticsearch-openapi.json

Lines changed: 37 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)