-
-
Notifications
You must be signed in to change notification settings - Fork 76
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init spectree with plugin instead of name, use body
instead of json
#53
Comments
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) |
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 |
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 |
All of them seem good to me.
|
|
I understand that these changes require more thought and lots of breaking changes but is there a timeline for these changes? thanks |
@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. |
body
instead of json
body
instead of json
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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.
The text was updated successfully, but these errors were encountered: