我想在我的应用程序中使用多个模式,例如:
- graphql
- api1
schema.graphql
- api2
schema.graphql
我创建了一个示例项目来实现https://github.com/qbait/multiple_schemas 的灵感来自 Github 问题https://github.com/gql-dart/ferry/issues/315
您知道build.yaml
没有正确生成序列化程序有什么问题吗?
targets:
# schema for api 1
$default:
builders:
gql_build|schema_builder:
generate_for:
- lib/graphql/api1/**
enabled: true
gql_build|ast_builder:
generate_for:
- lib/graphql/api1/**
enabled: true
gql_build|data_builder:
generate_for:
- lib/graphql/api1/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api1/schema.graphql
gql_build|var_builder:
generate_for:
- lib/graphql/api1/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api1/schema.graphql
gql_build|serializer_builder:
generate_for:
- lib/graphql/api1/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api1/schema.graphql
ferry_generator|req_builder:
generate_for:
- lib/graphql/api1/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api1/schema.graphql
# override
gql_build:schema_builder:
generate_for:
- lib/graphql/api1/**
built_value_generator:built_value:
generate_for:
- lib/graphql/api1/**
source_gen:combining_builder:
generate_for:
- lib/graphql/api1/**
# schema for api 2
schema_api_two:
builders:
gql_build|schema_builder:
generate_for:
- lib/graphql/api2/**
enabled: true
gql_build|ast_builder:
generate_for:
- lib/graphql/api2/**
enabled: true
gql_build|data_builder:
generate_for:
- lib/graphql/api2/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api2/schema.graphql
gql_build|var_builder:
generate_for:
- lib/graphql/api2/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api2/schema.graphql
gql_build|serializer_builder:
generate_for:
- lib/graphql/api2/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api2/schema.graphql
ferry_generator|req_builder:
generate_for:
- lib/graphql/api2/**
enabled: true
options:
schema: multiple_schemas|lib/graphql/api2/schema.graphql
# override
gql_build:schema_builder:
generate_for:
- lib/graphql/api2/**
built_value_generator:built_value:
generate_for:
- lib/graphql/api2/**
source_gen:combining_builder:
generate_for:
- lib/graphql/api2/**