mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 04:52:28 +00:00
fix no accepted types result in no openapi content being generated
fixes #15
This commit is contained in:
parent
8d85893ca4
commit
08a8f3557b
1 changed files with 3 additions and 3 deletions
|
@ -16,7 +16,7 @@ use gotham::{
|
||||||
};
|
};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use log::error;
|
use log::error;
|
||||||
use mime::{Mime, APPLICATION_JSON, TEXT_PLAIN};
|
use mime::{Mime, APPLICATION_JSON, STAR_STAR, TEXT_PLAIN};
|
||||||
use openapiv3::{
|
use openapiv3::{
|
||||||
APIKeyLocation, Components, MediaType, OpenAPI, Operation, Parameter, ParameterData, ParameterSchemaOrContent, PathItem,
|
APIKeyLocation, Components, MediaType, OpenAPI, Operation, Parameter, ParameterData, ParameterSchemaOrContent, PathItem,
|
||||||
ReferenceOr, ReferenceOr::Item, ReferenceOr::Reference, RequestBody as OARequestBody, Response, Responses, Schema,
|
ReferenceOr, ReferenceOr::Item, ReferenceOr::Reference, RequestBody as OARequestBody, Response, Responses, Schema,
|
||||||
|
@ -309,7 +309,7 @@ fn new_operation(
|
||||||
requires_auth : bool
|
requires_auth : bool
|
||||||
) -> Operation
|
) -> Operation
|
||||||
{
|
{
|
||||||
let content = schema_to_content(accepted_types.unwrap_or_default(), schema);
|
let content = schema_to_content(accepted_types.unwrap_or_else(|| vec![STAR_STAR]), schema);
|
||||||
|
|
||||||
let mut responses : IndexMap<StatusCode, ReferenceOr<Response>> = IndexMap::new();
|
let mut responses : IndexMap<StatusCode, ReferenceOr<Response>> = IndexMap::new();
|
||||||
responses.insert(StatusCode::Code(default_status.as_u16()), Item(Response {
|
responses.insert(StatusCode::Code(default_status.as_u16()), Item(Response {
|
||||||
|
@ -321,7 +321,7 @@ fn new_operation(
|
||||||
|
|
||||||
let request_body = body_schema.map(|schema| Item(OARequestBody {
|
let request_body = body_schema.map(|schema| Item(OARequestBody {
|
||||||
description: None,
|
description: None,
|
||||||
content: schema_to_content(supported_types.unwrap_or_default(), schema),
|
content: schema_to_content(supported_types.unwrap_or_else(|| vec![STAR_STAR]), schema),
|
||||||
required: true
|
required: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue