-
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
expose procedures as part of the schema endpoint #198
Conversation
@@ -145,6 +145,7 @@ pub async fn get_schema( | |||
.native_queries | |||
.0 | |||
.iter() | |||
.filter(|(_, info)| !info.is_procedure) |
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.
don't include procedures in the collections list
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 use Iterator::partition
to filter the native queries once.
.native_queries | ||
.0 | ||
.iter() | ||
.filter(|(_, info)| info.is_procedure) |
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.
only include procedures in the procedures list.
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.
Nice!
#[serde(skip_serializing_if = "std::ops::Not::not")] | ||
#[serde(default)] |
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.
Versioning considerations:
- Backwards compatible config (Old configurations work on new server versions. Esp,
is_procedure
is not a mandatory field) ✅ - Forwards compatible config (New configurations work on older server versions) (OK if they don't use any procedures. Procedures present in the config will be fail to deserialize, IIUC) ✔️
I don't think this is an issue just now. I'm mostly writing this comment to practise being dilligent wrt versioning.
pub arguments: BTreeMap<String, ColumnInfo>, | ||
#[serde(default)] | ||
pub description: Option<String>, | ||
/// Is this native query a procedure |
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.
/// Is this native query a procedure | |
/// True if this native query mutates the database |
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.
applied in df97239
What
We want to expose the native query procedures we defined in #189 on the
/schema/
endpoint asprocedures
and notcollections
.How
isProcedure
field to native queries in thedeployment.json
configuration file which specifies whether they are procedures or not (defaultfalse
that is skipped serialization so we maintain backwards compat).is_procedure
in theprocedures
list and not thecollections
list.