Replies: 9 comments 3 replies
-
That's True. To support multiple serialization methods, it may require the user to define their own handlers. Currently, it works fine for most of the use cases. The interface may look like: handler = HTTP_body_handler(
content_type='application/json',
serialize=json.dumps,
deserialize=json.loads
)
# global default handler
api = SpecTree(handler=handler)
# endpoint handler
@api.validate(handler=handler) |
Beta Was this translation helpful? Give feedback.
-
I had some thought about these issues, while making changes for #100. I'm jotting them down.
class BaseHandler:
def serialize(self, **kwargs):
...
def deserialize(self, **kwargs):
...
c.f.: https://docs.github.com/en/free-pro-team@latest/rest/overview/media-types |
Beta Was this translation helpful? Give feedback.
-
I think we can standardize all these keywords now.
Singular or Plural?
For the handlers, users may have multiple kind of content types. For example, For the breaking changes, we can add use semantic versioning. Old keywords will be warned in |
Beta Was this translation helpful? Give feedback.
-
All of them seem good to me.
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I understand that these changes require more thought and lots of breaking changes but is there a timeline for these changes? thanks |
Beta Was this translation helpful? Give feedback.
-
@ula Actually, there is no timeline for this. I'm too busy these days. BTW, I will try to avoid the breaking by making the default behavior acts as it is now. I don't have a very clean solution now. Feel free to comment here if you have any suggestions. |
Beta Was this translation helpful? Give feedback.
-
Any updates about it? |
Beta Was this translation helpful? Give feedback.
-
Same here - I'm trying to consume raw XML body from the request. Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
To keep the interface clean and flexible, it's better to pass the plugin class instead of backend framework name strings. Also, the sync/async flag should be written to the plugin class as described in https://github.com/0b01001001/spectree/pull/46/files#diff-485ad20a22f45089777317b26137dc90R13-R15
Since the body can be serialized in multiple ways, like JSON, MessagePack, ProtoBuf, etc. Although JSON should be the most common way to do so, it's better to support other methods.
Beta Was this translation helpful? Give feedback.
All reactions