Skip to content
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

媒体类型版本控制 #1

Open
Guo-Zhang opened this issue May 31, 2023 · 0 comments
Open

媒体类型版本控制 #1

Guo-Zhang opened this issue May 31, 2023 · 0 comments

Comments

@Guo-Zhang
Copy link
Member

微软云的最佳实践建议:

  1. 自定义媒体资源类型,即Content-Type请求头。
  2. 在此基础上,在Accept请求头规范资源(xxxx)、版本(如v1)、格式(如JSON)。

详情见:https://learn.microsoft.com/zh-cn/azure/architecture/best-practices/api-design#media-type-versioning

我的进一步想法:

  1. 通过本工程规范和其他工程规范定义一系列量潮全局试用的媒体类型,并且允许各个微服务自定义媒体资源类型,比如qtclass-course
  2. 版本号可以支持整数和语义化两种,以适应我们的实际需求。
  3. IBM、Red Het的REST规范都可以参考;Google等其他大厂的最佳文档还没有查,都可以广泛学习。

工程实现:

  • drf-versioned-schemas库实现的实际上就是这个功能,感觉可以重命名为drf-versioned-mime并增加微软建议的实践。

参考资料:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant