{"id":30481018,"url":"https://github.com/edwok/matrixparameters.aspnetcore","last_synced_at":"2025-10-14T05:33:40.897Z","repository":{"id":37795984,"uuid":"415909795","full_name":"EdwOK/MatrixParameters.AspNetCore","owner":"EdwOK","description":"MatrixParameters.AspNetCore","archived":false,"fork":false,"pushed_at":"2024-03-04T00:15:55.000Z","size":119,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-24T17:31:49.758Z","etag":null,"topics":["aspnetcore","charp","dotnet","matrix-parameters","microsoft","model-binding","modelbinding","open-api","routes-api","routing","swagger","swagger-api","uri-scheme"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EdwOK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-11T12:08:01.000Z","updated_at":"2024-03-04T23:20:06.000Z","dependencies_parsed_at":"2024-03-02T21:26:51.701Z","dependency_job_id":"619303a8-e7b0-4900-80c9-f5455db5aef8","html_url":"https://github.com/EdwOK/MatrixParameters.AspNetCore","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/EdwOK/MatrixParameters.AspNetCore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdwOK%2FMatrixParameters.AspNetCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdwOK%2FMatrixParameters.AspNetCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdwOK%2FMatrixParameters.AspNetCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdwOK%2FMatrixParameters.AspNetCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EdwOK","download_url":"https://codeload.github.com/EdwOK/MatrixParameters.AspNetCore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdwOK%2FMatrixParameters.AspNetCore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018009,"owners_count":26086235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","charp","dotnet","matrix-parameters","microsoft","model-binding","modelbinding","open-api","routes-api","routing","swagger","swagger-api","uri-scheme"],"created_at":"2025-08-24T13:25:06.409Z","updated_at":"2025-10-14T05:33:40.892Z","avatar_url":"https://github.com/EdwOK.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MatrixParameters.AspNetCore\n\n[![CodeQL](https://github.com/EdwOK/MatrixParameters.AspNetCore/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/EdwOK/MatrixParameters.AspNetCore/actions/workflows/codeql-analysis.yml)\n[![Deploy](https://github.com/EdwOK/MatrixParameters.AspNetCore/actions/workflows/ci.yml/badge.svg)](https://github.com/EdwOK/MatrixParameters.AspNetCore/actions/workflows/ci.yml)\n[![NuGet](https://img.shields.io/nuget/v/MatrixParameters.AspNetCore.svg)](https://www.nuget.org/packages/MatrixParameters.AspNetCore)\n[![Downloads](https://img.shields.io/nuget/dt/MatrixParameters.AspNetCore.svg)](https://www.nuget.org/packages/MatrixParameters.AspNetCore/)\n\nThis library helps you to start using [matrix parameters (or matrix URIs)](http://www.w3.org/DesignIssues/MatrixURIs.html) in the route of API action.\n\n## Code Example\n\n### Startup\n```csharp\nservices.AddControllers(options =\u003e\n{\n    options.ModelBinderProviders.Insert(0, new SegmentPrefixAttributeModelBinderProvider());\n    options.ModelBinderProviders.Insert(1, new MatrixParameterAttributeModelBinderProvider());\n});\n\nservices.AddRouting(options =\u003e\n{\n    options.ConstraintMap.Add(\"SegmentPrefix\", typeof(SegmentPrefixConstraint));\n});\n```\n\n### Swagger\n```csharp\nservices.AddSwaggerGen(c =\u003e\n{\n    c.ParameterFilter\u003cMatrixParameterFilter\u003e();\n    c.DocumentFilter\u003cMatrixDocumentFilter\u003e();\n});\n```\n\n### Controller\n```csharp\n// GET customers/2/bananas;color=yellow,green;rate=good/oregon\n//\n// This route with the segments {fruits} and {location} will match a path with two segments if they are not \n// matched with the following two actions GetApplesFromWashington and GetApplesFromLocation. Both of their \n// routes are more specific because of constraints, and thus matched prior to this.\n[HttpGet]\n[Route(\"{fruits}/{location}\")]\npublic IActionResult GetFruitsFromLocation(\n    [SegmentPrefix] string fruits, // The fruits from the route segment {fruits}.\n    [MatrixParameter(\"bananas\")] string[] color, // The matrix parameter color from the segment starting with \"bananas\". It is matched only if the fruits is \"apples\".\n    [SegmentPrefix] string location, // The location from the route segment {location}.\n    [MatrixParameter(\"{fruits}\")] string[] rate) // The matrix parameter rate from the route segment \"{fruits}\".\n{\n    var result = new Dictionary\u003cstring, string\u003e\n    {\n        { \"fruits\", fruits },\n        { \"color of bananas\", Join(color) },\n        { \"location\", location },\n        { \"rate of \" + fruits, Join(rate) }\n    };\n    return Ok(result);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwok%2Fmatrixparameters.aspnetcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedwok%2Fmatrixparameters.aspnetcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwok%2Fmatrixparameters.aspnetcore/lists"}