Hace poco, tuve que generar una especificación en Swagger a partir de clases persistentes y en serie, así que ahora publico el código (no está completo, aún queda resolver las especificaciones de la aplicación, pero es un comienzo).
El código está disponible aquí.
Supongamos que tenemos estas clases:
Clases
Se puede generar automáticamente esta definición de Swagger a partir de ellas:
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"
Método principal: Utils.YAML:GenerateClasses
Prueba de ejecución: do ##class(Utils.YAML).Test()