use anyhow::Result; mod openai_openapi { use crate::Result; use regex::Regex; use std::{env, fs::{File, self}, path::Path}; use serde::Deserialize; #[derive(Deserialize)] struct OpenAIManifest { paths: serde_yaml::Mapping, } pub fn build() -> Result<()> { if env::var("DOCS_RS").is_ok_and(|v| v == "1") { println!("cargo:warning=Skipping openai_openapi::build for docs.rs"); return Ok(()); } let manifest_file = "external/openai-openapi/openapi.yaml"; let asset_file = "assets/openai-openapi-paths-regex"; println!("cargo:rerun-if-changed={manifest_file}"); let paths = fetch_paths(manifest_file)?; let regex = convert_paths_to_regex(&paths)?; fs::write(asset_file, regex)?; Ok(()) } fn fetch_paths
(path: P) -> Result