@@ -80,7 +80,7 @@ mod test_models {
8080 }
8181 }
8282
83- #[ allow ( clippy:: duplicated_attributes) ]
83+ #[ expect ( clippy:: duplicated_attributes) ]
8484 #[ derive( Serialize , Deserialize , Debug , Clone , ApiErrorComponent ) ]
8585 #[ openapi_error( status( code = 401 ) , status( code = 403 ) , status( code = 404 ) , status( code = 405 ) ) ]
8686 pub ( crate ) enum MultipleErrorResponse {
@@ -209,6 +209,20 @@ fn api_operation_impl_responder() {
209209 HttpResponse :: Ok ( )
210210 }
211211
212+ #[ expect( clippy:: todo, clippy:: unused_async, dead_code) ]
213+ async fn plop ( ) {
214+ todo ! ( )
215+ }
216+
217+ /// Add a new pet to the store
218+ /// Add a new pet to the store
219+ /// Plop
220+ #[ api_operation( tag = "pet" ) ]
221+ pub ( crate ) async fn test_async ( _body : Json < test_models:: Test > ) -> impl Responder {
222+ plop ( ) . await ;
223+ HttpResponse :: Ok ( )
224+ }
225+
212226 let components = __openapi_test:: components ( OpenApiVersion :: OAS3_1 ) ;
213227 // only one component here because: error does not have schema and Test is used both for query and response
214228 assert_eq ! ( components. len( ) , 1 ) ;
@@ -250,6 +264,48 @@ fn api_operation_impl_responder() {
250264 "deprecated" : false
251265 } )
252266 ) ;
267+
268+ let components = __openapi_test_async:: components ( OpenApiVersion :: OAS3_1 ) ;
269+ // only one component here because: error does not have schema and Test is used both for query and response
270+ assert_eq ! ( components. len( ) , 1 ) ;
271+ let components = serde_json:: to_value ( components) . expect ( "Unable to serialize as Json" ) ;
272+
273+ let operation = __openapi_test_async:: operation ( OpenApiVersion :: OAS3_1 ) ;
274+ let operation = serde_json:: to_value ( operation) . expect ( "Unable to serialize as Json" ) ;
275+
276+ assert_json_eq ! ( components, json!( [ { } ] ) ) ;
277+ assert_json_eq ! (
278+ operation,
279+ json!( {
280+ "tags" : [
281+ "pet"
282+ ] ,
283+ "summary" : "Add a new pet to the store" ,
284+ "description" : "Add a new pet to the store\\ \n Plop" ,
285+ "requestBody" : {
286+ "content" : {
287+ "application/json" : {
288+ "schema" : {
289+ "$schema" : "https://json-schema.org/draft/2020-12/schema" ,
290+ "title" : "Test" ,
291+ "type" : "object" ,
292+ "properties" : {
293+ "test" : {
294+ "type" : "string"
295+ }
296+ } ,
297+ "required" : [
298+ "test"
299+ ]
300+ }
301+ }
302+ } ,
303+ "required" : true
304+ } ,
305+ "responses" : { } ,
306+ "deprecated" : false
307+ } )
308+ ) ;
253309}
254310
255311#[ test]
0 commit comments