Hotchocolate: Cannot resolve output-type `System.DateTime`

Created on 24 Jan 2019  ·  6Comments  ·  Source: ChilliCream/hotchocolate

Describe the bug
there looks to be a regression with 0.7.0 (alpha.34) after upgrading from 0.6.11.

To Reproduce
we get the following error

HotChocolate.SchemaException: 'testGraphQuery.date: Cannot resolve output-type `System.DateTime` - Type: TestGraphQuery'

with registering this simple type (c.RegisterQueryType<TestGraphQuery>())

public class TestGraphQuery
    {
        public string Version { get; set; } = "0.0.1-alpha.1";
        public DateTime Date { get; set; } = DateTime.Now;
    }

Expected behavior
with 0.6.11 we get a Date GraphType

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 0.7.0 (alpha 34)
❓ question 📚 documentation

All 6 comments

Hi Daniel,

There were some changes done for #433 made to address custom extended scalars. Since then, the stock built-in extended scalars must now be explicitly registered during schema configuration if you do not intend to override them:

var schema = Schema.Create(c =>
{
    // Register all 6 pre-built extended scalar types
    c.RegisterExtendedScalarTypes();
});

or

var schema = Schema.Create(c =>
{
    // Register only pre-built date time type
    c.RegisterType<DateTimeType>();
});

Perhaps I can add a migration section in the Scalar Type Support documentation to make light of this situation @michaelstaib

oh good to know. thanks!

Hey @scottrabara, that is a good point ...

but let's create a separate section and put all migration steps there since we have another breaking change with the DataLoader.

@OneCyrus thanks for reporting this one

Was this page helpful?
0 / 5 - 0 ratings