Skip to content
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

fix(fmt): use camel case for new fields #4150

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(fmt): use camel case for new fields
  • Loading branch information
emi0x7d1 committed Aug 18, 2023
commit b3dd7846aba9ddf1107a5579d3063b0fd3ef556b
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions psl/psl-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ diagnostics = { path = "../diagnostics" }
parser-database = { path = "../parser-database" }
prisma-value = { path = "../../libs/prisma-value" }
schema-ast = { path = "../schema-ast" }
convert_case = "0.6.0"

bigdecimal = "0.3"
chrono = { version = "0.4.6", default_features = false }
Expand Down
5 changes: 3 additions & 2 deletions psl/psl-core/src/reformat.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ParserDatabase;
use convert_case::{Case, Casing};
use parser_database::{ast::WithSpan, walkers};
use schema_ast::{ast, SourceFile};
use std::{borrow::Cow, sync::Arc};
Expand Down Expand Up @@ -174,7 +175,7 @@ fn push_missing_relation_fields(inline: walkers::InlineRelationWalker<'_>, ctx:
}

if inline.forward_relation_field().is_none() {
let field_name = inline.referenced_model().name();
let field_name = &inline.referenced_model().name().to_case(Case::Camel);
let field_type = field_name;
let arity = render_arity(forward_relation_field_arity(inline));
let fields_arg = fields_argument(inline);
Expand All @@ -201,7 +202,7 @@ fn push_missing_scalar_fields(inline: walkers::InlineRelationWalker<'_>, ctx: &m
});

for field in missing_scalar_fields {
let field_name = &field.name;
let field_name = field.name.to_case(Case::Camel);
let field_type = if let Some(ft) = field.tpe.as_builtin_scalar() {
ft.as_str()
} else {
Expand Down