我在颤振渡轮 graphql 包中的自定义序列化程序有一点问题:
我完全使用了渡轮文档中的示例: https ://ferrygraphql.com/docs/custom-scalars/#create-a-custom-serializer
但是在运行 builder_runner 时,我总是收到以下消息:
[SEVERE] built_value_generator:built_value on lib/schema.schema.gql.dart:
Error in BuiltValueGenerator for abstract class GDailyForecastInput implements Built<GDailyForecastInput, dynamic>.
Please make the following changes to use BuiltValue:
1. Make field dateStart have non-dynamic type. If you are already specifying a type, please make sure the type is correctly imported.
2. Make field dateEnd have non-dynamic type. If you are already specifying a type, please make sure the type is correctly imported.
[SEVERE] built_value_generator:built_value on lib/schema.schema.gql.dart:
Error in BuiltValueGenerator for abstract class GHourlyForecastInput implements Built<GHourlyForecastInput, dynamic>.
Please make the following changes to use BuiltValue:
1. Make field dateStart have non-dynamic type. If you are already specifying a type, please make sure the type is correctly imported.
2. Make field dateEnd have non-dynamic type. If you are already specifying a type, please make sure the type is correctly imported.
dateStart 和 dateEnd 是 Date 类型的查询输入值 这是我的类型覆盖: type_overrides: Date: name: Date 有人知道为什么会发生此错误吗?我真的无法找出问题所在
日期在我的 schema.graphql 文件中定义为标量:
"""A date string with format `Y-m-d`, e.g. `2011-05-23`."""
scalar Date
这是我的 build.yaml 文件:
targets:
$default:
builders:
gql_build|schema_builder:
enabled: true
options:
type_overrides:
Date:
name: Date
gql_build|ast_builder:
enabled: true
options:
type_overrides:
Date:
name: Date
gql_build|data_builder:
enabled: true
options:
type_overrides:
Date:
name: Date
schema: appdemo|lib/schema.graphql
gql_build|var_builder:
enabled: true
options:
type_overrides:
Date:
name: Date
schema: appdemo|lib/schema.graphql
gql_build|serializer_builder:
enabled: true
options:
schema: appdemo|lib/schema.graphql
custom_serializers:
- import: './serializers/date_serializer.dart'
name: DateSerializer
ferry_generator|req_builder:
enabled: true
options:
type_overrides:
Date:
name: Date
schema: appdemo|lib/schema.graphql
我已经尝试调试了。如果我将我的标量重命名为DateTime
一切正常。DateTime
(我的文件中也有一个标量schema.graphql
。)只有当我使用该名称Date
时,才会收到此错误。
我错过了什么吗?
我是否需要在文档中的代码之外创建一个 dartDate
类并链接它?