Skip to content

fix: dont point to 404 in config schema #339

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

Merged
merged 4 commits into from
Apr 15, 2025
Merged
Changes from 2 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
12 changes: 6 additions & 6 deletions crates/pgt_workspace/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ pub fn create_config(
})?;

// we now check if postgrestools is installed inside `node_modules` and if so, we use the schema from there
if VERSION == "0.0.0" {
let schema_path = Path::new("./node_modules/@postgrestools/postgrestools/schema.json");
let options = OpenOptions::default().read(true);
if fs.open_with_options(schema_path, options).is_ok() {
configuration.schema = schema_path.to_str().map(String::from);
}
let node_schema_path = Path::new("./node_modules/@postgrestools/postgrestools/schema.json");
let options = OpenOptions::default().read(true);
if fs.open_with_options(node_schema_path, options).is_ok() {
configuration.schema = node_schema_path.to_str().map(String::from);
} else if VERSION == "0.0.0" {
configuration.schema = Some("https://pgtools.dev/schemas/latest/schema.json".to_string());
} else {
configuration.schema = Some(format!("https://pgtools.dev/schemas/{VERSION}/schema.json"));
}
Expand Down
Loading