Skip to content

Commit bb67c72

Browse files
committed
test
1 parent 1a137db commit bb67c72

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

compiler-rs/clients_schema_to_openapi/src/paths.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub fn add_endpoint(
194194
// Create the operation, it will be repeated if we have several methods
195195
let operation = openapiv3::Operation {
196196
tags: vec![endpoint.name.clone()],
197-
summary: Some(endpoint.description.clone()),
197+
summary: Some(get_first_line(endpoint.description.clone())),
198198
description: Some(endpoint.description.clone()),
199199
external_docs: tac.convert_external_docs(endpoint),
200200
operation_id: None, // set in clone_operation below with operation_counter
@@ -311,6 +311,15 @@ fn get_path_parameters(template: &str) -> Vec<&str> {
311311
result
312312
}
313313

314+
fn get_first_line(desc: String) -> String {
315+
let mut parts = desc.split(['.','\n',':']);
316+
if parts.clone().count() == 1{
317+
return String::from(parts.next().unwrap())
318+
}
319+
let first = parts.next().unwrap_or_else(|| "");
320+
String::from(first) + "."
321+
}
322+
314323
#[cfg(test)]
315324
mod tests {
316325
use super::*;
Binary file not shown.

output/openapi/elasticsearch-serverless-openapi.json

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

0 commit comments

Comments
 (0)