File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,12 @@ use axum::extract::rejection::PathRejection;
44use axum:: extract:: { FromRequestParts , Path } ;
55use axum:: http:: request:: Parts ;
66use objectstore_service:: id:: { ObjectContext , ObjectId } ;
7- use objectstore_types:: scope:: { Scope , Scopes } ;
7+ use objectstore_types:: scope:: { EMPTY_SCOPES , Scope , Scopes } ;
88use serde:: { Deserialize , de} ;
99
1010use crate :: extractors:: Xt ;
1111use crate :: state:: ServiceState ;
1212
13- /// Used in place of scopes in the URL to represent an empty set of scopes.
14- const EMPTY_SCOPES : & str = "_" ;
15-
1613impl FromRequestParts < ServiceState > for Xt < ObjectId > {
1714 type Rejection = PathRejection ;
1815
Original file line number Diff line number Diff line change 55//! - [`Scope`] is a single key-value pair representing one level of hierarchy
66//! - [`Scopes`] is an ordered collection of [`Scope`]s
77
8- use std:: fmt:: { self , Write } ;
8+ use std:: fmt;
99
1010/// Characters allowed in a Scope's key and value.
1111///
@@ -14,6 +14,9 @@ use std::fmt::{self, Write};
1414const ALLOWED_CHARS : & str =
1515 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-()$!+'" ;
1616
17+ /// Used in place of scopes in the URL to represent an empty set of scopes.
18+ pub const EMPTY_SCOPES : & str = "_" ;
19+
1720/// A single scope value of an object.
1821///
1922/// Scopes are used in a hierarchy in object IDs.
@@ -204,7 +207,7 @@ impl fmt::Display for AsApiPath<'_> {
204207 }
205208 Ok ( ( ) )
206209 } else {
207- f. write_char ( '_' )
210+ f. write_str ( EMPTY_SCOPES )
208211 }
209212 }
210213}
@@ -271,6 +274,6 @@ mod tests {
271274
272275 let empty_scopes = Scopes :: empty ( ) ;
273276 let api_path = empty_scopes. as_api_path ( ) . to_string ( ) ;
274- assert_eq ! ( api_path, "_" ) ;
277+ assert_eq ! ( api_path, EMPTY_SCOPES ) ;
275278 }
276279}
You can’t perform that action at this time.
0 commit comments