Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
24 changes: 12 additions & 12 deletions crates/flowscope-sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"operationId": "getConfiguration",
"responses": {
"200": {
"description": "",
"description": "The configuration",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -98,7 +98,7 @@
},
"responses": {
"200": {
"description": "",
"description": "The completions",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -129,7 +129,7 @@
"operationId": "listSavedFilters",
"responses": {
"200": {
"description": "",
"description": "The saved filters",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -280,7 +280,7 @@
},
"responses": {
"200": {
"description": "",
"description": "The traffic over time",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -321,7 +321,7 @@
},
"responses": {
"200": {
"description": "",
"description": "The reversed input",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -362,7 +362,7 @@
},
"responses": {
"200": {
"description": "",
"description": "The traffic between values",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -403,7 +403,7 @@
},
"responses": {
"200": {
"description": "",
"description": "The table and resolution",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -465,7 +465,7 @@
"operationId": "getUserInfo",
"responses": {
"200": {
"description": "",
"description": "The current user",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -496,7 +496,7 @@
"operationId": "widgetExporters",
"responses": {
"200": {
"description": "",
"description": "The exporters",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -552,7 +552,7 @@
"operationId": "widgetFlowRate",
"responses": {
"200": {
"description": "",
"description": "The flow rate",
"content": {
"application/json": {
"schema": {
Expand All @@ -573,7 +573,7 @@
"operationId": "widgetGraph",
"responses": {
"200": {
"description": "",
"description": "The traffic of the last day",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -605,7 +605,7 @@
],
"responses": {
"200": {
"description": "",
"description": "The top values",
"content": {
"application/json": {
"schema": {
Expand Down
47 changes: 34 additions & 13 deletions crates/flowscope-sdk/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -50,15 +53,21 @@ 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() {}

#[utoipa::path(
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() {}

Expand All @@ -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),
),
)]
Expand All @@ -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() {}

Expand All @@ -96,22 +108,28 @@ 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() {}

#[utoipa::path(
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() {}

Expand Down Expand Up @@ -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() {}

Expand All @@ -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() {}

Expand Down
12 changes: 12 additions & 0 deletions web/src/lib/api-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The configuration */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -710,6 +711,7 @@ export interface operations {
};
};
responses: {
/** @description The completions */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -738,6 +740,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The saved filters */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -864,6 +867,7 @@ export interface operations {
};
};
responses: {
/** @description The traffic over time */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -896,6 +900,7 @@ export interface operations {
};
};
responses: {
/** @description The reversed input */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -928,6 +933,7 @@ export interface operations {
};
};
responses: {
/** @description The traffic between values */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -960,6 +966,7 @@ export interface operations {
};
};
responses: {
/** @description The table and resolution */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -1017,6 +1024,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The current user */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -1045,6 +1053,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The exporters */
200: {
headers: {
[name: string]: unknown;
Expand Down Expand Up @@ -1095,6 +1104,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The flow rate */
200: {
headers: {
[name: string]: unknown;
Expand All @@ -1114,6 +1124,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The traffic of the last day */
200: {
headers: {
[name: string]: unknown;
Expand All @@ -1136,6 +1147,7 @@ export interface operations {
};
requestBody?: never;
responses: {
/** @description The top values */
200: {
headers: {
[name: string]: unknown;
Expand Down
Loading