-
Notifications
You must be signed in to change notification settings - Fork 1
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
Rename schema fields and add a jsonschema generation and ref on init #361
Conversation
@@ -2813,7 +2816,7 @@ | |||
"operatorKind": "custom" | |||
} | |||
], | |||
"mutationsVersion": null, | |||
"mutationsVersion": "v1", |
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.
Should mutationsVersion change to "v1"?
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 like this a lot.
@@ -14,6 +14,7 @@ use crate::values::{ConnectionUri, IsolationLevel, PoolSettings, Secret}; | |||
use crate::version3; | |||
|
|||
pub const CONFIGURATION_FILENAME: &str = "configuration.json"; | |||
pub const CONFIGURATION_JSONSCHEMA_FILENAME: &str = "schema.jsonschema"; |
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.
Did some reading and apparently schema.json
and blahblah.schema.json
are more common.
pub const CONFIGURATION_JSONSCHEMA_FILENAME: &str = "schema.jsonschema"; | |
pub const CONFIGURATION_JSONSCHEMA_FILENAME: &str = "schema.json"; |
pool_settings: configuration.pool_settings, | ||
pool_settings: configuration.connection_settings.pool_settings, | ||
connection_uri, | ||
isolation_level: configuration.isolation_level, | ||
mutations_version: configuration.configure_options.mutations_version, | ||
isolation_level: configuration.connection_settings.isolation_level, | ||
mutations_version: configuration.mutations_version, |
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.
Perhaps it's worth just storing connection_settings
directly in the Configuration
.
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.
Thought about it, but didn't want to make too many changes, and wasn't sure about whether we should use version3 structure here. Maybe we can decide in a separate PR since this is internal to the connector?
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.
In general I do agree that that's a better structure though.
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.
Looks good to me.
With this PR the configuration fields are better grouped according to their usage.
IMO only metadata.nativeQueries
stands out a bit, since it's authored by users while the rest of the metadata
object is generated. Whether we should do anything about that or not is a separate issue.
static/schema.jsonschema
Outdated
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.
What generates this file?
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.
It was a manual copy paste tbh. Maybe we can decide later how to handle this for local dev?
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.
If the only purpose is to have something for the $schema field to reference I would be fine with just eliding the file
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.
That is, the schema field in the test-configurations
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.
Yes that's exactly it's use.
What
This PR does the following:
configureOptions
->introspectionOptions
mutationsVersion
moved fromconfigureOptions
to the top-levelReadonlyColumnInfo
type instead ofColumnInfo
type for arguments and column. ReadonlyColumnInfo does not contain default, identity and generated information which we don't want to appear in autocomplete for native queries.schema.jsonschema
file on cliinitialize
command next to theconfiguration.json
file$schema
field to the configuration, referencing the generatedschema.jsonschema
file.The purpose of (2) and (3) is to provide auto-complete features when editing the configuration in vscode (demo soon).