| 172 | 172 | | writeln!(text, " scope: {scope},").unwrap(); |
| 173 | 173 | | let params: Vec<&Value> = op["parameters"] |
| 174 | 174 | | .as_array() |
| 175 | | − | .map(|l| l.iter().collect()) |
| 175 | + | .map(|l| l.iter().filter(|p| matches!(p["in"].as_str(), Some("path" | "query"))).collect()) |
| 176 | 176 | | .unwrap_or_default(); |
| 177 | 177 | | if params.is_empty() { |
| 178 | 178 | | writeln!(text, " params: &[],").unwrap(); |
| ⋯ |
| 247 | 247 | | use super::*; |
| 248 | 248 | | |
| 249 | 249 | | #[test] |
| 250 | + | fn header_metadata_does_not_change_cli_operation_arguments() { |
| 251 | + | let mut doc = generate::openapi(); |
| 252 | + | let with_headers = generate::table(&doc); |
| 253 | + | for item in doc["paths"].as_object_mut().unwrap().values_mut() { |
| 254 | + | for operation in item.as_object_mut().unwrap().values_mut() { |
| 255 | + | if let Some(parameters) = operation["parameters"].as_array_mut() { |
| 256 | + | parameters.retain(|p| matches!(p["in"].as_str(), Some("path" | "query"))); |
| 257 | + | } |
| 258 | + | } |
| 259 | + | } |
| 260 | + | assert_eq!(with_headers, generate::table(&doc)); |
| 261 | + | } |
| 262 | + | |
| 263 | + | #[test] |
| 250 | 264 | | fn ops_table_is_current() { |
| 251 | 265 | | let doc = generate::openapi(); |
| 252 | 266 | | let want = generate::table(&doc); |