feathers-plus / generator-feathers-plus

A Yeoman generator to (re)generate a FeathersJS application supporting both REST and GraphQL architectural concepts and their query languages.

Home Page:https://generator.feathers-plus.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generator adds extra type to JSON schema property when using oneOf keyword

brane53 opened this issue · comments

Summary

I have a JSON schema with a property notes that uses the oneOf keyword to allow more than one type. In my case string and null.

// *.schema.ts

notes: {
      oneOf: [{ type: 'string' }, { type: 'null' }]
},

Now, when I regenerate the service, the schema that gets generated in the *.validate.ts file has an extra type property as a sibling to oneOf.

// *.validate.ts

notes: {
    oneOf: [
        {
            type: 'string'
        },
        {
            type: 'null'
        }
    ],
    type: 'string'
},

This extra property is causing the validation to throw an error when the notes property is set to null on the incoming data. When I remove the extra type I can pass null as the value no problem.

Steps to reproduce

Just see the example above

Expected behavior

The extra type property should not be there

Actual behavior

The extra type property is being added and appears to be overriding oneOf

System configuration

@feathers-plus/cli 0.8.10
Node 10.15.0
Windows 10