Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

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

Closed
brane53 opened this issue Mar 20, 2019 · 0 comments
Closed

Comments

@brane53
Copy link

brane53 commented Mar 20, 2019

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

@daffl daffl closed this as completed Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants