poem_openapi

Derive Macro NewType

Source
#[derive(NewType)]
{
    // Attributes available to this derive:
    #[oai]
}
Expand description

Define a new type.

§Macro parameters

AttributeDescriptionTypeOptional
from_jsonImplement ParseFromJSON trait. Default is trueboolY
from_parameterImplement ParseFromParameter trait. Default is trueboolY
from_multipartImplement ParseFromMultipartField trait. Default is trueboolY
to_jsonImplement ToJSON trait. Default is trueboolY
to_headerImplement ToHeader trait. Default is trueboolY
external_docsSpecify a external resource for extended documentationstringY
exampleIndicates that the type has implemented Example traitboolY

§Examples

use poem_openapi::NewType;

#[derive(NewType)]
struct MyString(String);