Skip to content

Commit e5f9db2

Browse files
expand model to include language versions of examples
1 parent 9723c0d commit e5f9db2

File tree

6 files changed

+45
-52
lines changed

6 files changed

+45
-52
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ validate-no-cache: ## Validate a given endpoint request or response without loca
99

1010
generate: ## Generate the output spec
1111
@echo ">> generating the spec .."
12+
@make generate-language-examples
1213
@npm run generate-schema --prefix compiler -- --spec ../specification/ --output ../output/
1314
@npm run start --prefix typescript-generator
1415

@@ -53,7 +54,6 @@ transform-expand-generics: ## Create a new schema with all generics expanded
5354
@npm run transform-expand-generics --prefix compiler
5455

5556
transform-to-openapi: ## Generate the OpenAPI definition from the compiled schema
56-
@make generate-language-examples
5757
@npm run transform-to-openapi -- --schema output/schema/schema.json --flavor stack --output output/openapi/elasticsearch-openapi.json
5858
@npm run transform-to-openapi -- --schema output/schema/schema.json --flavor serverless --output output/openapi/elasticsearch-serverless-openapi.json
5959

compiler-rs/clients_schema/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
use std::collections::HashMap;
1819
use std::fmt::{Debug, Display, Formatter};
1920

2021
use anyhow::anyhow;
@@ -498,6 +499,7 @@ pub struct SchemaExample {
498499
pub description: Option<String>,
499500
pub value: Option<String>,
500501
pub external_value: Option<String>,
502+
pub alternatives: Option<HashMap<String, String>>,
501503
}
502504

503505
/// Common attributes for all type definitions

compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib.js

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

compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm.d.ts

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

compiler/src/model/metamodel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ export class Example {
277277
value?: string
278278
/** A URI that points to the literal example */
279279
external_value?: string
280+
/** A map of alternatives for this example in other languages */
281+
alternatives: Record<string, string>
280282
}
281283

282284
/**

0 commit comments

Comments
 (0)