Custom Content type: better message and added tests (#12841)

* add tests for custom mime types

* better message for custom mime type example handling

* minor code format change
This commit is contained in:
William Cheng 2022-07-12 18:32:15 +08:00 committed by GitHub
parent 6dfbc58bb8
commit 60c5875091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 44 additions and 25 deletions

View File

@ -171,7 +171,7 @@ public class ExampleGenerator {
output.add(kv);
}
} else {
kv.put(EXAMPLE, "null");
kv.put(EXAMPLE, "Custom MIME type example not yet supported: " + mediaType);
output.add(kv);
}
}

View File

@ -1069,6 +1069,10 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
# Export data as Excel spreadsheet.
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- petstore_auth:
- 'write:pets'

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -2033,7 +2033,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
@ -2122,7 +2123,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -1654,7 +1654,8 @@ namespace Org.OpenAPITools.Api
request.Content.Headers.Add("ContentType", contentType);
string[] accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
string? accept = ClientUtils.SelectHeaderAccept(accepts);

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -1513,7 +1513,8 @@ namespace Org.OpenAPITools.Api
request.Content.Headers.Add("ContentType", contentType);
string[] accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
string accept = ClientUtils.SelectHeaderAccept(accepts);

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -1513,7 +1513,8 @@ namespace Org.OpenAPITools.Api
request.Content.Headers.Add("ContentType", contentType);
string[] accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
string accept = ClientUtils.SelectHeaderAccept(accepts);

View File

@ -880,7 +880,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -1871,7 +1871,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
@ -1945,7 +1946,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -2033,7 +2033,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
@ -2122,7 +2123,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -2033,7 +2033,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
@ -2122,7 +2123,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -2033,7 +2033,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
@ -2122,7 +2123,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

View File

@ -844,7 +844,7 @@ catch (ApiException e)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
### HTTP response details

View File

@ -2033,7 +2033,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
@ -2122,7 +2123,8 @@ namespace Org.OpenAPITools.Api
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
"application/json",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);