Releases: ZihanType/predawn
0.9.0
Breaking
- breaking: refactor error handling:
- change the definition of the
status_codesmethod on theResponseErrortrait fromfn status_codes() -> BTreeSet<StatusCode>tofn status_codes(codes: &mut BTreeSet<StatusCode>). - replace dep
snafuwiththiserror. - refactor all
ResponseErrortrait implementations. - change
fn error_chain(&self) -> &[&'static str]method on theErrorstruct tofn error_stack(&self) -> &[Box<str>]. - add
ErrorExttrait, and change theErrortrait in super traits ofResponseErrortoErrorExttrait.
- change the definition of the
- breaking: add required method
titletoToSchematrait. - breaking: rename method
ToSchema::nametoToSchema::key. - breaking: remove the
impl From<LogLevel> for tracing::Levelimplementation.
Feat
- feat: add
EventStream::newmethod. - feat: add
LogLevel::Offvariant to disable logging. - feat: add
as_{log, tracing}_level{_filter}methods toLogLevelfor conversion tologandtracinglog levels. - feat: rename the
handlerattribute in thecontrollerattribute macro toendpointto avoidrust-analyzerintroducing thepredawn::handlermodule when code completion occurs.
Fix
- fix: invalid default comment in
KeepAliveused byEventStream.
Chore
- chore: avoid cloning
Arcduring deserialization ofPath. - chore: update
tower-httpto0.6. - chore: update
tokio-tungsteniteto0.24. - chore: add comments for internal implementation details.
- chore: re-export
httpcrate. - chore: handle
InsertErrorin one place.
Predawn Sea ORM
- [predawn-sea-orm] breaking: rename
Connectionstruct toDataSource. - [predawn-sea-orm] breaking: change the definition of the
Errorenum. - [predawn-sea-orm] breaking:
commitandrollbackmethods take parameters of typeTransaction. - [predawn-sea-orm] breaking: rename
new_txnmethod tocreate_txn. - [predawn-sea-orm] feat: support nested transaction.
- [predawn-sea-orm] feat: expose task-local variable
DATA_SOURCESfor easy customization of transaction management.
0.8.0
-
breaking: rename types:
MultiparttoUpload,AttachmenttoDownload,AttachmentErrortoDownloadError. rename method:Attachment::newtoDownload::attachment. -
breaking: refactor
ParseFieldtrait to support parsing multiple fields into[T; N]arrays. -
breaking: rename
MultipartError::RepeatedFieldvariant toMultipartError::DuplicateField. -
breaking: add
MultipartError::IncorrectNumberOfFieldsvariant. -
breaking: add
componentsparameter to associated functionschemaofToSchematrait. -
breaking: move
predawn::media_type::InvalidContentTypetopredawn::response_error::InvalidContentType. -
breaking: rename the
wrappersmethod on theErrortype toerror_chain. -
breaking: delete
DownloadErrorenum. -
breaking: change the
<Download<T> as IntoResponse>::Errortype fromDownloadError<T::Error>toEither<T::Error, InvalidContentDisposition>. -
breaking: change the return type of
ToHeaderValue::to_header_valuefromOption<Result<HeaderValue, InvalidHeaderValue>>toMaybeHeaderValue. -
breaking: refactor
ParseFieldtrait. -
breaking: add parameter
map: &mut AnyMaptoinit_loggermethod inHookstrait. -
breaking: change
Environment::Custom(String)toEnvironment::Custom(Box<str>). -
breaking: change
impl From<&Config> for {Logger, OpenAPI, Server, DataSources}Configto{Logger, OpenAPI, Server, DataSources}Config::new(&Config). -
breaking: remove the
DataStreamtype and replace it withhttp_body_util::BodyDataStream. -
breaking: parameter type of the
from_request_headfunction in theFromRequestHeadtrait changed from&Headto&mut Head. -
breaking: parameter type of the
from_requestfunction in theFromRequesttrait changed from&Headto&mut Head. -
breaking: change the return type of the
status_codesfunction in theResponseErrortrait fromHashSet<...>toBTreeSet<...>. -
breaking: change the parameter of the following methods from
components: &mut Componentstoschemas: &mut BTreeMap<String, Schema>:ToSchema::schemaToSchema::schema_refToSchema::schema_ref_boxToParameters::parametersApiRequestHead::parametersApiRequest::parametersApiRequest::request_bodyApiResponse::responsesResponseError::responsesSingleMediaType::media_typeMultiRequestMediaType::contentMultiResponseMediaType::contentSingleResponse::responseMultiResponse::responses
-
feat: add an associated function
nameto theToSchematrait with a default implementation. -
feat: add a
titlefield to the schema generated by theToSchemaderived macro. -
feat: add an associated function
schema_ref_boxtoToSchematrait. -
feat: add
Tagderive macro andTagtrait. -
feat: add
tagsparameter forcontrollerandhandlerattribute macros. -
feat: comments on
handler,ToSchema,ToParameterattribute macros can be parsed asdescriptions in OpenAPI. -
feat: add support for
Redoc,Scalar, andOpenAPI Explorer. -
feat: add
openapi_security_requirementsandopenapi_security_schemesfunctions toHookstrait. -
feat: add
SecuritySchemederive macro andSecuritySchemetrait. -
feat: add
securityparameter forcontrollerandhandlerattribute macros. -
feat: parses document comments for
MultiRequestMediaType,MultiResponseMediaType,Multipart, andSingleResponsederive macros into OpenAPI'sdescription. -
feat: add
TypedHeaderextractor. -
feat: add
InvalidContentDispositionstruct. -
feat: add
MaybeHeaderValueenum. -
feat: add
InvalidHeaderValuestruct. -
feat: add
flattenattribute forToParameterandToSchemaderive macros that can be placed on fields. -
feat: add
defaultattribute for fields of struct annotated by derive macro forMultipart,ToSchema,ToParameters. -
feat: the
ToSchemaderive macro can be used onenum. -
feat: the
ToSchemaderive macro can generate schema for nested types. -
feat: add
AnyMapstruct. -
feat: support
WebSocket. -
feat: support
Server-Sent Events. -
fix: doc test failure in
predawn-macrocrate. -
fix: all requests shared a single data sources context.
-
fix: if some field has a
defaultattribute, it will be not required in the OpenAPI schema. -
change: allow the
pathsandmethodsarguments in thehandlerattribute macro to be empty, like this#[handler(paths = [], methods = [])]. -
change: add parameter to the
Download::inlinefunction. -
change: schema for
JosnField<T>is totally same as forT. -
change: move the check for path uniqueness to the
create_appfunction. -
change: clean up
handle_connimplementation. -
change: remove
panic!in the expansion of theSingleResponsederive macro. -
change: wrap errors from serialize and deserialize
queryandformwithserde_path_to_error::Error<...>. -
chore: add default feature
macrotopredawncrate. -
chore: replace
get_providermethod withcontains_providermethod. -
chore: change the methods called when inserting a schema to
Components. -
chore: remove
preserve_orderfeature ofserde_jsondependency. -
chore: change the type of method parameter for internal
Controllertrait. -
chore: change
tokio::fs::readfunction tostd::fs::readfunction. -
chore: add
default-schema-tabproperty to<openapi-explorer>. -
chore: reducing one
clonemethod call. -
chore: remove
once_celldep. -
chore: upgrade
sea-ormdep to 1. -
chore: change the log level from
tracetoinfowhen the server closing. -
chore: update
towerto0.5. -
chore: relax the
ResponseBody::newmethod generic constraint. -
chore: replace part of
BTreeMapwithIndexMapin the internal implementation. -
chore: change the internal implementation.
-
chore: make the code generated by the
controllerattribute macro more readable.
predawn-sea-orm
Add predawn-sea-ormcrate, see example for usage.
0.7.0
- breaking: move
predawn::to_header_value::ToHeaderValuetopredawn::response::ToHeaderValue. - breaking: remove
JsonDataErrorandJsonSyntaxErrorvariants fromReadJsonError, addDeserializeJsonErrorvariant. - breaking: replace all
HashMap<Method, DynHandler>s withIndexMap<Method, DynHandler>s. - feat: add
Multipartreqeust support. - feat: add
Attachmentresponse support. - feat: add
shutdown_signalfunction. - feat: add
DeserializeJsonErrorerror. - fix: change property names in
SchemaofSystemTimeandDuration.
0.6.0
- breaking: change
predawn::extract::{path::Path, query::Query}topredawn::extract::{Path, Query}. - breaking: change
predawn::middleware::{tower_compat::TowerLayerCompatExt, tracing::Tracing}topredawn::middleware::{TowerLayerCompatExt, Tracing}. - breaking: change
predawn::payload::{form::Form, json::Json}topredawn::payload::{Form, Json}. - breaking: change the type of the
middlewareparameter in thecontrollerandhandlerattribute macros fromfn(impl Handler, &mut Context) -> impl Handlertofn(&mut Context, impl Handler) -> impl Handler. - breaking: move
ReadBytesErrorandReadStringErrortopredawn_core::response_errormodule. - breaking: change
ReadBytesError::LengthLimitError(LengthLimitError)toReadBytesError::RequestBodyLimitError(RequestBodyLimitError). - breaking: move
MethodNotAllowedError,MatchError,QueryError,PathError,ReadFormError,WriteFormError,ReadJsonError,WriteJsonErrortopredawn::response_errormodule. - breaking: rename the
gotfield inPathError::WrongNumberOfParameters { got, .. }toactual. - breaking: change the type of the
keyandvaluefields inPathError::ParseErrorAtKey { key, value, .. }fromStringtoArc<str>. - breaking: change the type of the
keyfield inPathError::InvalidUtf8InPathParam { key, .. }fromStringtoArc<str>. - breaking: change type
Vec<&'static str>toBox<[&'static str]>in the return type of theError::downcastmethod. - breaking: change type
Vec<&'static str>toBox<[&'static str]>in generics ofHandlerExt::catch_errormethod. - breaking: change field types in
RapiDocandSwaggerUIstructs fromStringtoArc<str>. - breaking: remove unnacessary
Environment::set_envmethod. - breaking: remove unnacessary
impl FromStr for Environmentimplementation. - breaking: change the type of the
actualfield in theInvalidContentTypestruct fromStringtoBox<str>. - breaking: change the type of the
routesfield in theRouterstruct fromVec<(Box<str>, Vec<Method>)>toVec<(Box<str>, Box<[Method]>)>. - breaking: rename
RequestBodyLimitstruct toBodyLimit. - breaking: rename
predawn_core::request::DEFAULT_REQUEST_BODY_LIMITtopredawn_core::request::DEFAULT_BODY_LIMIT. - feat: add
RequestBodyLimitErrorerror. - feat: add
body_limitfield toHeadstruct. - feat: add
RequestBodyLimitmiddleware. - feat: add
Head::content_lengthmethod. - change: expose all
structs under thepredawn::handlermodule. - change: enhance compatibility with
tower.
0.5.0
- breaking: use AFIT instead of
async_traiton theHandlertrait., reference topoem. - breaking: use AFIT instead of
async_traiton theFromRequesttrait., reference topoem. - breaking: use AFIT instead of
async_traiton theFromRequestHeadtrait., reference topoem. - breaking: split the
FromRequestHeadtrait intoFromRequestHeadtrait andApiRequestHeadtrait. - breaking: split the
FromRequesttrait intoFromRequesttrait andApiRequesttrait. - breaking: split the
IntoResponsetrait intoIntoResponsetrait andApiResponsetrait. - breaking: split the
SingleMediaTypetrait intoSingleMediaTypetrait andMediaTypetrait. - breaking: all
Arc<dyn Handler>types are nowDynHandler. - breaking: change the generic bounds of the
HandlerExt::inspect_errormethod. - breaking: change the generic bounds of the
HandlerExt::catch_errormethod. - breaking: add const generics to
InvalidContentType. - breaking: change
Error::downcastmethod return type fromResult<T, Self>toResult<(Response, T, Vec<&'static str>), Self>. - breaking: change the name of the
Error::source_type_namemethod fromsource_type_nametowrappersand the return type from&'static strto&[&'static str]. - breaking: change the parameter name
status_codetostatusin theMultiResponseMediaTypeattribute macro. - feat: use
rudicrate's new feature to change the constructor methods for typesLoggerConfig,OpenAPIConfig,ServerConfigtoFrom::<&Config>::from. - feat: add
DynHandlerstruct. - feat: add
HandlerExt::with_ifmethod. - feat: add
SingleResponseandMultiResponseattribute macros. - feat: add
define_from_request_erroranddefine_into_response_errordeclarative macros to make it easier to define the error type when using theMultiRequestMediaType,MultiResponseMediaType,MultiResponseattribute macros. - feat: add
ToHeaderValuetrait. - change: in release mode, the
Environment::resolve_from_envmethod returnsEnvironment::Prodif no environment variables are found. - fix: the parameter
statusof theMultiResponseMediaTypeattribute macro shall be optional. - docs: update links.
- docs: change the examples in the
MultiRequestMediaTypeandMultiResponseMediaTypeattribute macros from defining error types manually to defining errors with thedefine_from_request_erroranddefine_into_response_errordeclarative macros. - docs: add a simpler example to
README.md. - chore: simplify
Config::from_foldermethod. - chore: change the parameter types of the
Controller::insert_routesmethod. - chore: change
Tracingmiddleware log format. - chore: use the new
tokiocrate feature to change the use ofArc<Sender>toSender. - chore: add
Sizedbound toResponseErrortrait. - chore: rename
controller/mod.rstocontroller.rs. - chore: simplify trait implementations.
0.4.0
- breaking: remove
Error::downcast_mutmethod. - breaking: rename
Error::as_statusmethod toError::status. - breaking: rename
Error::as_responsemethod toError::response. - breaking: rename
Error::inner_type_namemethod toError::source_type_name. - breaking: change the return type of the
Head::local_addrmethod fromSocketAddrtoLocalAddr. - breaking: change the return type of the
Head::remote_addrmethod fromSocketAddrtoRemoteAddr. - breaking: change the return type of the
Head::original_urimethod from&Urito&OriginalUri. - breaking: remove
predawn_macro::method::Method::connectbecause there is noconnectmethod in theOpenAPI Spec. - feat: add
impl From<(StatusCode, BoxError)> for Errorimplementation. - fix: in the code expanded by the
controllerattribute macro, the last parameter is placed first. - chore: change the style of asynchronous method definitions in the
Hookstrait. - chore: remove
..Default::default()in derive macros. - chore: update dep
reqwestto0.12. - chore: remove unnecessary helper function.
0.3.0
- break: change the type of associated constant
STATUS_CODEofSingleResponsetrait fromStatusCodetou16. - break: upgrade dependency
matchitto0.8, change/:ato/{a}and/*ato/{*a}in all paths. - break: add a
tower-compatfeature to thepredawn::tower_compatmodule, which is not enabled by default. - break: change the type of the fields representing path in each of the
ServerConfigandOpenAPIConfigstructs fromStringtoNormalizedPath. - break: add
cx: &mut Contextparameter toHooks::openapi_infomethod. - break: replace
predawn::openapi::ToParameterswithpredawn::ToParameters. - break: replace
predawn::media_type::MultiRequestMediaTypewithpredawn::MultiRequestMediaType. - break: replace
predawn::media_type::MultiResponseMediaTypewithpredawn::MultiResponseMediaType. - break: replace
predawn::response::MultiResponsewithpredawn::MultiResponse. - break: replace
predawn::response::SingleResponsewithpredawn::SingleResponse. - feat: change visibility of function
app::create_appfrompub(crate)topub. - feat: add
InvalidContentTypestruct,MultiRequestMediaTypeandMultiResponseMediaTypederive macros. - feat: add
Hooks::openapi_serversmethod. - improve: add log when loading config file.
- improve: add error message context for when route insertion fails.
- change: manual implementation of
SerializeandDeserializetraits forNormalizedPath. - chore: replace
::openapiv3withcrate::openapiwherever it appears inpredawn-corecrate. - chore: change
predawn::__internal::predawn_coretopredawnin the code of macro expanded in thepredawn-macrocrate. - chore: upgrade dep
sync_wrapperto1. - chore: remove
workspace = truefrom path dev-dependencies to make it easier to publish.
0.2.0
-
breaking:
change
Hooks::add_middlewares<H: Handler>(router: H, cx: &mut Context) -> impl Handlerto
Hooks::before_run<H: Handler>(cx: Context, router: H) -> (Context, impl Handler). -
breaking: change the type of the
envparameter in theConfig::{load, from_folder}methods fromEnvironmentto&Environment. -
breaking: change the
Hooks::load_configmethod by adding the parameterenv: &Environment. -
breaking: change the
Hooks::create_contextmethod by adding the parameterenv: Environment. -
breaking: change the
Hooks::start_servermethod by changing the order of parameters fromrouter, cxtocx, router. -
feat: add an end-to-end testing struct
TestClient. -
chore: refactor
app::run_appfunction. -
feat: add 4 implementations of the
FromRequestHeadtrait:&OriginalUri,OriginalUri,LocalAddr,RemoteAddr.