* fix(sample-gen): enum without type should be handled by sample-gen (#6912)

This commit is contained in:
Mahtis Michel
2021-02-11 18:58:28 +01:00
committed by GitHub
parent fad81f8cb9
commit 7ead9baa80
2 changed files with 10 additions and 1 deletions

View File

@@ -29,6 +29,15 @@ describe("sampleFromSchema", () => {
expect(sampleFromSchema(definition, { includeReadOnly: false })).toEqual(expected)
})
it("should return first enum value if only enum is provided", function () {
let definition = fromJS({
enum: ["probe"]
})
let expected = "probe"
expect(sampleFromSchema(definition, { includeReadOnly: false })).toEqual(expected)
})
it("combine first oneOf or anyOf with schema's definitions", function () {
let definition = {
type: "object",