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: update server version endpoint with optional python version #23

Merged
merged 4 commits into from
Jan 19, 2024

Conversation

hanadi92
Copy link
Contributor

As mentioned in the docs of admin api, the python_version is no longer part of the response since 1.94.0.

  • Updated docs link
  • Made python_version optional
  • Added tests

Signed off: @hanadi92

@hanadi92 hanadi92 force-pushed the update-server-version-api branch 2 times, most recently from 5d0bb7c to deb14a8 Compare January 19, 2024 17:49
Signed-off-by: Hanadi92 <hanadi.tamimi@gmail.com>
@hanadi92 hanadi92 force-pushed the update-server-version-api branch from deb14a8 to bf5954b Compare January 19, 2024 18:40
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Could you update the CHANGELOG.md too, please?

src/version/get_server_version/v1.rs Outdated Show resolved Hide resolved
@@ -33,7 +37,51 @@ impl Request {

impl Response {
/// Creates a `Response` with the given Synapse and Python versions.
pub fn new(server_version: String, python_version: String) -> Self {
pub fn new(server_version: String, python_version: Option<String>) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just remove the python_version parameter instead? I don't think a Rust server implementation usually has a reason to set this field, and it can still be set to Some via direct field access after creating the response with Response::new.

It's a breaking change either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like this?

    pub fn new(server_version: String) -> Self {
        Self { server_version, python_version: None }
    }

Or completely removing the python_version from the Response struct (which would break old versions no?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I mean exactly what you put in the code snippet. Removing the fields wouldn't break clients that deserialize this response and only check the synapse version field, but I think it's slightly more useful to keep the field, but remove it from the constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅ Thank you so much for your review!

hanadi92 and others added 3 commits January 19, 2024 21:43
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Signed-off-by: Hanadi92 <hanadi.tamimi@gmail.com>
Signed-off-by: Hanadi92 <hanadi.tamimi@gmail.com>
@jplatte jplatte merged commit 0ae7a51 into ruma:main Jan 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants