New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(psl-core): implement parse_configuration_multi_file
to correct prisma/prisma
's getConfig
implementation
#4825
Conversation
… TypeScript's "getConfig" function
prisma/prisma
's getConfig
implementationparse_configuration_multi_file
to correct prisma/prisma
's getConfig
implementation
let asts = Files::new(files, &mut diagnostics); | ||
|
||
for (_, _, _, ast) in asts.iter() { | ||
let out = validate_configuration(ast, &mut diagnostics, connectors); | ||
configuration.extend(out); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I purposedly avoided creating a ParserDatabase
instance here, as it performs additional validations that are not retro-compatible with parse_configuration
, used in prisma_fmt::get_config
.
WASM Query Engine file Size
|
CodSpeed Performance ReportMerging #4825 will not alter performanceComparing Summary
|
Using
Before this PR, the output was:
With this PR, the output is:
|
I confirm that applying these changes to |
✅ WASM query-engine performance won't change substantially (1.014x)Full benchmark report
After changes in 48f2d45 |
} | ||
|
||
/// Iterate all parsed files. | ||
#[allow(clippy::should_implement_trait)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not implement trait instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of
`impl Trait` in associated types is unstable
see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
which appears when trying to write e.g.
impl std::iter::IntoIterator for Files {
type Item = (FileId, String, schema_ast::SourceFile, ast::SchemaAst);
type IntoIter = impl Iterator<Item = (FileId, String, schema_ast::SourceFile, ast::SchemaAst)>;
fn into_iter(self) -> Self::IntoIter {
self.0
.into_iter()
.enumerate()
.map(|(idx, (path, contents, ast))| (FileId(idx as u32), path, contents, ast))
}
}
Also, iter
and into_iter
were previously defined like this by Tom, and I'd assume the reason he didn't implement the traits is the same one as mine. Do you have any explicit recommendation to work around this, or is it ok to leave the clippy warning suppressors as committed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, i see. LGTM with no comments then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. with one caveat: Files
should probably implement Iter
and IntoInter
like clippy suggests, rather than disabling the lint
This PR closes https://github.com/prisma/team-orm/issues/1103.
This PR changes the implementation of
prisma_fmt::get_config
, to actually support multiple schema files without validating them entirely. This fixes a non-retrocompatible regression introduced in #4787 and discovered in prisma/prisma#23824 (specifically, in DbPull.test.ts)./integration