InterSystems 最佳实践系列之--从持久类和序列类生成 Swagger 规范
最近,我需要从持久类和序列类生成一个 Swagger 规范,所以我发布了我的代码(它并不完整 - 你仍然需要处理应用程序的细节,但这是一个开始)。 代码在这里。
假设你有下面的类:
类
你可以通过以下代码自动生成此 Swagger 定义:
REST.Test.Person:
type: "object"
properties:
Age:
type: "integer"
DOB:
type: "string"
FavoriteColors:
type: "array"
items:
type: "string"
FavoriteNumbers:
type: "object"
Home:
$ref: "#/definitions/REST.Test.Address"
Name:
type: "string"
Office:
$ref: "#/definitions/REST.Test.Address"
SSN:
type: "string"
Spouse:
$ref: "#/definitions/REST.Test.Person"
REST.Test.Address:
type: "object"
properties:
City:
type: "string"
State:
type: "string"
Street:
type: "string"
Zip:
type: "string"
主方法:Utils.YAML:GenerateClasses
测试运行:do ##class(Utils.YAML).Test()
查看原帖 由 @Eduard Lebedyuk 撰写