{"id":13629617,"url":"https://github.com/Pilchie/JsonSourceGenerator","last_synced_at":"2025-04-17T09:35:14.555Z","repository":{"id":42076909,"uuid":"471471305","full_name":"Pilchie/JsonSourceGenerator","owner":"Pilchie","description":"Source generators to create strongly typed wrappers around JSonElements instead of serializing","archived":false,"fork":false,"pushed_at":"2022-04-13T17:29:22.000Z","size":54,"stargazers_count":38,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-02T07:42:23.436Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Pilchie.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}},"created_at":"2022-03-18T18:11:45.000Z","updated_at":"2024-03-09T02:26:17.000Z","dependencies_parsed_at":"2022-08-12T04:10:47.880Z","dependency_job_id":null,"html_url":"https://github.com/Pilchie/JsonSourceGenerator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"jmarolf/generator-start","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pilchie%2FJsonSourceGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pilchie%2FJsonSourceGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pilchie%2FJsonSourceGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pilchie%2FJsonSourceGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pilchie","download_url":"https://codeload.github.com/Pilchie/JsonSourceGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751303,"owners_count":17196609,"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","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":[],"created_at":"2024-08-01T22:01:14.957Z","updated_at":"2024-11-08T20:31:27.392Z","avatar_url":"https://github.com/Pilchie.png","language":"C#","funding_links":[],"categories":["Do not want to test 112 ( old ISourceGenerator )"],"sub_categories":["1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category"],"readme":"# JSon Wrapper Source Generator\n\n## What\nThis source generator takes interfaces decorated with the `[JsonWrapper]` attribute and generates an extension method \nand wrapper class to allow accesing items in a strongly typed fashion directly out of the JsonElement without \ndeserializing.\n\n## Example\n\nGiven an interface like: \n\n``` C#\n[JsonWrapper]\ninterface IPerson\n{\n    string FirstName { get; }\n    string LastName { get; }\n    int Age { get; }\n```\n\nThis source generator would generate an `AsIPerson()` extension method on `System.Text.Json.JsonElement` and an implementation of `IPerson` that wraps the `JsonElement` and extracts each property on access.\n\n## Why?\n\nThis explores an idea of reducing the conversions and DTO types necessary for implementing Json HTTP APIs.  Also, I haven't ever really looked at implementing a source generator, so I thought I'd give it a go.\n\n## Future ideas\n\n1. Handle unwrapping array properties\n2. Handle `Nullable\u003cT\u003e` properties.\n3. Handle a few more basic values `System.Text.Json.JsonElement` has accessors for (eg `Guid`, `DateTimeOffset`, `Base64Bytes`)\n4. Support properties that are themselves interfaces with `[JsonWrapper]` so that you can have a hierarchy.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPilchie%2FJsonSourceGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPilchie%2FJsonSourceGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPilchie%2FJsonSourceGenerator/lists"}