Mic*_*app 5 yaml jackson swagger openapi
在 swagger (3.0) 定义 YAML 中,如果我有一个带有字符串属性的架构并添加自定义示例值,则特殊字符(如<、 和)在浏览时会显示“错误”,例如变为。>&<<
我尝试使用\x3c而不是<, 或使用!!str前缀,但没有帮助。
在本例中,响应是“application/xml”,因此这可能是一个问题,但是在属性名称中,小于号完美地显示(见下文)。
一些特殊字符可以正常工作,例如&.
info:
title: poc
servers:
- url: /poc/api
variables: {}
paths:
/ex2:
get:
tags:
- example
summary: debugging schema with example value contains < or >
description:
operationId: example
responses:
200:
description:
content:
application/xml;charset=UTF-8:
schema:
$ref: '#/components/schemas/Wrapper'
components:
schemas:
Entry:
type: object
properties:
name:
type: string
value:
type: number
Wrapper:
type: object
properties:
entry:
type: object
$ref: '#/components/schemas/Entry'
customfield:
type: string
example: "<hello\x3c"
custom<>field:
type: string
example: "why"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2926 次 |
| 最近记录: |