diff --git a/dropshot/src/api_description.rs b/dropshot/src/api_description.rs index 228c3e4eb..bafe1442f 100644 --- a/dropshot/src/api_description.rs +++ b/dropshot/src/api_description.rs @@ -778,15 +778,32 @@ impl ApiDescription { } else { // If no schema was specified, the response is hand-rolled. In // this case we'll fall back to the default response type which - // we assume to be inclusive of errors. + // we assume to be inclusive of errors. The media type and + // and schema will similarly be maximally permissive. + let mut content = indexmap::IndexMap::new(); + content.insert( + "*/*".to_string(), + openapiv3::MediaType { + schema: Some(openapiv3::ReferenceOr::Item( + openapiv3::Schema { + schema_data: openapiv3::SchemaData::default(), + schema_kind: openapiv3::SchemaKind::Any( + openapiv3::AnySchema::default(), + ), + }, + )), + ..Default::default() + }, + ); operation.responses.default = Some(openapiv3::ReferenceOr::Item(openapiv3::Response { // TODO: perhaps we should require even free-form // responses to have a description since it's required // by OpenAPI. description: "".to_string(), + content, ..Default::default() - })) + })); } // Drop in the operation. diff --git a/dropshot/tests/test_openapi.json b/dropshot/tests/test_openapi.json index ebf639c01..7b5563d36 100644 --- a/dropshot/tests/test_openapi.json +++ b/dropshot/tests/test_openapi.json @@ -485,7 +485,12 @@ "operationId": "handler16", "responses": { "default": { - "description": "" + "description": "", + "content": { + "*/*": { + "schema": {} + } + } } } } diff --git a/dropshot/tests/test_openapi_fuller.json b/dropshot/tests/test_openapi_fuller.json index 6c376e639..4e9bd4988 100644 --- a/dropshot/tests/test_openapi_fuller.json +++ b/dropshot/tests/test_openapi_fuller.json @@ -493,7 +493,12 @@ "operationId": "handler16", "responses": { "default": { - "description": "" + "description": "", + "content": { + "*/*": { + "schema": {} + } + } } } }