Skip to content

type: { type: "" } not handled #49

@Cheyenne55

Description

@Cheyenne55

Hi there,

Just found a bug. For instance if having a schema like this :

{
  address: {
    type: { type: String },
    postalCode: String
  }
}

Your lib outputs :

{
  address: {
    type: String
  }
}

All properties are lost.

I fixed it by modifying 2 places :

if (type.type != null) {

if (type.type != null) {
if (type.type != null && !type.type?.type) {

const subSchema = value.type ? value.type : value;

const subSchema = value.type ? value.type : value;
const subSchema = value.type && !value.type?.type ? value.type : value;

I can open a PR if you want.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions