@@ -41,30 +41,23 @@ class S3FileTypeConfig(metaclass=S3FileTypeConfigMeta):
4141 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
4242 content_disposition : typing .Literal ["attachment" , "inline" ] = "attachment"
4343
44- @staticmethod
45- def get_formatted_s3_configs () -> str :
46- """Get formatted S3 configs descriptions for api description."""
47- formatted_s3_configs : list [str ] = []
48- for name , config in S3FileTypeConfig .configs .items ():
49- allowed_types = (
50- ", " .join (config .allowed ) if config .allowed else "All types"
44+ def get_short_description (self ) -> str :
45+ """Get short description for config."""
46+ allowed_types = (
47+ ", " .join (self .allowed ) if self .allowed else "All types"
48+ )
49+ content_length_range = (
50+ (
51+ f"{ self .content_length_range [0 ]} -"
52+ f"{ self .content_length_range [1 ]} bytes"
5153 )
52- content_length_range = (
53- (
54- f"{ config .content_length_range [0 ]} -"
55- f"{ config .content_length_range [1 ]} bytes"
56- )
57- if config .content_length_range
58- else "Any length"
59- )
60- formatted_s3_configs .append (
61- f"`{ name } `\n \n "
62- f"| Parameter | Value |\n "
63- f"|:---|:---|\n "
64- f"| Allowed | { allowed_types } |\n "
65- f"| Content length range | { content_length_range } |\n "
66- f"| Expires in | { config .expires_in } seconds |\n "
67- f"| Success action status | { config .success_action_status } |\n "
68- f"| Content disposition | { config .content_disposition } |" ,
69- )
70- return "\n \n " .join (formatted_s3_configs )
54+ if self .content_length_range
55+ else "Any length"
56+ )
57+ return (
58+ f"*Allowed types*: { allowed_types } , "
59+ f"*Content length range*: { content_length_range } , "
60+ f"*Expires in*: { self .expires_in } seconds, "
61+ f"*Success action status*: { self .success_action_status } , "
62+ f"*Content disposition*: { self .content_disposition } "
63+ )
0 commit comments