In swagger (3.0) definition YAML, if I have a schema with a string property
and add a custom example value, special characters like <, >, and & appear "wrong" when browsed, e.g. < becomes <.
I tried to use \x3c instead of <, or use !!str prefix, but doesn't help.
In this case the response is "application/xml", so that is may be a problem, however in the name of a property the less-then sign appears perfectly (see below).
Some special characters works fine, like &.
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"