{"id":37031471,"url":"https://github.com/manne/obviously","last_synced_at":"2026-01-14T03:52:07.409Z","repository":{"id":43868342,"uuid":"230964068","full_name":"manne/obviously","owner":"manne","description":"Roslyn code generator for semantic types","archived":false,"fork":false,"pushed_at":"2024-07-09T21:17:23.000Z","size":161,"stargazers_count":7,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-01T05:59:17.041Z","etag":null,"topics":["code-generator","immutable","microsoft-aspnetcore-mvc","roslyn","semantic-types","source-generation","system-text-json"],"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/manne.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","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":"2019-12-30T18:48:49.000Z","updated_at":"2023-05-02T05:20:20.000Z","dependencies_parsed_at":"2022-09-05T03:01:22.080Z","dependency_job_id":null,"html_url":"https://github.com/manne/obviously","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manne/obviously","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manne%2Fobviously","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manne%2Fobviously/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manne%2Fobviously/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manne%2Fobviously/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manne","download_url":"https://codeload.github.com/manne/obviously/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manne%2Fobviously/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["code-generator","immutable","microsoft-aspnetcore-mvc","roslyn","semantic-types","source-generation","system-text-json"],"created_at":"2026-01-14T03:52:06.883Z","updated_at":"2026-01-14T03:52:07.386Z","avatar_url":"https://github.com/manne.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Obviously\n\n## Semantic Types\n\n[![NuGet](https://img.shields.io/nuget/v/Obviously.SemanticTypes.svg?color=blue\u0026style=flat-square)](https://www.nuget.org/packages/Obviously.SemanticTypes/) [![GitHub license](https://img.shields.io/github/license/manne/obviously?color=blue\u0026style=flat-square)](https://github.com/manne/obviously/blob/master/LICENSE)\n\n\u003e Create semantic types in seconds\n\n### Installation\n\nInstall this NuGet package [Obviously.SemanticTypes](https://www.nuget.org/packages/Obviously.SemanticTypes) (currently in preview).\n\n\u003c/details\u003e\n\n### Usage\n\n#### Basic\n\nThe functionality can be easily used.\nDeclare a partial class and add the attribute `SemanticType`.\nThe only parameter of this attribute is the actual type of the semantic type. Here it is `string`.\n\n```CSharp\n[SemanticType(typeof(string))]\npublic partial class EmailAddress { }\n```\n\n\u003e ⚠ The class must have the `partial` modifier  \n\u003e ℹ The class can be `sealed`\n\n##### What's getting generated\n\nThis generator creates\n\n* The public constructor with a single parameter of the actual type\n* The implementations of\n  * the `comparable` and  `equatable` pattern\n  * `explicit operator` for the actual type.\n\n\u003e ℹ This and the others packages are compile-time dependencies. So the compiled assembly does __not__ contain any references on one of the NuGet packages. Even the `SemanticType` attribute is __not__ in the compiled assembly\n\n###### Code Generation Example\n\nFor details what is getting generated, see [Docs/code_generation.md](Docs/code_generation.md)\n\n#### Advanced\n\n##### Validation\n\nThe input value of the constructor can be validated.\nTherefore a static method named `IsValid` has to be implemented.\nThis method must only have a single parameter of the actual type and must have the return type `bool`.\n\nIf the value is __not__ valid, an instance of the semantic type cannot be created.\n\n###### Validation Example\n\nThe example shows the validation of an email address.\n\n```CSharp\n[SemanticType(typeof(string))]\npublic partial class EmailAddress\n{\n    public static bool IsValid(string value)\n    {\n        return value.Contains('@');\n    }\n}\n```\n\n## Contribution\n\n* Create a fork and make a Pull Request\n* Submit a bug\n* Submit an idea\n\n## Credits\n\n* For the inspiration [github.com/mperdeck/semantictypes](https://github.com/mperdeck/semantictypes)\n* For the code generator [github.com/AArnott/CodeGeneration.Roslyn](https://github.com/AArnott/CodeGeneration.Roslyn)\n* For the examples [github.com/andrewlock/StronglyTypedId](https://github.com/andrewlock/StronglyTypedId)\n* For making the creation of the generated code so easy [github.com/KirillOsenkov/RoslynQuoter](https://github.com/KirillOsenkov/RoslynQuoter)\n\n## License\n\nThis project is licensed under the MIT License - see the [MIT](License) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanne%2Fobviously","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanne%2Fobviously","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanne%2Fobviously/lists"}