Not possible to have an upload to be optional, is it a bug? #1023
-
When I test the upload feature, it seems like an upload field is not optional. For example, import { CollectionConfig } from "payload/types";
const Test:CollectionConfig = {
slug: 'tests',
fields: [
{
name: 'metaCoverImage',
label: 'Cover Image',
type: 'upload',
relationTo: 'media',
required: true,
},
{
name: 'metaCustomOgImage',
label: 'Custom OG Image (front-end will fallback to cover image if not presented)',
type: 'upload',
relationTo: 'media',
},
]
}
export default Test; The second upload field should be optional, however, it raises an exception when no upload is presented. Is this a design decision or a bug? If it is a design decision, then is there a way to have an optional upload? |
Beta Was this translation helpful? Give feedback.
Answered by
DanRibbens
Aug 30, 2022
Replies: 1 comment 2 replies
-
Hey @hunghvu, it looks like a regression from the changes we made to futher validate upload and relationships. I'll get a fix out soon! |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
hunghvu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @hunghvu, it looks like a regression from the changes we made to futher validate upload and relationships. I'll get a fix out soon!