-
Notifications
You must be signed in to change notification settings - Fork 3
Update to ndc-spec v0.1.5 and ndc-sdk-rs v0.2.1 #86
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very helpful, thanks for all this work!
@@ -69,13 +69,15 @@ impl From<Type> for ndc_models::Type { | |||
// ExtendedJSON can respresent any BSON value, including null, so it is always nullable | |||
Type::ExtendedJSON => ndc_models::Type::Nullable { | |||
underlying_type: Box::new(ndc_models::Type::Named { | |||
name: mongodb_support::EXTENDED_JSON_TYPE_NAME.to_owned(), | |||
name: mongodb_support::EXTENDED_JSON_TYPE_NAME.to_owned().into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for cases like this we might avoid heap allocation with something like,
TypeName(SmolStr::new_static(mongodb_support::EXTENDED_JSON_TYPE_NAME))
That would be a bit easier if the ndc-models newtype
macro added implementations for From SmolStr
or From &'static str
. But it looks like the ref-cast crate helps to fill that gap?
This is absolutely not worth you spending time on making changes. I'm commenting only because I enjoy the allocation golf thought exercises.
@@ -28,7 +28,7 @@ impl AggregationFunction { | |||
all::<AggregationFunction>() | |||
.find(|variant| variant.graphql_name() == s) | |||
.ok_or(QueryPlanError::UnknownAggregateFunction { | |||
aggregate_function: s.to_owned(), | |||
aggregate_function: s.to_owned().into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we should at least add a From &'a str
to newtype
Describe your changes
Update to latest ndc-spec and sdk