Skip to content

Typecasting failed: No typecaster defined for Object. #104

@alonrbar

Description

@alonrbar

Hi,

After upgrading from v5.0.0 to v5.1.0 I'm experiencing an issue with this schema definition:

const definition = {    
    "userId": {
        "type": String,
        "required": true
    },
    "userIdType": {
        "type": String,
        "required": true,
        "enum": [
            "UserId",
            "GroupId",
            "UserEmail"
        ]
    }
}

When validating a valid object I get "Typecasting failed: No typecaster defined for Object.".

In v5.1.0 when I inspect the created schema object I see this under schema.props (notice the "_type: Object" in "userId"):

{
    "userId": { 
        _type: Object,
       /// rest omitted...
    },
    "userId.required": { 
        _type: null,
       ///  rest omitted...
    }
    "userId.type": { 
        _type: String,
       ///  rest omitted...
    },
    "userIdType": { 
        _type: String,
       ///  rest omitted...
    }
}

In v5.0.0 when I inspect the created schema object I see this under schema.props (notice the "_type: null" in "userId"):

{
    "userId": { 
        _type: null,
       /// rest omitted...
    },
    "userId.required": { 
        _type: null,
       ///  rest omitted...
    }
    "userId.type": { 
        _type: String,
       ///  rest omitted...
    },
    "userIdType": { 
        _type: String,
       ///  rest omitted...
    }
}

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions