Give unique names to path params

This commit is contained in:
Andras Schmelczer 2025-03-22 20:30:24 +00:00
parent 407c56040e
commit e9c6f99df2
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
8 changed files with 57 additions and 57 deletions

View file

@ -23,7 +23,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct CreateDocumentPathParams {
vault_id: VaultId,
}
@ -33,7 +33,7 @@ pub struct PathParams {
#[axum::debug_handler]
pub async fn create_document_multipart(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams { vault_id }): Path<PathParams>,
Path(CreateDocumentPathParams { vault_id }): Path<CreateDocumentPathParams>,
State(state): State<AppState>,
TypedMultipart(axum_typed_multipart::TypedMultipart(request)): TypedMultipart<
CreateDocumentVersionMultipart,
@ -56,7 +56,7 @@ pub async fn create_document_multipart(
#[axum::debug_handler]
pub async fn create_document_json(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams { vault_id }): Path<PathParams>,
Path(CreateDocumentPathParams { vault_id }): Path<CreateDocumentPathParams>,
State(state): State<AppState>,
Json(request): Json<CreateDocumentVersion>,
) -> Result<Json<DocumentVersionWithoutContent>, SyncServerError> {

View file

@ -17,7 +17,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct DeleteDocumentPathParams {
vault_id: VaultId,
document_id: DocumentId,
}
@ -25,10 +25,10 @@ pub struct PathParams {
#[axum::debug_handler]
pub async fn delete_document(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams {
Path(DeleteDocumentPathParams {
vault_id,
document_id,
}): Path<PathParams>,
}): Path<DeleteDocumentPathParams>,
State(mut state): State<AppState>,
Json(request): Json<DeleteDocumentVersion>,
) -> Result<Json<DocumentVersionWithoutContent>, SyncServerError> {

View file

@ -16,7 +16,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct FetchDocumentVersionPathParams {
vault_id: VaultId,
document_id: DocumentId,
vault_update_id: VaultUpdateId,
@ -25,11 +25,11 @@ pub struct PathParams {
#[axum::debug_handler]
pub async fn fetch_document_version(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams {
Path(FetchDocumentVersionPathParams {
vault_id,
document_id,
vault_update_id,
}): Path<PathParams>,
}): Path<FetchDocumentVersionPathParams>,
State(mut state): State<AppState>,
) -> Result<Json<DocumentVersion>, SyncServerError> {
auth(&state, auth_header.token())?;

View file

@ -18,7 +18,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct FetchDocumentVersionContentPathParams {
vault_id: VaultId,
document_id: DocumentId,
vault_update_id: VaultUpdateId,
@ -27,11 +27,11 @@ pub struct PathParams {
#[axum::debug_handler]
pub async fn fetch_document_version_content(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams {
Path(FetchDocumentVersionContentPathParams {
vault_id,
document_id,
vault_update_id,
}): Path<PathParams>,
}): Path<FetchDocumentVersionContentPathParams>,
State(mut state): State<AppState>,
) -> Result<Bytes, SyncServerError> {
auth(&state, auth_header.token())?;

View file

@ -16,7 +16,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct FetchLatestDocumentVersionPathParams {
vault_id: VaultId,
document_id: DocumentId,
}
@ -24,10 +24,10 @@ pub struct PathParams {
#[axum::debug_handler]
pub async fn fetch_latest_document_version(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams {
Path(FetchLatestDocumentVersionPathParams {
vault_id,
document_id,
}): Path<PathParams>,
}): Path<FetchLatestDocumentVersionPathParams>,
State(mut state): State<AppState>,
) -> Result<Json<DocumentVersion>, SyncServerError> {
auth(&state, auth_header.token())?;

View file

@ -15,7 +15,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct FetchLatestDocumentsPathParams {
vault_id: VaultId,
}
@ -28,7 +28,7 @@ pub struct QueryParams {
#[axum::debug_handler]
pub async fn fetch_latest_documents(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams { vault_id }): Path<PathParams>,
Path(FetchLatestDocumentsPathParams { vault_id }): Path<FetchLatestDocumentsPathParams>,
Query(QueryParams { since_update_id }): Query<QueryParams>,
State(mut state): State<AppState>,
) -> Result<Json<FetchLatestDocumentsResponse>, SyncServerError> {

View file

@ -25,7 +25,7 @@ use crate::{
// This is required for aide to infer the path parameter types and names
#[derive(Deserialize, JsonSchema)]
pub struct PathParams {
pub struct UpdateDocumentPathParams {
vault_id: VaultId,
document_id: DocumentId,
}
@ -33,10 +33,10 @@ pub struct PathParams {
#[axum::debug_handler]
pub async fn update_document_multipart(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams {
Path(UpdateDocumentPathParams {
vault_id,
document_id,
}): Path<PathParams>,
}): Path<UpdateDocumentPathParams>,
State(state): State<AppState>,
TypedMultipart(axum_typed_multipart::TypedMultipart(request)): TypedMultipart<
UpdateDocumentVersionMultipart,
@ -57,10 +57,10 @@ pub async fn update_document_multipart(
#[axum::debug_handler]
pub async fn update_document_json(
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(PathParams {
Path(UpdateDocumentPathParams {
vault_id,
document_id,
}): Path<PathParams>,
}): Path<UpdateDocumentPathParams>,
State(state): State<AppState>,
Json(request): Json<UpdateDocumentVersion>,
) -> Result<Json<DocumentUpdateResponse>, SyncServerError> {

View file

@ -450,6 +450,9 @@ export type webhooks = Record<string, never>;
export interface components {
schemas: {
Array_of_uint8: number[];
CreateDocumentPathParams: {
vault_id: string;
};
CreateDocumentVersion: {
contentBase64: string;
/**
@ -465,6 +468,11 @@ export interface components {
document_id?: string | null;
relative_path: string;
};
DeleteDocumentPathParams: {
/** Format: uuid */
document_id: string;
vault_id: string;
};
DeleteDocumentVersion: {
relativePath: string;
};
@ -516,6 +524,28 @@ export interface components {
/** Format: int64 */
vaultUpdateId: number;
};
FetchDocumentVersionContentPathParams: {
/** Format: uuid */
document_id: string;
vault_id: string;
/** Format: int64 */
vault_update_id: number;
};
FetchDocumentVersionPathParams: {
/** Format: uuid */
document_id: string;
vault_id: string;
/** Format: int64 */
vault_update_id: number;
};
FetchLatestDocumentVersionPathParams: {
/** Format: uuid */
document_id: string;
vault_id: string;
};
FetchLatestDocumentsPathParams: {
vault_id: string;
};
/** @description Response to a fetch latest documents request. */
FetchLatestDocumentsResponse: {
/**
@ -525,41 +555,6 @@ export interface components {
lastUpdateId: number;
latestDocuments: components["schemas"]["DocumentVersionWithoutContent"][];
};
PathParams: {
vault_id: string;
};
PathParams2: {
vault_id: string;
};
PathParams3: {
/** Format: uuid */
document_id: string;
vault_id: string;
};
PathParams4: {
/** Format: uuid */
document_id: string;
vault_id: string;
};
PathParams5: {
/** Format: uuid */
document_id: string;
vault_id: string;
/** Format: int64 */
vault_update_id: number;
};
PathParams6: {
/** Format: uuid */
document_id: string;
vault_id: string;
/** Format: int64 */
vault_update_id: number;
};
PathParams7: {
/** Format: uuid */
document_id: string;
vault_id: string;
};
/** @description Response to a ping request. */
PingResponse: {
/** @description Whether the client is authenticated based on the sent Authorization header. */
@ -575,6 +570,11 @@ export interface components {
causes: string[];
message: string;
};
UpdateDocumentPathParams: {
/** Format: uuid */
document_id: string;
vault_id: string;
};
UpdateDocumentVersion: {
contentBase64: string;
/** Format: int64 */