如何让降价在 Swagger 模型描述中工作?
How do I get markdown to work in Swagger model descriptions?
我正在尝试向 Swagger 中的模型项添加额外信息。文档说 GFM 语法可以在描述字段中使用,但这并不是在所有地方都有效。
这是问题的最小虚拟示例:
swagger: '2.0'
info:
title: Example API
description: (1) This is the API description containing some *rich* **text**
version: "1.0.0"
paths:
/products:
get:
summary: Product Types
description: (2) This is the path description also containing some *rich* **text**
responses:
200:
description: (3) This is a response description also containing some *rich* **text**
schema:
type: array
items:
$ref: '#/definitions/Product'
definitions:
Product:
description: (4) This is a model description where *rich* **text** does not work
type: object
properties:
product_id:
type: string
description: (5) This is a field description where *rich* **text** does not work
schema object documentation 说我应该可以在上面标记为 (4) 的地方使用 Markdown,但没有说任何有关 (5) 的地方。
我想将 Markdown 添加到模型部分的两个位置中的任何一个。我怎样才能让它工作?
Swagger Editor 不支持模型描述中的 Markdown。来自 https://github.com/swagger-api/swagger-editor/issues/682:
For rendering JSON Schema object we are using json-schema-view-js lib which does not support Markdown. Swagger Editor can not change behavior of this lib and this behavior is not something common to add to the lib.
如果您需要此功能,您可以分叉 swagger-editor and/or json-schema-view-js 并自己实现 feature/fix,然后提交拉取请求。
我正在尝试向 Swagger 中的模型项添加额外信息。文档说 GFM 语法可以在描述字段中使用,但这并不是在所有地方都有效。
这是问题的最小虚拟示例:
swagger: '2.0'
info:
title: Example API
description: (1) This is the API description containing some *rich* **text**
version: "1.0.0"
paths:
/products:
get:
summary: Product Types
description: (2) This is the path description also containing some *rich* **text**
responses:
200:
description: (3) This is a response description also containing some *rich* **text**
schema:
type: array
items:
$ref: '#/definitions/Product'
definitions:
Product:
description: (4) This is a model description where *rich* **text** does not work
type: object
properties:
product_id:
type: string
description: (5) This is a field description where *rich* **text** does not work
schema object documentation 说我应该可以在上面标记为 (4) 的地方使用 Markdown,但没有说任何有关 (5) 的地方。
我想将 Markdown 添加到模型部分的两个位置中的任何一个。我怎样才能让它工作?
Swagger Editor 不支持模型描述中的 Markdown。来自 https://github.com/swagger-api/swagger-editor/issues/682:
For rendering JSON Schema object we are using json-schema-view-js lib which does not support Markdown. Swagger Editor can not change behavior of this lib and this behavior is not something common to add to the lib.
如果您需要此功能,您可以分叉 swagger-editor and/or json-schema-view-js 并自己实现 feature/fix,然后提交拉取请求。