-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: [serializr] this value is not primitive: [object Object], can't figure out what's next #163
Comments
It is likely about the produceVariants field which is not a primitive but
object
…On Sun, 24 Jul 2022, 03:12 Swapnanil Ray, ***@***.***> wrote:
So I have a model which is as such:
`export default class VendorProduce {
@serializable <https://github.com/serializable>(identifier())
public id = uuidv4()
@serializable
public vendorId: string
@serializable
public produceName: string
@serializable
public stockStatus: string
@serializable
public minPrice: string
@serializable
public maxPrice: string
@serializable
public stockCount: string
@serializable
public produceVariants: object
constructor(
vendorId: string,
produceName: string,
stockStatus: string,
minPrice: string,
maxPrice: string,
stockCount: string,
produceVariants: {
variantName: {
days: string,
image: string
}
}
) {
this.vendorId = vendorId
this.produceName = produceName
this.stockStatus = stockStatus
this.minPrice = minPrice
this.maxPrice = maxPrice
this.stockCount = stockCount
this.produceVariants = produceVariants
makeAutoObservable(this)
}
static validationSchema = yup.object().shape({
vendorId: yup.string().required('This field is required'),
produceName: yup.string().required('This field is required'),
stockStatus: yup.string().required('This field is required'),
minPrice: yup.string().required('This field is required'),
maxPrice: yup.string().required('This field is required'),
stockCount: yup.string().required('This field is required'),
produceVariants: yup.object().required('This field is required'),
})
} `
Upon this model getting called during some API Calls I get the following
error:
[image: image]
<https://user-images.githubusercontent.com/67406959/180629293-da4a5f9e-7ac4-4d82-8f00-4e4ae1f401b2.png>
I am new to using Serializr and not being able to understand how to fix
this.
—
Reply to this email directly, view it on GitHub
<#163>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBAKUNSNZYHPRVS5WUDVVSRAVANCNFSM54O4H57A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@mweststrate Hey, thanks for pointing that out! |
An object is not a primitive value. See
https://github.com/mobxjs/serializr#propschema for the available options.
…On Sun, 24 Jul 2022, 09:23 Swapnanil Ray, ***@***.***> wrote:
Can we not use object here?
—
Reply to this email directly, view it on GitHub
<#163 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBDQKS2A7YZHCHLGCJ3VVT4RJANCNFSM54O4H57A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I think this issue can be closed, because the underlying cause and and a documentation link have been provided |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I have a model which is as such:
Upon this model getting called during some API Calls I get the following error:
I am new to using Serializr and not being able to understand how to fix this.
The text was updated successfully, but these errors were encountered: