From 8154a9e43d2ef95fbf08ffe7f2ad3ca10c13d20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 24 Apr 2026 14:52:34 +0200 Subject: [PATCH 1/3] Apply cargo-sort formatting fixes --- Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4e780eb..e477f53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,8 @@ serde_json = "1.0.61" rust_2018_idioms = { level = "warn", priority = -1 } semicolon_in_expressions_from_macros = "warn" unexpected_cfgs = { level = "warn", check-cfg = [ - 'cfg(ruma_unstable_exhaustive_types)', # set all types as exhaustive + # set all types as exhaustive + 'cfg(ruma_unstable_exhaustive_types)', ] } unreachable_pub = "warn" unused_import_braces = "warn" From 9639a3ee48e57065d44fc47207c0e9b68c3307cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 25 Apr 2026 09:47:03 +0200 Subject: [PATCH 2/3] Add rumdl configuration file and apply formatting fixes --- .rumdl.toml | 33 ++++++++++++++++++++++++++++++ CHANGELOG.md | 40 +++++++++++++++++++------------------ CONTRIBUTING.md | 53 ++++++++++++++++++++++++++----------------------- README.md | 3 ++- 4 files changed, 84 insertions(+), 45 deletions(-) create mode 100644 .rumdl.toml diff --git a/.rumdl.toml b/.rumdl.toml new file mode 100644 index 0000000..32bc08f --- /dev/null +++ b/.rumdl.toml @@ -0,0 +1,33 @@ +cache = false + +[per-file-ignores] +"crates/ruma-common/src/doc/*.md" = ["first-line-heading"] +"crates/ruma-client-api/src/doc/*.md" = ["first-line-heading"] +"crates/ruma-events/src/doc/*.md" = ["first-line-heading"] +"crates/ruma-macros/src/doc/*.md" = ["first-line-heading"] + +[code-block-style] +style = "fenced" + +[code-fence-style] +style = "backtick" + +[emphasis-style] +style = "underscore" + +[heading-style] +style = "atx" + +[line-length] +line-length = 100 +code-blocks = false +tables = false + +[ol-prefix] +style = "ordered" + +[strong-style] +style = "asterisk" + +[ul-style] +style = "dash" diff --git a/CHANGELOG.md b/CHANGELOG.md index 60da018..65ddf34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ -# [unreleased] +# Changelog -# 0.9.0 +## [unreleased] + +## 0.9.0 Breaking changes: @@ -8,7 +10,7 @@ Breaking changes: - All endpoints use `SinglePath` rather than `VersionHistory` as `PathBuilder`. - Bump MSRV to 1.88. -# 0.8.0 +## 0.8.0 Breaking changes: @@ -33,32 +35,32 @@ Improvement: - Add room_details api - Add room_members api -# 0.7.0 +## 0.7.0 -* Upgrade to ruma 0.12.0 -* Add room_membership api +- Upgrade to ruma 0.12.0 +- Add room_membership api -# 0.6.0 +## 0.6.0 -* Update v1/server_version endpoint response data with optional python_version key -* Upgrade to ruma 0.9.4 -* Add background updates endpoints +- Update v1/server_version endpoint response data with optional python_version key +- Upgrade to ruma 0.9.4 +- Add background updates endpoints -# 0.5.0 +## 0.5.0 -* Upgrade ruma dependency to 0.7.2 -* Work around a Synapse issue affecting sqlite configurations +- Upgrade ruma dependency to 0.7.2 +- Work around a Synapse issue affecting sqlite configurations -# 0.4.0 +## 0.4.0 -* Upgrade ruma dependency to 0.6.4 +- Upgrade ruma dependency to 0.6.4 -# 0.3.0 +## 0.3.0 -* Upgrade ruma dependency to 0.5.0 +- Upgrade ruma dependency to 0.5.0 -# 0.2.0 +## 0.2.0 Improvements: -* Upgrade ruma dependency to 0.4.0 +- Upgrade ruma dependency to 0.4.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 374d4a4..6ca7e56 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,8 @@ +# Contributing + Welcome! Thanks for looking into contributing to our project! -# Table of Contents +## Table of Contents - [Looking for Help?](#looking-for-help) - [Documentation](#documentation) @@ -15,21 +17,21 @@ Welcome! Thanks for looking into contributing to our project! - [LLM Contributions](#llm-contributions) - [Project-related use of LLMs](#project-related-use-of-llms) -# Looking for Help? +## Looking for Help? Here is a list of helpful resources you can consult: -## Documentation +### Documentation - [Synapse Admin API Documentation](https://element-hq.github.io/synapse/latest/usage/administration/admin_api/index.html) -## Chat Rooms +### Chat Rooms - Ruma Matrix room: [#ruma:matrix.org](https://matrix.to/#/#ruma:matrix.org) - Ruma Development Matrix room: [#ruma-dev:matrix.org](https://matrix.to/#/#ruma-dev:matrix.org) - Synapse Community room: [#synapse:matrix.org](https://matrix.to/#/#synapse:matrix.org) -# Reporting Issues +## Reporting Issues If you find any bugs, inconsistencies or other problems, feel free to submit a GitHub [issue](https://github.com/ruma/synapse-admin-api/issues/new). @@ -40,21 +42,21 @@ If you have a quick question, it may be easier to leave a message in Also, if you have trouble getting on board, let us know so we can help future contributors to the project overcome that hurdle too. -# Submitting Code +## Submitting Code Ready to write some code? Great! Here are some guidelines to follow to help you on your way: -## Coding Style +### Coding Style In general, try to replicate the coding style that is already present. Specifically: -### Naming +#### Naming For internal consistency, Ruma uses American spelling for variable names. Names may differ in the serialized representation, as the Matrix specification has a mix of British and American English. -### Common Types +#### Common Types When writing endpoint definitions, use the following mapping from request / response field types listed in the specification to Rust types: @@ -68,7 +70,7 @@ Specification type | Rust type `[…]` | `Vec<…>` `{string: …}` | `BTreeMap` (or `BTreeMap`) -### Code Formatting and Linting +#### Code Formatting and Linting We use [rustfmt] to ensure consistent formatting code and [clippy] to catch common mistakes not caught by the compiler as well as enforcing a few custom @@ -92,7 +94,7 @@ check that code [rustfmt]: https://github.com/rust-lang/rustfmt#readme [clippy]: https://github.com/rust-lang/rust-clippy#readme -### (Type) Privacy and Forwards Compatibility +#### (Type) Privacy and Forwards Compatibility Generally, all `struct`s that are mirroring types defined in the Synapase Admin API docs should have all their fields `pub`lic. Where there are restrictions to the fields value beyond their type, these @@ -109,13 +111,13 @@ Due to this combination of public fields and non-exhaustiveness, all `struct`s g constructor function or `From` / `TryFrom` implementation to be able to create them in a straight-forward way (always going through `Deserialize` would be quite ugly). -### Import Formatting +#### Import Formatting Organize your imports into three groups separated by blank lines: 1. `std` imports -1. External imports (from other crates) -1. Local imports (`self::`, `super::`, `crate::` and things like `LocalEnum::*`) +2. External imports (from other crates) +3. Local imports (`self::`, `super::`, `crate::` and things like `LocalEnum::*`) For example, @@ -127,7 +129,7 @@ use ruma_common::api::ruma_api; use super::MyType; ``` -### Commit Messages +#### Commit Messages Write commit messages using the imperative mood, as if completing the sentence: "If applied, this commit will \_\_\_." For example, use "Fix some bug" instead @@ -137,9 +139,9 @@ of "Fixed some bug" or "Add a feature" instead of "Added a feature". [blog post](https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/) for more information on writing good commit messages.) -## Modifying Endpoints +### Modifying Endpoints -### Endpoint Module Structure +#### Endpoint Module Structure Synapse uses versioned endpoints (with a few small exceptions), we follow this versioning approach in modules as well. @@ -163,7 +165,7 @@ mod v1 { This happens if the endpoint either has a single version, or a few versions of sufficiently small size. -### Endpoint Documentation Header +#### Endpoint Documentation Header Add a comment to the top of each endpoint file that includes the path and a link to the documentation of the spec. Replace the version @@ -183,11 +185,12 @@ pub mod v2 { } ``` -### Naming Endpoints +#### Naming Endpoints When adding new endpoints, select the module that fits the purpose of the endpoint. When naming the endpoint itself, you can use the following guidelines: + - The name should be a verb describing what the client is requesting, e.g. `get_some_resource`. - Endpoints which are basic CRUD operations should use the prefixes @@ -200,32 +203,32 @@ guidelines: - If you're not sure what to name it, pick any name and we can help you with it. -### Tracking Changes +#### Tracking Changes If your changes affect the public API add an entry about them to the change log (`CHANGELOG.md`). Where applicable, try to find and denote the version of Synapse that included the change you are making. -## Submitting PRs +### Submitting PRs Once you're ready to submit your code, create a pull request, and one of our maintainers will review it. Once your PR has passed review, a maintainer will merge the request and you're done! 🎉 -## Where do I start? +### Where do I start? If this is your first contribution to the project, we recommend taking a look at one of the [open issues][] we've marked for new contributors. [open issues]: https://github.com/ruma/synapse-admin-api/issues?q=is%3Aissue+is%3Aopen+label%3A"help+wanted" -# Testing +## Testing Before committing, run `cargo check` to make sure that your changes can build, as well as running the formatting and linting tools [mentioned above](#code-formatting-and-linting). -# LLM Contributions +## LLM Contributions Contributions must not include content generated by large language models or other probabilistic tools like ChatGPT, Claude, and Copilot. @@ -242,7 +245,7 @@ including, but not limited to, code, documentation, issues, and artworks. An exception applies for purely translating texts for issues and comments to English. We may make more exceptions for other accessibility-related uses. -## Project-related use of LLMs +### Project-related use of LLMs We heavily discourage the use of LLM chat bots as a replacement for reading Ruma's documentation and API reference. diff --git a/README.md b/README.md index be8b0e1..f816284 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,5 @@ [![docs.rs page](https://docs.rs/synapse-admin-api/badge.svg)](https://docs.rs/synapse-admin-api/) ![license: MIT](https://img.shields.io/crates/l/synapse-admin-api.svg) -**synapse-admin-api** contains serializable types for the requests and responses for each endpoint in the [synapse admin API](https://github.com/element-hq/synapse/tree/master/docs/admin_api). +**synapse-admin-api** contains serializable types for the requests and responses for each endpoint +in the [synapse admin API](https://github.com/element-hq/synapse/tree/master/docs/admin_api). From 9496245060ae6713fca633005dce4925726473e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 25 Apr 2026 09:48:05 +0200 Subject: [PATCH 3/3] Use CI workflow from ruma repository --- .github/workflows/ci.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8d7f0a..df50360 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,30 +14,7 @@ on: jobs: style: name: Style - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v6 - - - name: Install rust nightly toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.NIGHTLY }} - - - uses: Swatinem/rust-cache@v2 - - - name: Check spelling - uses: crate-ci/typos@v1.39.2 - - - name: Install cargo-sort - uses: taiki-e/cache-cargo-install-action@v2 - with: - tool: cargo-sort - - - name: Run cargo-sort - run: | - cargo sort --workspace --grouped --check \ - --order package,lib,features,dependencies,target,dev-dependencies,build-dependencies + uses: ruma/ruma/.github/workflows/style.yml@main msrv: name: Minimum Supported Rust Version / Check All Features