-
-
Notifications
You must be signed in to change notification settings - Fork 744
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
Custom Scalar Support #433
Comments
Hi Scott, I will have a look at that sometime tonight. |
OK, got it already. This is a design flaw actually since we bundled the extended scalar types with the core scalar types. The core scalar types are the ones that are defined by the spec and cannot be changed. So, we will fix with the next version 0.7.0 which should arrive beginning of January. I will add this item to the 0.7.0 backlog. We will make a preview build that includes this fix an notify you once it is ready. |
Awesome thanks Michael for the quick response! |
Hi Scott @scottrabara, I will leave this issue open and close it once the fix is included in a preview build. |
We also have a slack channel for questions etc ... |
Hey Scott, I will move this one to Version 0.8.0. In version 0.8.0 we have a lot of schema enhancements and I think this is a better fit for that release. 0.7.0 is more about middleware, execution engine and co. |
The scalar types are registered by the The factory has two functions that preregister scalar types ( All types that are preregistered by the SchemaContextFactory cannot be changed. This behavior is correct since we do not want people to meddle with the spec scalars or the introspection types. What is wrong is to register the extended scalars here. So my suggestion is to remove the With that users of the API could register the package with one line of code and use HC like before or the could register just some of those types by manually registering them. Tests
Changelog
Documentation
|
@michaelstaib Documentation and changelog have been updated, please see PR's referencing this issue above. |
@scottrabara I will close this one since everything is implemented. |
Hi, I've been using the HotChocolate library for some time now and am getting around to trying out custom scalar types. When a scalar type is given a unique name such as "CustomLong", it can be registered just fine and used within my other types as input/output.
Via your documentation, it mentions the ability to swap out the built-in base Scalar types. I have tried to swap out your guys' long scalar type to be able to add my own custom behavior, but have not been able to do so. Defining my
CustomLongType
like such:This seems to fail to register the type correctly in TypeRegistry as the _namedTypes dictionary will pull back the built-in ScalarType for long
{HotChocolate.Types.LongType}
Should there be something here to check for IsScalarType to swap with?
Is there a better way to do such swapping? Is this type of swap allowed? Let me know if I am doing something completely wrong!
The text was updated successfully, but these errors were encountered: