Skip to content

Commit c59b08b

Browse files
committed
Merge remote-tracking branch 'origin/main' into remove-block-api
2 parents 20c04f1 + 7368802 commit c59b08b

File tree

77 files changed

+8949
-1179
lines changed

Some content is hidden

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

77 files changed

+8949
-1179
lines changed

.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ If you need to download the recordings again, run `make validate-no-cache api=xp
250250

251251
Once you see the errors, you can fix the original definition in `/specification`
252252
and then run the command again until the types validator does not trigger any new error.
253-
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.
254254

255255
## Documentation
256256

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_to_openapi/src/cli.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub struct Cli {
2424
#[argh(option)]
2525
pub namespace: Vec<String>,
2626

27+
/// the branch to generate [9.0, 8.19, current, etc... - default = current]
28+
#[argh(option)]
29+
pub branch: Option<String>,
30+
2731
/// add enum descriptions to property descriptions [default = true]
2832
#[argh(switch)]
2933
pub lift_enum_descriptions: bool,
@@ -72,9 +76,12 @@ impl From<Cli> for Configuration {
7276
SchemaFlavor::Serverless => Some(Flavor::Serverless),
7377
SchemaFlavor::Stack => Some(Flavor::Stack),
7478
};
79+
80+
let branch = cli.branch;
7581

7682
Configuration {
7783
flavor,
84+
branch,
7885
lift_enum_descriptions: cli.lift_enum_descriptions,
7986
merge_multipath_endpoints: cli.merge_multipath_endpoints,
8087
multipath_redirects: cli.multipath_redirects,

compiler-rs/clients_schema_to_openapi/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use crate::components::TypesAndComponents;
3232
pub struct Configuration {
3333
pub flavor: Option<Flavor>,
3434
pub namespaces: Option<Vec<String>>,
35+
pub branch: Option<String>,
3536

3637
/// If a property value is an enumeration, the description of possible values will be copied in the
3738
/// property's description (also works for arrays of enums).

compiler-rs/clients_schema_to_openapi/src/schemas.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,14 @@ impl<'a> TypesAndComponents<'a> {
209209
pub fn convert_external_docs(&self, obj: &impl clients_schema::ExternalDocument) -> Option<ExternalDocumentation> {
210210
// FIXME: does the model contain resolved doc_id?
211211
obj.ext_doc_url().map(|url| {
212-
let branch: &str = self
213-
.model
214-
.info
215-
.as_ref()
216-
.and_then(|i| i.version.as_deref())
217-
.unwrap_or("current");
212+
let branch = self.config.branch.clone();
218213
let mut extensions: IndexMap<String,serde_json::Value> = Default::default();
219214
if let Some(previous_version_doc_url) = obj.ext_previous_version_doc_url() {
220215
extensions.insert("x-previousVersionUrl".to_string(), serde_json::json!(previous_version_doc_url));
221216
}
222217
ExternalDocumentation {
223218
description: None,
224-
url: url.trim().replace("{branch}", branch),
219+
url: url.trim().replace("{branch}", &branch.unwrap_or("current".to_string())),
225220
extensions,
226221
}
227222
})
1.24 KB
Binary file not shown.

output/openapi/elasticsearch-openapi-docs.redirects.csv

Lines changed: 149 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)