Skip to content

Commit 2f89eea

Browse files
authored
Merge branch 'main' into update-indeces
2 parents aacf96c + 58fbe0a commit 2f89eea

File tree

298 files changed

+7006
-910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+7006
-910
lines changed

.backportrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"repoOwner": "elastic",
33
"repoName": "elasticsearch-specification",
4-
"targetBranchChoices": ["9.0", "8.19", "8.18", "8.17"],
4+
"targetBranchChoices": ["9.1", "9.0", "8.19", "8.18"],
55
"fork": false
66
}

.github/validate-pr/index.js

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ async function run() {
8686

8787
cd(tsValidationPath)
8888

89+
// Collect all APIs to validate
90+
const apisToValidate = new Set()
91+
8992
for (const file of specFiles) {
9093
if (file.startsWith('specification/_types')) continue
9194
if (file.startsWith('specification/_spec_utils')) continue
@@ -102,32 +105,35 @@ async function run() {
102105
.filter(endpoint => endpoint.name.split('.').filter(s => !privateNames.includes(s))[0] === getApi(file).split('.')[0])
103106
.map(endpoint => endpoint.name)
104107
for (const api of apis) {
105-
const report = await getReport({
106-
api,
107-
'generate-report': false,
108-
request: true,
109-
response: true,
110-
ci: false,
111-
verbose: false
112-
})
113-
const namespace = getNamespace(api)
114-
// Asked to validate a specific API, so we only store that one
115-
reports.set(api, report.get(namespace)[0])
108+
apisToValidate.add(api)
116109
}
117110
} else {
118111
const api = getApi(file)
119-
const report = await getReport({
120-
api,
121-
'generate-report': false,
122-
request: true,
123-
response: true,
124-
ci: false,
125-
verbose: false
126-
})
112+
apisToValidate.add(api)
113+
}
114+
}
127115

116+
// Call getReport once with all APIs
117+
if (apisToValidate.size > 0) {
118+
const allApis = Array.from(apisToValidate).join(',')
119+
const report = await getReport({
120+
api: allApis,
121+
'generate-report': false,
122+
request: true,
123+
response: true,
124+
ci: false,
125+
verbose: false
126+
})
127+
128+
// Extract individual API reports from the combined result
129+
for (const api of apisToValidate) {
128130
const namespace = getNamespace(api)
129-
// Asked to validate a specific API, so we only store that one
130-
reports.set(api, report.get(namespace)[0])
131+
if (report.has(namespace)) {
132+
const namespaceReport = report.get(namespace).find(r => r.api === getName(api))
133+
if (namespaceReport) {
134+
reports.set(api, namespaceReport)
135+
}
136+
}
131137
}
132138
}
133139

.github/workflows/update-rest-api-json.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
branch: ['main', '9.0', '8.19', '8.18', '8.17']
16+
branch: ['main', '9.1', '9.0', '8.19', '8.18']
1717

1818
steps:
1919
- uses: actions/checkout@v4

.github/workflows/validate-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
with:
7373
issue-number: ${{ github.event.pull_request.number }}
7474
comment-author: 'github-actions[bot]'
75-
body-includes: 'Following you can find the validation results'
75+
body-includes: 'Following you can find the validation changes'
7676

7777
- name: Create or update comment
7878
if: steps.validation.outputs.has_results == 'true'

.gitignore

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ output/schema/schema
6565
# Test suite outputs
6666
compiler/test/**/output/
6767

68-
# Temporary openAPI files
69-
output/openapi/elasticsearch-serverless-openapi.tmp*.json
70-
output/openapi/elasticsearch-serverless-openapi.examples.json
71-
output/openapi/elasticsearch-openapi.tmp*.json
72-
output/openapi/elasticsearch-openapi.examples.json
73-
output/openapi/elasticsearch-serverless-openapi-docs.json
74-
output/openapi/elasticsearch-openapi-docs.json
68+
# Temporary openAPI documentation files
69+
output/openapi/elasticsearch-serverless-openapi-docs*.json
70+
output/openapi/elasticsearch-openapi-docs*.json
71+
output/openapi/elasticsearch*.redirects.csv

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Documents under the docs/ directory will help you to change the specification. T
3939
* [Fixing a definition, the complete story](docs/validation-example.md)
4040

4141

42-
## Send your pull request
42+
## Send your pull request from a branch
4343

4444
To fix any style issues and generate the outputs (that we store in git), please run:
4545

@@ -56,5 +56,4 @@ Then, follow those steps:
5656
- If the API is unusable without the change -> every supported version
5757
- If the API is usable, but fix is on the response side -> every supported version
5858
- If the API is usable, but fix is on the request side -> no backport, unless the API is _partially_ usable and the fix unlocks a missing feature that has no workaround
59-
60-
59+
- Send the pull request from a branch, **not a fork**

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ dump-routes: ## Create a new schema with all generics expanded
6969
@npm run dump-routes --prefix compiler
7070

7171
overlay-docs: ## Apply overlays to OpenAPI documents
72-
@npx bump overlay "output/openapi/elasticsearch-serverless-openapi.json" "docs/overlays/elasticsearch-serverless-openapi-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi.tmp1.json"
73-
@npx bump overlay "output/openapi/elasticsearch-serverless-openapi.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi.tmp2.json"
74-
@npx @redocly/cli bundle output/openapi/elasticsearch-serverless-openapi.tmp2.json --ext json -o output/openapi/elasticsearch-serverless-openapi.examples.json
75-
@npx bump overlay "output/openapi/elasticsearch-openapi.json" "docs/overlays/elasticsearch-openapi-overlays.yaml" > "output/openapi/elasticsearch-openapi.tmp1.json"
76-
@npx bump overlay "output/openapi/elasticsearch-openapi.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-openapi.tmp2.json"
77-
@npx @redocly/cli bundle output/openapi/elasticsearch-openapi.tmp2.json --ext json -o output/openapi/elasticsearch-openapi.examples.json
78-
rm output/openapi/elasticsearch-serverless-openapi.tmp*.json
79-
rm output/openapi/elasticsearch-openapi.tmp*.json
72+
@npx bump overlay "output/openapi/elasticsearch-serverless-openapi-docs.json" "docs/overlays/elasticsearch-serverless-openapi-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi-docs.tmp1.json"
73+
@npx bump overlay "output/openapi/elasticsearch-serverless-openapi-docs.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi-docs.tmp2.json"
74+
@npx @redocly/cli bundle output/openapi/elasticsearch-serverless-openapi-docs.tmp2.json --ext json -o output/openapi/elasticsearch-serverless-openapi-docs-final.json
75+
@npx bump overlay "output/openapi/elasticsearch-openapi-docs.json" "docs/overlays/elasticsearch-openapi-overlays.yaml" > "output/openapi/elasticsearch-openapi-docs.tmp1.json"
76+
@npx bump overlay "output/openapi/elasticsearch-openapi-docs.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-openapi-docs.tmp2.json"
77+
@npx @redocly/cli bundle output/openapi/elasticsearch-openapi-docs.tmp2.json --ext json -o output/openapi/elasticsearch-openapi-docs-final.json
78+
rm output/openapi/elasticsearch-serverless-openapi-docs.tmp*.json
79+
rm output/openapi/elasticsearch-openapi-docs.tmp*.json
8080

8181
generate-language-examples:
8282
@node docs/examples/generate-language-examples.js
@@ -89,11 +89,11 @@ generate-language-examples-with-java:
8989
lint-docs: ## Lint the OpenAPI documents after overlays
9090
@npx @redocly/cli lint "output/openapi/elasticsearch-*.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
9191

92-
lint-docs-stateful: ## Lint only the elasticsearch-openapi.examples.json file
93-
@npx @redocly/cli lint "output/openapi/elasticsearch-openapi.examples.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
92+
lint-docs-stateful: ## Lint only the elasticsearch-openapi-docs-final.json file
93+
@npx @redocly/cli lint "output/openapi/elasticsearch-openapi-docs-final.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
9494

9595
lint-docs-serverless: ## Lint only the serverless OpenAPI document after overlays
96-
@npx @redocly/cli lint "output/openapi/elasticsearch-serverless-openapi.examples.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
96+
@npx @redocly/cli lint "output/openapi/elasticsearch-serverless-openapi-docs-final.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
9797

9898
contrib: | generate license-check spec-format-fix transform-to-openapi filter-for-serverless lint-docs ## Pre contribution target
9999

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ $ make overlay-docs
7474
# The generated output can be found in ./output/openapi/
7575
```
7676

77+
## Specification Viewer
78+
79+
An interactive viewer for the Elasticsearch specification is available
80+
[here](https://elastic.github.io/specification-viewer/).
81+
7782
## Contributing
7883

7984
See [CONTRIBUTING.md](./CONTRIBUTING.md)
@@ -234,6 +239,9 @@ make validate api=xpack.info type=request branch=main
234239

235240
# this will validate the xpack.info request and response types against the 8.15 branch
236241
make validate api=xpack.info branch=8.15
242+
243+
# this will validate the xpack.info and search request and response types against the 8.15 branch
244+
make validate api=xpack.info,search branch=8.15
237245
```
238246

239247
The last command above will install all the dependencies and run, download
@@ -242,7 +250,7 @@ If you need to download the recordings again, run `make validate-no-cache api=xp
242250

243251
Once you see the errors, you can fix the original definition in `/specification`
244252
and then run the command again until the types validator does not trigger any new error.
245-
Finally open a pull request with your changes.
253+
Finally open a pull request with your changes. Please open it from a branch in the repository, and not from a fork.
246254

247255
## Documentation
248256

compiler-rs/clients_schema/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,6 @@ pub struct UrlTemplate {
10031003
pub struct ModelInfo {
10041004
pub title: String,
10051005
pub license: License,
1006-
pub version: Option<String>,
10071006
}
10081007

10091008
#[derive(Debug, Clone, Serialize, Deserialize)]

compiler-rs/clients_schema/src/transform/expand_generics.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,10 @@ pub fn expand(model: IndexedModel, config: ExpandConfig) -> anyhow::Result<Index
211211

212212
expand_behaviors(&mut resp.behaviors, &mappings, model, ctx)?;
213213
expand_body(&mut resp.body, &mappings, model, ctx)?;
214-
215-
// TODO: exceptions
214+
215+
for exception in &mut resp.exceptions {
216+
expand_body(&mut exception.body, &mappings, model, ctx)?;
217+
}
216218

217219
Ok(resp.into())
218220
}

0 commit comments

Comments
 (0)