From 04dae932bcc07c33f31ca17fca67cdc8859bcaca Mon Sep 17 00:00:00 2001 From: "(AJ) Zin Kyaw" Date: Fri, 15 Dec 2023 13:22:57 +0630 Subject: [PATCH] add dox middleware to annotation (#78) --- packages/dox-annotation/CHANGELOG.md | 4 ++++ packages/dox-annotation/lib/src/core_annotation.dart | 11 ++++++++++- packages/dox-annotation/pubspec.yaml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/dox-annotation/CHANGELOG.md b/packages/dox-annotation/CHANGELOG.md index e022198..253dc27 100644 --- a/packages/dox-annotation/CHANGELOG.md +++ b/packages/dox-annotation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.5-alpha2.0 + +- Add IDoxMiddleware interface + ## 1.0.5-alpha1.9 - Remove auth annotation diff --git a/packages/dox-annotation/lib/src/core_annotation.dart b/packages/dox-annotation/lib/src/core_annotation.dart index c4e1f1c..3ca7b08 100644 --- a/packages/dox-annotation/lib/src/core_annotation.dart +++ b/packages/dox-annotation/lib/src/core_annotation.dart @@ -7,8 +7,12 @@ abstract class IDox { } abstract class IDoxRequest { + late Uri uri; String method = 'GET'; HttpRequest get httpRequest; + ContentType? get contentType; + String getRouteIdentifier(); + dynamic getRouteData(); Map get headers; String? header(String key); void add(String key, dynamic value); @@ -28,7 +32,8 @@ abstract class IDoxRequest { String? referer(); void validate(Map rules, {Map messages = const {}}); - void mapInputs(Map mapper); + void processInputMapper(Map mapper); + Map toJson(); } abstract class IStorageDriver { @@ -62,3 +67,7 @@ abstract class IHttpException { return message.toString(); } } + +abstract class IDoxMiddleware { + dynamic handle(IDoxRequest req); +} diff --git a/packages/dox-annotation/pubspec.yaml b/packages/dox-annotation/pubspec.yaml index 766130f..2b60c8b 100644 --- a/packages/dox-annotation/pubspec.yaml +++ b/packages/dox-annotation/pubspec.yaml @@ -1,6 +1,6 @@ name: dox_annotation description: Dox annotation for dox framework -version: 1.0.5-alpha1.9 +version: 1.0.5-alpha2.0 repository: https://github.com/dartondox/dox homepage: https://dartondox.dev