All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
#[5.1.4] 2024-11-25
- Assign the description to the request object in OpenAPI #886
- Implemented nullable fields for openapi spec generation #865
- refactor: change type name delimiters from
<>
()
[]
to_
#904
#[5.1.3] 2024-11-20
- Update MSRV to
1.81.0
- implements
Serialize
andDeserialize
forpoem_openapi::types::Any<T>
. - add
ParseError::message method
to get the error message.
- fix #883
- fix read_only_with_default test when only default features are enabled #854
- feat: add AsyncSeek trait to Upload::into_async_read return type #853
- Added derivations for Type, ParseFromJSON and ToJSON for sqlx::types::Json. #833
- chore(openapi): bump derive_more #867
- Added derivations for Type, ParseFromJSON and ToJSON for sqlx types #833
- Add enum_items to discriminated union #741
- fix Union doesn't implement IsObjectType #800
- fix Union doesn't support generics in the last version #799
- Expose Poem-OpenApi Upload File struct #816
- use AFIT instead of
async_trait
- add
Upload::size
method - when
Union
uses discriminator, if the members is not anObject
, an error will be reported at compile time
- added example value support for param/schema #717
- Adding serialize_with and deserialize_with attributes to struct fields #749
- upgrade to
hyper1
- added documentation on how to merge API specs #716
- impl Type for std::time::Duration instead of only humantime::Duration #713
- add
prost-wkt-types
crate support #689 - add
geo-types
crate support #693 - count string length correctly in OpenAPI validators #666
- Support for custom hash functions for HashMap/HashSet #654
- Misplaced ``` in swagger_ui HTML template #660
- for
read-only
properties, can usedefault
to specify a function for creating a default value. #647
fn default_offset_datetime() -> OffsetDateTime {
OffsetDateTime::now_utc()
}
#[derive(Debug, Object, PartialEq)]
struct Obj {
#[oai(read_only, default = "default_offset_datetime")]
time: OffsetDateTime,
}
- fixes #648
- allow using expressions as
prefix_path
parameter #635 - bump
quick-xml
from0.29.0
to0.30.0
- Add fallback support for
SecurityScheme
macro used on enums
- Add support for multiple authentication methods. #627
- change
fn ApiExtractor::security_schemes() -> Option<&str>
tofn ApiExtractor::security_schemes() -> Vec<&str>
- openapi: allows multiple security schemes on one operation #621
- bump
syn
from1.0
to2.0
- bump
darling
from0.14
to0.20
- feat: introduce idle timeout #603
-
Since
syn 2.0
no longer supports keywords as meta path, renamed some parameters in macros.Macro Old Name New Name SecuritySchema type ty SecuritySchema in key_in ApiResponse.header type ty -
Change
ApiExtractor::TYPE
toApiExtractor::TYPES
to allow implementing multiple extractor in single type.
- feat: Implement Type on the char primitive #518
- Pattern matching in OpenAPI function args #517
- chore: add Clone for
OpenApiService
#527 - Fix
#[derive(Multipart)]
for struct, so it will work with#[derive(ApiRequest)]
#551 - feat: Allow more types to be prased into strings #545
- Support for ipnet crate + IpAddr #544
- Add the missing feature
openapi-explorer
inui
mod #480 - Add yaml support #476
- Remove
poem_openapi::response::StaticFileResponse
and implementApiResponse trait
forpoem::web::StaticFileResponse
- Add support for OpenAPI Explorer #440
- Add
Ipv4Addr
andIpv6Addr
openapi support #442 - Parse Value(Number) into Decimal #452
- Parse other number types as well and fix float #454
- Responses generated by the
ApiResponse
macro have correct error messages when converted topoem::Error
- Add generic support to the
NewType
macro - Fixes #436
- Bump quick-xml to
0.26.0
- Fixes #429
- Throws an error when
flatten
combination with structs that usedeny_unknown_fields
- Fixes #405
- Add
EventStream::to_event
method to set a function used to convert the message to SSE event. #378 - OpenApi XML support #354
- Add
hidden
attribute for the operation #376
- Add the
default
attribute to Object macro. #369
- Expose
AttachmentType
enum #344 - Add
rename_all
attribute forUnion
macro #347 - Change the default attachment type to
attachment
#325 - Update
serde_yaml
to 0.9.0 #352
- Use first line of comment as title of newtype param #319
- Add
Content-Disposition
header to schema forAttachment
#325 - Add support for
x-code-samples
#335 - Return
400
when parsing path fails, not404
#326 - Use Parent_Child instead of Parent[Child] for generated intermediate type #340
- Fixed docs for
NewType
macro
- Add support for specifying contact field #306
- Add
actual_type
attribute toOpenApi
,Response
,ResponseContent
macros #314
- Add integrate with the
time
crate. - Add support generating openapi UI html through the dedicated function. #298
- Add support for getting the spec as YAML #287
- Add optional support for humantime Duration in poem Object #293
- Publish
Poem-openapi v2.0.0
🙂
- Re-added the
example
attribute forObject
macro. - Response
404 NOT FOUND
when parsing path parameters fails. #279
- Remove
inline
andconcrete
attributes ofObject
andUnion
macros, now automatically generate reference names for generic objects.
- If the
inline
orconcretes
attribute of the generic object is not specified, the exact error will be reported at compile time.
- Add support for generic union. #259
- Fixed
poem::web::StaticFileResponse
conversion topoem_openapi::respoinse::StaticFileResponse
missingContent-Type
header.
- Downgrades the
indexmap
dependency to1.6.2
to resolve tkaitchuck/aHash#95
- Implement
Type
forchrono::NaiveDateTime
,chrono::NaiveDate
,chrono::NaiveTime
#252
- Fixed
#[oai(default)]
not working with operation parameters. - Add
MaybeUndefined::update_to
method.
- Generate responses in schema when
ApiResponse
as an error. #244
- Implement
From<T: ApiResponse>
forpoem::Error
so that it can be used as error type.
- Add support for use multiple methods on a single endpoint. #229
- Normalize decimals in responses. #228
- Add support for extra request/response headers.
- Add support for extra headers.
- Add support generic for
OpenAPI
macro. #216
- Add
skip_serializing_if_is_none
,skip_serializing_if_is_empty
andskip_serializing_if
attributes toObject
macro. #220
- Implement
Type
forrust_decimal::Decimal
. #214
- Add support for deriving remote objects to the
Object
macro. - Add
poem_openapi::payload::Base64
.
- Implement
From<T>
,IntoIterator
forMaybeUndefined<T>
. - Add
MaybeUndefined::from_opt_undefined
,MaybeUndefined::from_opt_null
,MaybeUndefined::as_ref
,MaybeUndefined::as_deref
methods.
- Implement
ToJson
forMaybeUndefined
.
- Add
MaybeUndefined
type.
- Fix OpenAPI doesn't work with tracing::instrument. #194
- Fix unsupported media-type (415) instead of method not allowed (405). #188
- Integrate with
bson::oid::ObjectId
. #185
- Make the
ApiRequest
macro exactly match the mime type.
- Add
Html
payload type. - Add
StaticFileResponse
type.
- Fixed stack overflow on recursive structures. #184
- Fixed
EventStream
not registering internal types. - OpenApi schemas generated by the
Union
macro are no longer inlined by default.
- Set Rapidoc's
schema-description-expanded
option totrue
.
- Add
flatten
attribute
forObject
macro.
- Fix stack overflow when generating schema for structure references Self. #171
- Add
HashSet
andBTreeSet
support to OpenAPI. #167 - Add
Url
support to OpenAPI. #168 - Breaking change: Remove
OneOf
macro and addUnion
macro, and replaceproperty_name
withdiscriminator_name
.- The implementation of
OneOf
was incorrect. To migrate, change all instances ofOneOf
toUnion
, and all instances ofproperty_name
todiscriminator_name
.
- The implementation of
- Add
deprecated
attribute toApiResponse
's header field.
- Fixed the
externalDocs
field name is incorrect in the specification.
- Add
ToJSON::to_json_string
method.
- Add support for custom validator.
- Add
external_docs
attribute for some macros. - Add
ParseFromJSON::parse_from_json_string
method.
- Add
NewType
macro. #159
- Add
ResponseContent
macro.
- Add
deprecated
attribute toEnum
macro.
- Add
OpenApiService::summary
method.
- The
OneOf
macro no longer automatically implementsserde::Serialize
andserde::Deserialize
traits.
- The
Object
macro no longer automatically implementsserde::Serialize
andserde::Deserialize
traits.
- Fix generates a field with #[oai(default)] marked as required even though it isn't. #145
- Add
EventStream::keep_alive
method.
- Remove the
OpenApi::combine
method,OpenApiService::new
can be passed a tuple to combine multiple API objects.
- The
content_type
attribute of theApiRequest
macro supports wildcards. - Add
EventStream
payload. - Implement
Type
forserde_json::Value
.
#[derive(ApiRequest)]
enum UploadImageRequest {
#[oai(content_type = "image/jpeg")]
Jpeg(Binary<Vec<u8>>),
#[oai(content_type = "image/png")]
Png(Binary<Vec<u8>>),
#[oai(content_type = "image/*")]
Other(Binary<Vec<u8>>),
}
- Added the
content_type
attribute to theApiRequest
andApiResponse
macros to specify the content type of the request or response. - Panic occurs when a duplicate operation id is detected.
- Add
OpenApiService::external_document
method to referencing an external resource for extended documentation. - Add
Webhook
macro to define webhooks. - Implement
OpenApi
for()
to define an empty APIs.
- Make the
OpenAPI
macro can now report duplicate routing errors.
- Fix the parameter validator will cause compilation failure in some cases.
- Add
remote
attribute toEnum
macro. - Remove the
BinaryStream
type, usepoem::Body
instead. - Do not rename any types by default. #128
- Add
BinaryStream::from_bytes_stream
andBinaryStream::to_bytes_stream
methods.
- Add some methods to specify more API metadata.
- Add
Response
type, use it to modify the status code and HTTP headers.
- impl
ParseFromParameter
for [T; const LEN: usize]. - Add
example
attribute forObject
macro. - Add
deny_unknown_fields
attribute forObject
andMultipart
macros.
- Add
Email
/Hostname
types. - Integrate with the
regex
,uuid
. - Implement
Type
forUri
. - Implement
Type
forDateTime<Utc>
andDateTime<Local>
. - Add support for Redoc.
- Remove the
PoemExtractor
type because it is no longer needed.
- Add
Attachment
payload for download file. - Added
BinaryStream
to support streaming payload.
- Change the default renaming rule of enum items from
ScreamingSnake
toPascal
.
- Remove the
desc
attribute of the response header inApiResponse
macro, and use rustdoc to add the header description. - Implement
ParseFromParameter
forVec<T>
.
- Remove the
list
attribute of the validator, it is no longer needed. - Add
maxProperties
andminProperties
validators. - Add support to API operation with optional payload.
- Add support to API responses with optional header.
- Change the schema type of enum to
string
#121
- Implement
Type
for&[T]
,&T
and[T; const N: usize]
. - Add support for returning references from API operation functions.
- Fixed the bug that
Arc
,Box
,BTreeMap
andHashMap
did not register subtypes.
- Add support for
additionalProperties
.
- Rework implement
Type
forHashMap
andBTreeMap
.
- Implement
Type
forBox<T>
,Arc<T>
,HashMap<K, V>
andBTreeMap<K, V>
. #116
- Add support for RapiDoc.
- Remove the
desc
attribute of the operation parameter inOpenAPI
macro, and use rustdoc to add the parameter description.
- If an OpenAPI name conflict is detected when creating schema, it will cause panic.
-
Remove
akasma
from dependencies. -
#[oai(validator(list))]
no longer applies tomax_items
,min_items
andunique_items
.
- Add
list
attribute to the validator. - Rework
OpenAPI
macro.
- Omit empty security schemas from OpenAPI document. #93
- Description is a required field for responses. #86
- Add
version
andtitle
parameters toOpenAPIService::new
. #87
- Add
checker
attribute forSecurityScheme
macro. - Use Rust 2021 edition.
- Some configurations no longer need
'static
.
- Correctly determine the type of payload.
- Bump
poem
to1.0.11
.
- Make the return type of operation function more flexible.
- Add
Any
type.
- Add
read_only_all
andwrite_only_all
toObjectArgs
. #71
- Fix Json parsing not working for unsigned integers. #68
- Bump
poem
from1.0.3
to1.0.4
.
- Add
prefix_path
andtag
attributes for#[OpenApi]
. #57 OpenApiService::swagger_ui
method no longer needs theabsolute_uri
parameter.- Add
inline
attribute forObject
macro. - Add generic support for
ApiRequest
andApiResponse
macros.
- Add
write_only
andread_only
attributes for object fields. - Add
OpenApiService::spec
method to get the generated OAS specification file. - Implements
Default
trait forpoem_openapi::types::multipart::JsonField<T>
. - Implements
ParseFromMultipartField
for some types.
- Add
Request::remote_addr
method.