Replies: 1 comment 1 reply
-
|
Have you tried adding a scalar implementation for MonetaryAmount?
https://netflix.github.io/dgs/scalars/
This should specify how you want the scalar to be serialized/deserialized.
…On Sat, Nov 19, 2022 at 2:40 PM ZMobile ***@***.***> wrote:
When I query fields from this object with MonetaryAmount as a custom
scalar:
type PricingDetails {
id: ID!
creationTimestamp: LocalDateTime!
modifiedTimestamp: LocalDateTime!
isPricedByOrderType: Boolean!
unifiedListPrice: MonetaryAmount
deliveryListPrice: MonetaryAmount
pickupListPrice: MonetaryAmount
overTheCounterListPrice: MonetaryAmount
}
scalar MonetaryAmount
This is what I get as an http response:
"pricingDetails":{
"isPricedByOrderType":false,
"unifiedListPrice":"{"amount":0,"currency":"USD"}",
"deliveryListPrice":"{"amount":0,"currency":"USD"}",
"pickupListPrice":"{"amount":0,"currency":"USD"}",
"overTheCounterListPrice":"{"amount":0,"currency":"USD"}"
}
I'm not sure why its passing my custom scalars as strings. Is there a way
to disable this? It passes the correct object, just surrounded by an extra
set of quotation marks. I feel like there must be some "pass custom scalars
as string" configuration you can turn off.
—
Reply to this email directly, view it on GitHub
<#1323>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ5JPXIHC67EXTJUXXLAP7LWJFJMPANCNFSM6AAAAAASFQ6MBI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I query fields from this object with MonetaryAmount as a custom scalar:
type PricingDetails {
id: ID!
creationTimestamp: LocalDateTime!
modifiedTimestamp: LocalDateTime!
isPricedByOrderType: Boolean!
unifiedListPrice: MonetaryAmount
deliveryListPrice: MonetaryAmount
pickupListPrice: MonetaryAmount
overTheCounterListPrice: MonetaryAmount
}
scalar MonetaryAmount
This is what I get as an http response:
"pricingDetails":{
"isPricedByOrderType":false,
"unifiedListPrice":"{"amount":0,"currency":"USD"}",
"deliveryListPrice":"{"amount":0,"currency":"USD"}",
"pickupListPrice":"{"amount":0,"currency":"USD"}",
"overTheCounterListPrice":"{"amount":0,"currency":"USD"}"
}
I'm not sure why its passing my custom scalars as strings. Is there a way to disable this? It passes the correct object, just surrounded by an extra set of quotation marks. I feel like there must be some "pass custom scalars as string" configuration you can turn off.
Beta Was this translation helpful? Give feedback.
All reactions