diff --git a/Cargo.lock b/Cargo.lock index 2f6dbfe63..4ce83552a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4324,9 +4324,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "utoipa" -version = "5.5.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bde15df68e80b16c7d16b9616e80770ad158988daa56a27dccd1e55558b0160" +checksum = "8765fe27aeff71012a3f90fa474cf1df863a7d0dd81ed25de4e63fff2544994f" dependencies = [ "indexmap", "serde", @@ -4336,13 +4336,13 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "5.5.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba0b99ee52df3028635d93840c797102da61f8a7bb3cf751032455895b52ef8" +checksum = "d935f1c83fdf8b88f09bbe050d0cea78ea4afee6d7b0317403228c1200b2c8ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.6", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 143e9984d..fd432a983 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,7 @@ rustls = { version = "0.23", default-features = false, features = ["ring", "std" rustls-native-certs = "0.8" tokio = { version = "1", features = ["full"] } pretty_assertions = "1" -utoipa = { version = "5", features = ["preserve_order"] } +utoipa = { version = "6", features = ["preserve_order"] } reqwest = { version = "0.13", default-features = false, features = ["rustls", "json"] } [profile.release] diff --git a/crates/flowscope-sdk/openapi.json b/crates/flowscope-sdk/openapi.json index 4d88abd07..6a7730260 100644 --- a/crates/flowscope-sdk/openapi.json +++ b/crates/flowscope-sdk/openapi.json @@ -19,7 +19,7 @@ "operationId": "getConfiguration", "responses": { "200": { - "description": "", + "description": "The configuration", "content": { "application/json": { "schema": { @@ -98,7 +98,7 @@ }, "responses": { "200": { - "description": "", + "description": "The completions", "content": { "application/json": { "schema": { @@ -129,7 +129,7 @@ "operationId": "listSavedFilters", "responses": { "200": { - "description": "", + "description": "The saved filters", "content": { "application/json": { "schema": { @@ -280,7 +280,7 @@ }, "responses": { "200": { - "description": "", + "description": "The traffic over time", "content": { "application/json": { "schema": { @@ -321,7 +321,7 @@ }, "responses": { "200": { - "description": "", + "description": "The reversed input", "content": { "application/json": { "schema": { @@ -362,7 +362,7 @@ }, "responses": { "200": { - "description": "", + "description": "The traffic between values", "content": { "application/json": { "schema": { @@ -403,7 +403,7 @@ }, "responses": { "200": { - "description": "", + "description": "The table and resolution", "content": { "application/json": { "schema": { @@ -465,7 +465,7 @@ "operationId": "getUserInfo", "responses": { "200": { - "description": "", + "description": "The current user", "content": { "application/json": { "schema": { @@ -496,7 +496,7 @@ "operationId": "widgetExporters", "responses": { "200": { - "description": "", + "description": "The exporters", "content": { "application/json": { "schema": { @@ -552,7 +552,7 @@ "operationId": "widgetFlowRate", "responses": { "200": { - "description": "", + "description": "The flow rate", "content": { "application/json": { "schema": { @@ -573,7 +573,7 @@ "operationId": "widgetGraph", "responses": { "200": { - "description": "", + "description": "The traffic of the last day", "content": { "application/json": { "schema": { @@ -605,7 +605,7 @@ ], "responses": { "200": { - "description": "", + "description": "The top values", "content": { "application/json": { "schema": { diff --git a/crates/flowscope-sdk/src/openapi.rs b/crates/flowscope-sdk/src/openapi.rs index 918e98cd6..3fd8c15a3 100644 --- a/crates/flowscope-sdk/src/openapi.rs +++ b/crates/flowscope-sdk/src/openapi.rs @@ -25,14 +25,17 @@ pub const PREFIX: &str = "/api/v0/console"; #[utoipa::path( get, path = "/api/v0/console/configuration", tag = "console", operation_id = "getConfiguration", summary = "What the web interface needs to start", - responses((status = 200, body = Configuration)), + responses((status = 200, description = "The configuration", body = Configuration)), )] fn configuration() {} #[utoipa::path( get, path = "/api/v0/console/user/info", tag = "user", operation_id = "getUserInfo", summary = "The current user", - responses((status = 200, body = UserInfo), (status = 401, description = "Not logged in", body = ErrorMessage)), + responses( + (status = 200, description = "The current user", body = UserInfo), + (status = 401, description = "Not logged in", body = ErrorMessage), + ), )] fn user_info() {} @@ -50,7 +53,10 @@ fn user_avatar() {} post, path = "/api/v0/console/graph/line", tag = "graph", operation_id = "graphLine", summary = "Traffic over time", request_body = LineInput, - responses((status = 200, body = LineOutput), (status = 400, description = "Invalid input", body = ErrorMessage)), + responses( + (status = 200, description = "The traffic over time", body = LineOutput), + (status = 400, description = "Invalid input", body = ErrorMessage), + ), )] fn graph_line() {} @@ -58,7 +64,10 @@ fn graph_line() {} post, path = "/api/v0/console/graph/sankey", tag = "graph", operation_id = "graphSankey", summary = "Traffic between the values of several dimensions", request_body = GraphInput, - responses((status = 200, body = SankeyOutput), (status = 400, description = "Invalid input", body = ErrorMessage)), + responses( + (status = 200, description = "The traffic between values", body = SankeyOutput), + (status = 400, description = "Invalid input", body = ErrorMessage), + ), )] fn graph_sankey() {} @@ -67,7 +76,7 @@ fn graph_sankey() {} summary = "Table and resolution a graph would use", request_body = TableIntervalInput, responses( - (status = 200, body = TableIntervalOutput), + (status = 200, description = "The table and resolution", body = TableIntervalOutput), (status = 400, description = "Invalid input", body = ErrorMessage), ), )] @@ -77,7 +86,10 @@ fn graph_table_interval() {} post, path = "/api/v0/console/graph/reverse", tag = "graph", operation_id = "graphReverse", summary = "Swap the direction of dimensions and of a filter", request_body = Reverse, - responses((status = 200, body = Reverse), (status = 400, description = "Invalid input", body = ErrorMessage)), + responses( + (status = 200, description = "The reversed input", body = Reverse), + (status = 400, description = "Invalid input", body = ErrorMessage), + ), )] fn graph_reverse() {} @@ -96,14 +108,17 @@ fn filter_validate() {} post, path = "/api/v0/console/filter/complete", tag = "filter", operation_id = "filterComplete", summary = "Complete a filter expression", request_body = CompleteInput, - responses((status = 200, body = CompleteOutput), (status = 400, description = "Invalid input", body = ErrorMessage)), + responses( + (status = 200, description = "The completions", body = CompleteOutput), + (status = 400, description = "Invalid input", body = ErrorMessage), + ), )] fn filter_complete() {} #[utoipa::path( get, path = "/api/v0/console/filter/saved", tag = "filter", operation_id = "listSavedFilters", summary = "Saved filters the current user can see", - responses((status = 200, body = SavedFilters)), + responses((status = 200, description = "The saved filters", body = SavedFilters)), )] fn saved_filters() {} @@ -111,7 +126,10 @@ fn saved_filters() {} post, path = "/api/v0/console/filter/saved", tag = "filter", operation_id = "addSavedFilter", summary = "Save a filter", request_body = SavedFilterInput, - responses((status = 204, description = "Saved"), (status = 400, description = "Invalid input", body = ErrorMessage)), + responses( + (status = 204, description = "Saved"), + (status = 400, description = "Invalid input", body = ErrorMessage), + ), )] fn add_saved_filter() {} @@ -140,14 +158,14 @@ fn widget_flow_last() {} #[utoipa::path( get, path = "/api/v0/console/widget/flow-rate", tag = "widget", operation_id = "widgetFlowRate", summary = "Flows received each second", - responses((status = 200, body = FlowRate)), + responses((status = 200, description = "The flow rate", body = FlowRate)), )] fn widget_flow_rate() {} #[utoipa::path( get, path = "/api/v0/console/widget/exporters", tag = "widget", operation_id = "widgetExporters", summary = "Exporters sending flows", - responses((status = 200, body = Exporters)), + responses((status = 200, description = "The exporters", body = Exporters)), )] fn widget_exporters() {} @@ -158,14 +176,17 @@ fn widget_exporters() {} "name" = String, Path, description = "src-as, dst-as, src-country, dst-country, exporter, protocol, etype, src-port or dst-port", )), - responses((status = 200, body = Top), (status = 400, description = "Unknown widget", body = ErrorMessage)), + responses( + (status = 200, description = "The top values", body = Top), + (status = 400, description = "Unknown widget", body = ErrorMessage), + ), )] fn widget_top() {} #[utoipa::path( get, path = "/api/v0/console/widget/graph", tag = "widget", operation_id = "widgetGraph", summary = "Traffic of the last day", - responses((status = 200, body = Traffic)), + responses((status = 200, description = "The traffic of the last day", body = Traffic)), )] fn widget_graph() {} diff --git a/web/src/lib/api-schema.ts b/web/src/lib/api-schema.ts index 12a28ffa3..bff700183 100644 --- a/web/src/lib/api-schema.ts +++ b/web/src/lib/api-schema.ts @@ -654,6 +654,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The configuration */ 200: { headers: { [name: string]: unknown; @@ -710,6 +711,7 @@ export interface operations { }; }; responses: { + /** @description The completions */ 200: { headers: { [name: string]: unknown; @@ -738,6 +740,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The saved filters */ 200: { headers: { [name: string]: unknown; @@ -864,6 +867,7 @@ export interface operations { }; }; responses: { + /** @description The traffic over time */ 200: { headers: { [name: string]: unknown; @@ -896,6 +900,7 @@ export interface operations { }; }; responses: { + /** @description The reversed input */ 200: { headers: { [name: string]: unknown; @@ -928,6 +933,7 @@ export interface operations { }; }; responses: { + /** @description The traffic between values */ 200: { headers: { [name: string]: unknown; @@ -960,6 +966,7 @@ export interface operations { }; }; responses: { + /** @description The table and resolution */ 200: { headers: { [name: string]: unknown; @@ -1017,6 +1024,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The current user */ 200: { headers: { [name: string]: unknown; @@ -1045,6 +1053,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The exporters */ 200: { headers: { [name: string]: unknown; @@ -1095,6 +1104,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The flow rate */ 200: { headers: { [name: string]: unknown; @@ -1114,6 +1124,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The traffic of the last day */ 200: { headers: { [name: string]: unknown; @@ -1136,6 +1147,7 @@ export interface operations { }; requestBody?: never; responses: { + /** @description The top values */ 200: { headers: { [name: string]: unknown;