Skip to content

Commit f50bbec

Browse files
alanystshockey
authored andcommitted
improve: error message when rendering XML example (via #5253)
The original message gave no clues as to the underlying cause, which is that the element name needs to be specified explicitly (using xml/name) if it can't be determined from a $ref.
1 parent 98610f8 commit f50bbec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ export const getSampleSchema = (schema, contentType="", config={}) => {
632632
let match = schema.$$ref.match(/\S*\/(\S+)$/)
633633
schema.xml.name = match[1]
634634
} else if (schema.type || schema.items || schema.properties || schema.additionalProperties) {
635-
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- XML example cannot be generated -->"
635+
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- XML example cannot be generated; root element name is undefined -->"
636636
} else {
637637
return null
638638
}
@@ -842,4 +842,4 @@ export function paramToValue(param, paramValues) {
842842
.filter(value => value !== undefined)
843843

844844
return values[0]
845-
}
845+
}

0 commit comments

Comments
 (0)