Skip to content

Commit 1316d72

Browse files
authored
Merge branch 'main' into rest-api-spec-search-mvt
2 parents 716377c + b4c5c33 commit 1316d72

22 files changed

+8727
-1397
lines changed

compiler-rs/clients_schema_to_openapi/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use indexmap::IndexMap;
2525

2626
use clients_schema::{Availabilities, Availability, Flavor, IndexedModel, Stability, Visibility};
2727
use openapiv3::{Components, OpenAPI};
28-
use serde_json::Value;
28+
use serde_json::{Map,Value};
2929
use clients_schema::transform::ExpandConfig;
3030
use crate::components::TypesAndComponents;
3131

@@ -190,9 +190,14 @@ pub fn product_meta_as_extensions(namespace: &str, product_meta: &IndexMap<Strin
190190
if let Some(meta) = product_meta.get(namespace) {
191191
additional_namespace = format!(", {meta}");
192192
}
193-
193+
194194
let product_str = format!("elasticsearch{additional_namespace}");
195-
result.insert("x-product-feature".to_string(), Value::String(product_str));
195+
let mut product_feature_list: Vec<Value> = Vec::new();
196+
let mut product_feature: Map<String, Value> = Map::new();
197+
product_feature.insert("name".to_string(),Value::String("x-product-feature".to_string()));
198+
product_feature.insert("content".to_string(),Value::String(product_str));
199+
product_feature_list.push(Value::Object(product_feature));
200+
result.insert("x-metaTags".to_string(), Value::Array(product_feature_list));
196201
result
197202
}
198203

Binary file not shown.

compiler/src/steps/validate-model.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -579,17 +579,10 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
579579

580580
if (typeDef.variants?.kind === 'container') {
581581
const variants = typeDef.properties.filter(prop => !(prop.containerProperty ?? false))
582-
if (variants.length === 1) {
583-
// Single-variant containers must have a required property
584-
if (!variants[0].required) {
585-
modelError(`Property ${variants[0].name} is a single-variant and must be required`)
586-
}
587-
} else {
588-
// Multiple variants must all be optional
589-
for (const v of variants) {
590-
if (v.required) {
591-
modelError(`Variant ${variants[0].name} must be optional`)
592-
}
582+
// Variants must all be optional
583+
for (const v of variants) {
584+
if (v.required) {
585+
modelError(`Variant ${variants[0].name} must be optional`)
593586
}
594587
}
595588
}

0 commit comments

Comments
 (0)