Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- uses: actions/checkout@v4

- name: Install Rust
Expand All @@ -41,6 +49,14 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- uses: actions/checkout@v4

- name: Install Rust
Expand Down Expand Up @@ -69,6 +85,14 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- uses: actions/checkout@v4

- name: Install Rust
Expand Down Expand Up @@ -98,6 +122,14 @@ jobs:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- uses: actions/checkout@v4

- name: Install Rust
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
assets/myadam.jpg
.github/copilot-instructions.md
docs/UPDATE_SUMMARIES.md
assets/cb7d0daf60d7675081996d81393e2ae5.jpg
assets/b9c93c1cd427d8f50e68dbd11ed2b000.jpg
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.8] - 2026-01-10

### Added
- **CORS middleware**: `CorsLayer` with full `MiddlewareLayer` trait implementation
- Support for `CorsLayer::permissive()` and custom configuration
- Proper preflight request handling
- Origin validation and credential support

### Fixed
- Fixed missing `MiddlewareLayer` implementation for `CorsLayer`
- Fixed CI build issues with GitHub Actions runner disk space

## [0.1.4] - 2026-01-03

### Added
Expand Down
33 changes: 22 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ members = [
# "examples/graphql-api", # TODO: Needs API updates
"examples/microservices",
"examples/middleware-chain",
"examples/cors-test",
"benches/toon_bench",
]

[workspace.package]
version = "0.1.7"
version = "0.1.8"
edition = "2021"
authors = ["RustAPI Contributors"]
license = "MIT OR Apache-2.0"
Expand Down
5 changes: 1 addition & 4 deletions crates/rustapi-core/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ impl RustApi {
entry.insert_boxed_with_operation(method_enum, route.handler, route.operation);
}

let route_count = by_path
.values()
.map(|mr| mr.allowed_methods().len())
.sum::<usize>();
let route_count: usize = by_path.values().map(|mr| mr.allowed_methods().len()).sum();
let path_count = by_path.len();

for (path, method_router) in by_path {
Expand Down
12 changes: 9 additions & 3 deletions crates/rustapi-core/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ impl<T> ValidatedJson<T> {

impl<T: DeserializeOwned + rustapi_validate::Validate + Send> FromRequest for ValidatedJson<T> {
async fn from_request(req: &mut Request) -> Result<Self> {
// First, deserialize the JSON body
let body = req
.take_body()
.ok_or_else(|| ApiError::internal("Body already consumed"))?;
Expand Down Expand Up @@ -778,10 +777,17 @@ impl<T: for<'a> Schema<'a>> OperationModifier for Json<T> {
}
}

// Path - Placeholder for path params
// Path - Path parameters are automatically extracted from route patterns
// The add_path_params_to_operation function in app.rs handles OpenAPI documentation
// based on the {param} syntax in route paths (e.g., "/users/{id}")
impl<T> OperationModifier for Path<T> {
fn update_operation(_op: &mut Operation) {
// TODO: Implement path param extraction
// Path parameters are automatically documented by add_path_params_to_operation
// in app.rs based on the route pattern. No additional implementation needed here.
//
// For typed path params, the schema type defaults to "string" but will be
// inferred from the actual type T when more sophisticated type introspection
// is implemented.
}
}

Expand Down
Loading