@@ -493,11 +493,10 @@ fn response_type(response: &ReferenceOr<Response>, ref_cache: &mut RefCache) ->
493493 "Reference in response top level: {reference}"
494494 ) ) ) ,
495495 ReferenceOr :: Item ( resp) => {
496- if resp. content . len ( ) != 1 {
497- Err ( Error :: unimplemented (
498- "Response content with not exactly 1 option." ,
499- ) )
500- } else {
496+ if resp. content . is_empty ( ) {
497+ // No content case
498+ Ok ( DataType :: Unit )
499+ } else if resp. content . len ( ) == 1 {
501500 let ( content_type, media_type) = resp. content . first ( ) . unwrap ( ) ;
502501
503502 if content_type. starts_with ( "application/json" ) {
@@ -520,6 +519,10 @@ fn response_type(response: &ReferenceOr<Response>, ref_cache: &mut RefCache) ->
520519 "Response content type: {content_type}"
521520 ) ) )
522521 }
522+ } else {
523+ Err ( Error :: unimplemented (
524+ "Response content with not exactly 1 option." ,
525+ ) )
523526 }
524527 }
525528 }
@@ -748,6 +751,7 @@ fn render_path_param(method: &Method, name: &str) -> RustResult {
748751 DataType :: String => Ok ( unit ( ) + & param. name ) ,
749752 DataType :: Uuid => Ok ( unit ( ) + "&" + & param. name + ".to_string()" ) ,
750753 DataType :: Model ( _) => Ok ( unit ( ) + "&" + & param. name + ".to_string()" ) ,
754+ DataType :: Int ( _) => Ok ( unit ( ) + "&" + & param. name + ".to_string()" ) ,
751755 _ => Err ( Error :: unexpected ( format ! (
752756 "Unexpected param type {name}: {:?}" ,
753757 param. tpe
@@ -882,6 +886,7 @@ fn status_match(range_results: bool, code: &StatusCode) -> RustPrinter {
882886fn response_body_parsing ( data_type : & DataType ) -> RustPrinter {
883887 match data_type {
884888 DataType :: Binary => unit ( ) + "response.bytes().await?" ,
889+ DataType :: Unit => unit ( ) + "()" ,
885890 _ => unit ( ) + "response.json::<" + data_type. render_declaration ( false ) + ">().await?" ,
886891 }
887892}
0 commit comments