{"id":22023336,"url":"https://github.com/maxkoshevoi/responseschemaheader","last_synced_at":"2026-05-09T05:06:38.641Z","repository":{"id":110478462,"uuid":"383879461","full_name":"maxkoshevoi/ResponseSchemaHeader","owner":"maxkoshevoi","description":"ASP.NET Core API middleware that allows client to specify what part of the response they need, and cuts out everything else before it's sent to the client.","archived":false,"fork":false,"pushed_at":"2021-07-08T14:58:15.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-05T11:07:21.660Z","etag":null,"topics":["asp-net-web-api","graphql-rest","middleware"],"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/maxkoshevoi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2021-07-07T17:41:43.000Z","updated_at":"2021-07-08T14:58:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"d97a7bb0-6ed4-41d7-b4f3-1b7044756bd0","html_url":"https://github.com/maxkoshevoi/ResponseSchemaHeader","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/maxkoshevoi/ResponseSchemaHeader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkoshevoi%2FResponseSchemaHeader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkoshevoi%2FResponseSchemaHeader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkoshevoi%2FResponseSchemaHeader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkoshevoi%2FResponseSchemaHeader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxkoshevoi","download_url":"https://codeload.github.com/maxkoshevoi/ResponseSchemaHeader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkoshevoi%2FResponseSchemaHeader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32807862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["asp-net-web-api","graphql-rest","middleware"],"created_at":"2024-11-30T06:27:19.110Z","updated_at":"2026-05-09T05:06:38.178Z","avatar_url":"https://github.com/maxkoshevoi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ResponseSchemaHeader\n\nASP.NET Core API middleware that allows client to specify what part of the response they need, and cuts out everything else before it's sent to the client.\n\n## Installation\n\nGet it from NuGet: [![NuGet](https://img.shields.io/nuget/vpre/ResponseSchemaHeader.svg?label=NuGet)](https://www.nuget.org/packages/ResponseSchemaHeader/)\n\n## Features\n\n- One line initialization\n- Supports object and array responses\n- Supports nested properties\n- Supported response content types:\n  - JSON\n\n## Initialization\n\nTo start using the middleware just add `UseResponseSchemaHeader` into `Statup.cs` before `UseEndpoints`:\n\n```cs\npublic void Configure(IApplicationBuilder app)\n{\n    app.UseResponseSchemaHeader();\n}\n```\n\n## Usage\n\nNow your client is able to add `ResponseSchema` header to any request, and ASP.NET will remove any properties that are not listed there. If client needs everything to be returned, `ResponseSchema` header can be omitted.\n\n`ResponseSchema` should have following structure:\n\n```json\n[ \n    \"topLevelProperty1\", \n    \"topLevelProperty2\", \n    {\n        \"topLevelProperty3\": [\n            \"nestedProperty1\"\n        ] \n    } \n]\n```\n\nIf all nested properties from `topLevelProperty3` need to be included, add it as another string array item.\n\nFor example, let's say your action returns following information:\n\n```json\n[\n    {\n        \"registration\": \"AA07AMM\",\n        \"modelCode\": \"nissan-note\",\n        \"color\": \"Turquoise\",\n        \"year\": 2007,\n        \"vehicleModel\": {\n            \"code\": \"nissan-note\",\n            \"manufacturerCode\": \"nissan\",\n            \"name\": \"NOTE\",\n            \"manufacturer\": {\n                \"code\": \"nissan\",\n                \"name\": \"NISSAN\"\n            }\n        }\n    },\n    {\n        \"registration\": \"AAC792H\",\n        \"modelCode\": \"hyundai-i10\",\n        \"color\": \"Silver\",\n        \"year\": 1975,\n        \"vehicleModel\": {\n            \"code\": \"volkswagen-up\",\n            \"manufacturerCode\": \"volkswagen\",\n            \"name\": \"UP\",\n            \"manufacturer\": {\n                \"code\": \"volkswagen\",\n                \"name\": \"VOLKSWAGEN\"\n            }\n        }\n    },\n```\n\nAnd you only need `registration` and `vehicleModel.code` on your client.\nAfter adding this header to the request (it's case insensitive by default):\n\n```json\nResponseSchema: [ \"Registration\", { \"vehicleModel\": [ \"code\" ] } ]\n```\n\nResponse will be:\n\n```json\n[\n    {\n        \"registration\": \"AA07AMM\",\n        \"vehicleModel\": {\n            \"code\": \"nissan-note\"\n        }\n    },\n    {\n        \"registration\": \"AAY452D\",\n        \"vehicleModel\": {\n            \"code\": \"volkswagen-up\"\n        }\n    }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxkoshevoi%2Fresponseschemaheader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxkoshevoi%2Fresponseschemaheader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxkoshevoi%2Fresponseschemaheader/lists"}