{"id":16732902,"url":"https://github.com/nikita-volkov/modeliero","last_synced_at":"2026-05-09T13:15:34.582Z","repository":{"id":251961922,"uuid":"838975482","full_name":"nikita-volkov/modeliero","owner":"nikita-volkov","description":"Swiss army knife for model code-generation (in beta)","archived":false,"fork":false,"pushed_at":"2025-01-31T05:15:07.000Z","size":326,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T03:02:59.547Z","etag":null,"topics":["asyncapi","code-generation","haskell","json-schema","openapi"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/nikita-volkov.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":"2024-08-06T17:59:48.000Z","updated_at":"2025-01-31T05:15:10.000Z","dependencies_parsed_at":"2024-11-21T16:28:16.997Z","dependency_job_id":"14c57933-c01d-45f8-82ce-92d35e29415d","html_url":"https://github.com/nikita-volkov/modeliero","commit_stats":null,"previous_names":["nikita-volkov/modeliero"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nikita-volkov/modeliero","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikita-volkov%2Fmodeliero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikita-volkov%2Fmodeliero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikita-volkov%2Fmodeliero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikita-volkov%2Fmodeliero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikita-volkov","download_url":"https://codeload.github.com/nikita-volkov/modeliero/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikita-volkov%2Fmodeliero/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32820532,"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":["asyncapi","code-generation","haskell","json-schema","openapi"],"created_at":"2024-10-12T23:47:26.600Z","updated_at":"2026-05-09T13:15:34.545Z","avatar_url":"https://github.com/nikita-volkov.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swiss army knife for model code-generation (in beta)\n\nUniversal data-model code-generation CLI application. It reads specs from various formats and generates code for various languages.\n\n# Design\n\nThis project is designed to be scalable in two directions:\n\n1. Supported input formats, e.g.:\n    - JSON Schema\n    - OpenAPI\n    - AsyncAPI\n    - TypeSpec\n2. Supported generation targets:\n    - Code for various programming languages\n    - Other specs (for conversion purposes)\n\n# Status\n\nThe project is in a working state: it can read a schema and generate code. It is well covered with tests, however it is not yet battle-tested in any large production project and it is limited in features.\n\n## Supported spec sources\n\n- ### AsyncAPI\n\n## Supported generation targets\n\n- ### Haskell library\n    \n    Provides data types and instances exposed as one module with no naming conflicts.\n    \n    The library is designed to compile fast, which it achieves by completely avoiding Generic and Template Haskell and by optimizing its structure for parallel compilation. It defines every type with its instances in a separate module and then reexports them all from a dome module which is fast to compile.\n\n# Instructions\n\n## Installing the CLI application\n\n### From source\n\n1. Install the Cabal build tool by following [the official instructions](https://www.haskell.org/cabal/)\n\n2. Clone the application source:\n\n    ```bash\n    git clone https://github.com/nikita-volkov/modeliero.git\n    ```\n\n3. Install the application:\n\n    ```bash\n    cd modeliero\n    cabal install\n    ```\n\n## Using\n\n### Generating Haskell Code\n\nFrom a directory containing a file named `asyncapi.yaml` execute:\n\n```bash\nmodeliero\n```\n\nThe `modeliero-artifacts` directory will get generated. You'll find the generated code within.\n\nThe AsyncAPI standard is supported in a limited set of combinations. See the [Designing AsyncAPI](#designing-asyncapi) section.\n\n### Designing compatible AsyncAPI\n\nThe AsyncAPI standard is supported in a limited set of combinations. It lets you design complete models, which includes products, sums, vectors, maybes and maps. It may not support some valid AsyncAPI schemas yet.\n\nTo ensure compatibility with this codegen you should design new models by following the patterns that are described further.\n\n#### Product Types\n\n```yaml\ncomponents:\n  schemas:\n    two-properties-with-first-required:\n      type: object\n      required: [my-property1]\n      properties:\n        my-property1:\n          type: string\n        my-property2:\n          type: string\n```\n\nmaps to Haskell as:\n\n```haskell\ndata TwoPropertiesWithFirstRequired = TwoPropertiesWithFirstRequired\n  { myProperty1 :: Text.Text,\n    myProperty2 :: Maybe Text.Text\n  }\n```\n\nDo notice how the `required` section is used to encode nullability.\n\n#### Sum Types\n\nWe interpret a pattern where tagging objects are defined as options in `oneOf`. The example explains it best:\n\n```yaml\ncomponents:\n  schemas:\n    one-of-two:\n      oneOf:\n        - type: object\n          required: [one] -- The tagging property must be required\n          properties: -- Strictly single property\n            one: -- Tag name\n              type: string\n        - type: object\n          required: [two]\n          properties:\n            two:\n              type: boolean\n```\n\nmaps to Haskell as:\n\n```haskell\ndata OneOfTwo\n  = OneOneOfTwo Text\n  | TwoOneOfTwo Bool\n```\n\nIn the generated code the constructors are disambiguated using the following pattern: the name of the tag is suffixed by the type name.\n\n#### Enums\n\n```yaml\ncomponents:\n  schemas:\n    my-enum:\n      enum:\n        - option-one\n        - option-two\n```\n\nmaps to Haskell as:\n\n```haskell\ndata MyEnum\n  = OptionOneMyEnum\n  | OptionTwoMyEnum\n```\n\nIn the generated code the constructors are disambiguated using the same pattern as with sums: the name of the tag is suffixed by the type name.\n\n#### Arrays\n\n```yaml\ncomponents:\n  schemas:\n    in-outline-position:\n      type: array\n      items:\n        type: string\n\n    in-inline-position:\n      type: object\n      required: [my-field2]\n      properties:\n        my-field1:\n          type: array\n          items:\n            type: string\n        my-field2:\n          type: array\n          items:\n            type: array\n            items:\n              type: string\n```\n\n```haskell\nnewtype InOutlinePosition = InOutlinePosition\n  { base :: Vector Text\n  }\n\ndata InInlinePosition = InInlinePosition\n  { myField1 :: Maybe (Vector Text),\n    myField2 :: Vector (Vector Text)\n  }\n```\n\n#### Dictionaries\n\nNot supported yet.\n\n#### Primitives\n\nAll primitives are supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikita-volkov%2Fmodeliero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikita-volkov%2Fmodeliero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikita-volkov%2Fmodeliero/lists"}