Specification URLs can be added to custom scalars with the @specifiedBy directive. I tried to add those to our custom scalars Url and Uuid in https://github.com/building-envelope-data/metabase/commit/4b41cf9573521f9cb60b9c117cc057ac047c7af7#diff-261824ef50a05a253c139e223362d953fa719e183552a6f7a95b1202c59f2444R87-R91 by adding types MyUuidType and MyUrlType and using those instead of HotChocolate's default UuidType and UrlType scalars. This fails at the moment because if we use the My... types, then the resulting schema contains four scalars URL, Url, UUID, and Uuid and the upper-case variant is used for fields of type Uri and Guid. I tried adding .BindRuntimeType<Guid, MyUuidType>() and changing the binding behavior of the My... types to implicit without success. A solution may be to set options.DefaultBindingBehavior = BindingBehavior.Implicit to Explicit; with the option, the schema cannot be generated though as is and I don't know why (the resulting errors are somewhat crypted; I suppose it has to do with the order in which types are added).
Specification URLs can be added to custom scalars with the
@specifiedBy
directive. I tried to add those to our custom scalarsUrl
andUuid
in https://github.com/building-envelope-data/metabase/commit/4b41cf9573521f9cb60b9c117cc057ac047c7af7#diff-261824ef50a05a253c139e223362d953fa719e183552a6f7a95b1202c59f2444R87-R91 by adding typesMyUuidType
andMyUrlType
and using those instead of HotChocolate's defaultUuidType
andUrlType
scalars. This fails at the moment because if we use theMy...
types, then the resulting schema contains four scalarsURL
,Url
,UUID
, andUuid
and the upper-case variant is used for fields of typeUri
andGuid
. I tried adding.BindRuntimeType<Guid, MyUuidType>()
and changing the binding behavior of theMy...
types to implicit without success. A solution may be to setoptions.DefaultBindingBehavior = BindingBehavior.Implicit
toExplicit
; with the option, the schema cannot be generated though as is and I don't know why (the resulting errors are somewhat crypted; I suppose it has to do with the order in which types are added).For details on
@specifiedBy
see Custom Scalar Specification URLs.