Skip to content

Commit

Permalink
Report all resolver errors at once
Browse files Browse the repository at this point in the history
Reviewed By: alunyov

Differential Revision: D48242105

fbshipit-source-id: 6efbdccad64916e52549c46064510514214733e0
  • Loading branch information
captbaritone authored and facebook-github-bot committed Aug 22, 2023
1 parent 4b9cfb1 commit 7a486fd
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use common::DiagnosticsResult;
use docblock_syntax::DocblockAST;
use errors::try_all;
use fnv::FnvHashMap;
use graphql_syntax::ExecutableDefinition;
use relay_docblock::extend_schema_with_resolver_type_system_definition;
Expand Down Expand Up @@ -62,25 +63,27 @@ fn extend_schema_with_fields<'a>(
project_config: &ProjectConfig,
field_asts_and_definitions: FieldAstsAndDefinitions<'a>,
) -> DiagnosticsResult<()> {
let mut field_definitions = vec![];
for (asts, definitions) in field_asts_and_definitions.0 {
field_definitions.extend(build_schema_documents_from_docblocks(
&asts,
project_config,
schema,
definitions,
)?);
}

for schema_document in field_definitions {
for definition in schema_document.definitions {
extend_schema_with_resolver_type_system_definition(
definition,
schema,
schema_document.location,
)?;
}
}
let field_definitions = try_all(field_asts_and_definitions.0.into_iter().map(
|(asts, definitions)| {
build_schema_documents_from_docblocks(&asts, project_config, schema, definitions)
},
))?;

try_all(
field_definitions
.into_iter()
.flatten()
.map::<DiagnosticsResult<()>, _>(|schema_document| {
for definition in schema_document.definitions {
extend_schema_with_resolver_type_system_definition(
definition,
schema,
schema_document.location,
)?;
}
Ok(())
}),
)?;

Ok(())
}
Expand Down

0 comments on commit 7a486fd

Please sign in to comment.