We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The new Transform doesn't seem walk through all defs properly, that I have to iterate all defs manually with:
Transform
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] struct OptionEntry { path: String, env: String, ty: String, } fn dump_config_schema( prefix: &str, defs: &Map<String, Value>, o: &Map<String, Value>, result: &mut BTreeMap<String, OptionEntry>, ) { if let Some(r) = o.get("$ref") { let r = r.as_str().unwrap(); let o = defs.get(&r[8..]).unwrap().as_object().unwrap(); return dump_config_schema(prefix, defs, o, result); } if let Some(one_of) = o.get("oneOf") { let one_of = one_of.as_array().unwrap(); for o in one_of { dump_config_schema(&prefix, defs, o.as_object().unwrap(), result); } return; } if let Some(any_of) = o.get("anyOf") { let any_of = any_of.as_array().unwrap(); for o in any_of { dump_config_schema(&prefix, defs, o.as_object().unwrap(), result); } return; } let ty = o.get("type").unwrap(); let types = if let Some(types) = ty.as_array() { types.clone() } else { vec![ty.clone()] }; for ty in types { let ty = ty.as_str().unwrap(); match ty { "null" => {} "object" => { let props = o.get("properties").unwrap().as_object().unwrap(); for (k, v) in props { let prefix = format!("{prefix}.{k}"); dump_config_schema(&prefix, defs, v.as_object().unwrap(), result); } } ty => { let path = &prefix["SCOPEDB_CONFIG.".len()..]; let prefix = prefix.to_ascii_uppercase().replace(".", "_"); match result.entry(prefix.to_string()) { Entry::Vacant(ent) => { ent.insert(OptionEntry { path: path.to_string(), env: prefix, ty: ty.to_string(), }); } Entry::Occupied(ent) => { assert_eq!(ent.get().ty, ty); } } } } } }
And it generates:
runtime.exec_runtime_threads, SCOPEDB_CONFIG_RUNTIME_EXEC_RUNTIME_THREADS, integers ...
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The new
Transform
doesn't seem walk through all defs properly, that I have to iterate all defs manually with:And it generates:
The text was updated successfully, but these errors were encountered: