Skip to content

Commit 9bf96c0

Browse files
committed
feat: make schema files next to model
1 parent 1df7a98 commit 9bf96c0

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

js/packages/quary-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
"package-web": "webpack --config webpack.web.config.js --mode production --devtool hidden-source-map --env STAGE=production",
198198
"package-node": "webpack --config webpack.node.config.js --mode production --devtool hidden-source-map --env STAGE=production",
199199
"lint": "eslint src --ext ts",
200-
"run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ../../../../analytics"
200+
"run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ../../../rust/core/src/init"
201201
},
202202
"devDependencies": {
203203
"@quary/eslint-config-shared": "workspace:*",

rust/wasm-binding/src/rpc_proto_defined_functions.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,19 @@ async fn create_model_schema_entry_internal(
222222
path.push(model.file_path.as_str());
223223
path.pop();
224224

225+
let mut path = PathBuf::from(&project_root);
226+
path.push(model.file_path.as_str());
227+
let file = path.file_stem().ok_or("Failed to get file stem")?;
228+
225229
// Make the schema.yaml file be in there
226-
let mut schema_path = path.clone();
227-
schema_path.push("schema.yaml");
230+
let mut schema_path = PathBuf::from(&project_root);
231+
schema_path.push(model.file_path.as_str());
232+
schema_path.pop();
233+
schema_path.push(format!(
234+
"{}.yaml",
235+
file.to_str()
236+
.ok_or("Failed to convert file stem to string")?
237+
));
228238
let string_schema_path = schema_path
229239
.to_str()
230240
.ok_or("Failed to convert path to string")?
@@ -1943,7 +1953,7 @@ models:
19431953
.unwrap();
19441954

19451955
let binding = written_files.borrow();
1946-
let updated_content = binding.get(&"models/schema.yaml".to_string()).unwrap();
1956+
let updated_content = binding.get(&"models/shifts.yaml".to_string()).unwrap();
19471957

19481958
assert_eq!(
19491959
updated_content,
@@ -1976,11 +1986,7 @@ models:
19761986
"models/schema.yaml".to_string(),
19771987
quary_proto::File {
19781988
name: "models/schema.yaml".to_string(),
1979-
contents: prost::bytes::Bytes::from(
1980-
"
1981-
models:
1982-
",
1983-
),
1989+
contents: prost::bytes::Bytes::from(""),
19841990
},
19851991
),
19861992
]
@@ -1999,7 +2005,7 @@ models:
19992005
.unwrap();
20002006

20012007
let binding = written_files.borrow();
2002-
let updated_content = binding.get(&"models/schema.yaml".to_string()).unwrap();
2008+
let updated_content = binding.get(&"models/shifts.yaml".to_string()).unwrap();
20032009

20042010
assert_eq!(
20052011
updated_content,

0 commit comments

Comments
 (0)