Skip to content

Commit e566d7b

Browse files
authored
feat(sv-api): Updated postman and swagger-ui frontend (#450)
* feat(sv-api): Updated postman and swagger-ui frontend * fix(sv-api): Updated postman collection and added gen key endpoint
1 parent 3a2168e commit e566d7b

File tree

13 files changed

+294
-248
lines changed

13 files changed

+294
-248
lines changed

Cargo.lock

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

crates/types/src/primitives/wrapper_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[macro_export]
22
macro_rules! declare_string_wrapper {
33
($name:ident) => {
4-
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
4+
#[derive(Debug, Clone, Eq, PartialEq, Hash, utoipa::ToSchema)]
55
pub struct $name(std::borrow::Cow<'static, str>);
66

77
impl $name {

crates/web-utils/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ tower-http.workspace = true
4343
tracing.workspace = true
4444
tracing-subscriber.workspace = true
4545
url = "2.5"
46+
utoipa.workspace = true
4647

4748
[dev-dependencies]
4849
mockall = "0.13.1"

crates/web-utils/src/api_key/api_key_impl.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ pub struct DbApiKey {
2828
}
2929

3030
#[derive(
31-
Debug, Clone, Serialize, Deserialize, PartialEq, Eq, sqlx::FromRow, Hash,
31+
Debug,
32+
Clone,
33+
Serialize,
34+
Deserialize,
35+
PartialEq,
36+
Eq,
37+
sqlx::FromRow,
38+
Hash,
39+
utoipa::ToSchema,
3240
)]
3341
pub struct ApiKey {
3442
id: ApiKeyId,

crates/web-utils/src/api_key/api_key_status.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ use serde::{Deserialize, Serialize};
55
use super::ApiKeyError;
66

77
#[derive(
8-
Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default, Hash,
8+
Debug,
9+
Serialize,
10+
Deserialize,
11+
Clone,
12+
Eq,
13+
PartialEq,
14+
Default,
15+
Hash,
16+
utoipa::ToSchema,
917
)]
1018
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
1119
pub enum ApiKeyStatus {

crates/web-utils/src/api_key/props.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
use fuel_streams_types::{declare_integer_wrapper, declare_string_wrapper};
1+
use fuel_streams_types::{
2+
declare_integer_wrapper,
3+
declare_string_wrapper,
4+
impl_utoipa_for_integer_wrapper,
5+
};
26

37
#[derive(thiserror::Error, Debug)]
48
pub enum ApiKeyIdError {
@@ -37,3 +41,33 @@ declare_integer_wrapper!(RateLimitPerMinute, u32, RateLimitPerMinuteError);
3741
declare_integer_wrapper!(HistoricalLimit, u32, HistoricalLimitError);
3842
declare_string_wrapper!(ApiKeyUserName);
3943
declare_string_wrapper!(ApiKeyValue);
44+
45+
impl_utoipa_for_integer_wrapper!(ApiKeyId, "ApiKeyId", 0, u32::MAX as usize);
46+
47+
impl_utoipa_for_integer_wrapper!(
48+
ApiKeyRoleId,
49+
"ApiKeyRoleId",
50+
0,
51+
u32::MAX as usize
52+
);
53+
54+
impl_utoipa_for_integer_wrapper!(
55+
SubscriptionCount,
56+
"SubscriptionCount",
57+
0,
58+
u32::MAX as usize
59+
);
60+
61+
impl_utoipa_for_integer_wrapper!(
62+
RateLimitPerMinute,
63+
"RateLimitPerMinute",
64+
0,
65+
u32::MAX as usize
66+
);
67+
68+
impl_utoipa_for_integer_wrapper!(
69+
HistoricalLimit,
70+
"HistoricalLimit",
71+
0,
72+
u32::MAX as usize
73+
);

crates/web-utils/src/api_key/role/role_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::api_key::{
2121
sqlx::FromRow,
2222
Default,
2323
Hash,
24+
utoipa::ToSchema,
2425
)]
2526
pub struct ApiKeyRole {
2627
id: ApiKeyRoleId,

crates/web-utils/src/api_key/role/role_name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::api_key::ApiKeyError;
1414
Default,
1515
strum::EnumIter,
1616
Hash,
17+
utoipa::ToSchema,
1718
)]
1819
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
1920
pub enum ApiKeyRoleName {

crates/web-utils/src/api_key/role/role_scope.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::api_key::ApiKeyError;
1414
Default,
1515
strum::EnumIter,
1616
Hash,
17+
utoipa::ToSchema,
1718
)]
1819
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
1920
pub enum ApiKeyRoleScope {

0 commit comments

Comments
 (0)