这是indexloc提供的服务,不要输入任何密码
Skip to content

customError - invalid_value - narrowing down "inst" #5435

@akomm

Description

@akomm

I want to globally modify an error message via z.config for z.file().mime("text/plain").
But the issue provided at customError only provides this information:

Image

I see no way to narrow down to any of the internals like $ZodCheckMimeType and I don't think it would be a good idea either.
Neither is checking against the input string with the "actual" mime-types viable approach.

I'm a bit surprised, that input is not just File in that case.

Other codes can be easily narrowed: invalid_type via expected and when the type is valid, then input is typically the value provided. Not sure, why here it is suddenly converted to the mime-types that are expected, instead of leaving input the (at this point) valid_type - File - and provide information like expected and actual separately.

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