Skip to content

No error when missing type with upsert #1019

@arthur-fontaine

Description

@arthur-fontaine
import Papr, { schema, types } from "papr";

const papr = new Papr();

const companySchema = schema({
	name: types.string({ required: true }),
	website: types.string({ required: true }),
});

const companyModel = papr.model("companies", companySchema);

await companyModel.upsert(
	{
		website: "example.com",
	},
	{
		$set: {},
		$setOnInsert: {},
	},
);

I expect Papr to tell me "hey, in case I need to insert the data, you didn't specify all the properties of a company".

Currently behavior

There is no such error. Every field is considered as optional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions