feat(sample-gen): yaml sample generation (#6858)
* feat(sample-gen): yaml sample generation if content / media type matches yaml or yml it will generate stringified sample like for json in addition to that it will generate yaml out of the json sample Signed-off-by: mathis-m <mathis.michel@outlook.de> * test(unit-jest): getSampleSchema should handle yaml
This commit is contained in:
@@ -1581,6 +1581,22 @@ describe("utils", () => {
|
||||
const actual = JSON.parse(res)
|
||||
expect(actual.test).toEqual(123)
|
||||
})
|
||||
|
||||
it("should return yaml example if yaml is contained in the content-type", () => {
|
||||
const res = getSampleSchema({
|
||||
type: "object",
|
||||
}, "text/yaml", {}, {test: 123})
|
||||
|
||||
expect(res).toEqual("test: 123")
|
||||
})
|
||||
|
||||
it("should return yaml example if yml is contained in the content-type", () => {
|
||||
const res = getSampleSchema({
|
||||
type: "object",
|
||||
}, "text/yml", {}, {test: 123})
|
||||
|
||||
expect(res).toEqual("test: 123")
|
||||
})
|
||||
})
|
||||
|
||||
describe("paramToIdentifier", () => {
|
||||
|
||||
Reference in New Issue
Block a user