{"id":13777732,"url":"https://github.com/vm-001/lua-jsonschema-mocker","last_synced_at":"2025-03-17T11:24:38.221Z","repository":{"id":211397307,"uuid":"727573458","full_name":"vm-001/lua-jsonschema-mocker","owner":"vm-001","description":"JSON Schema mocker for Lua/LuaJIT","archived":false,"fork":false,"pushed_at":"2023-12-08T09:51:48.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-14T19:55:31.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vm-001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-05T06:12:13.000Z","updated_at":"2024-12-25T15:07:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"b19b09cf-c9b8-4579-b6f0-a1efe0b3223a","html_url":"https://github.com/vm-001/lua-jsonschema-mocker","commit_stats":null,"previous_names":["vm-001/lua-jsonschema-mocker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vm-001%2Flua-jsonschema-mocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vm-001%2Flua-jsonschema-mocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vm-001%2Flua-jsonschema-mocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vm-001%2Flua-jsonschema-mocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vm-001","download_url":"https://codeload.github.com/vm-001/lua-jsonschema-mocker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244022638,"owners_count":20385133,"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-03T18:00:47.846Z","updated_at":"2025-03-17T11:24:38.188Z","avatar_url":"https://github.com/vm-001.png","language":"Lua","readme":"# lua-jsonschema-mocker\n\nJSON Schema Mocker is a Lua library to generate mock data from a [JSON Schema](https://json-schema.org/specification).\n\n## Supported features\n\n| Category |          Supported                                                    |\n|----------|--------------------------------------------------------------|\n| boolean  | supported                                                    |\n| integer  | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum` |\n| number   | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum` |\n| string   | `minLength`, `maxLength`, `format`(`date` and `date-time`)   |\n| array    | `minItems`, `maxItems`                                       |\n| object   | supported                                                    |\n| null     | supported                                                    |\n| others   | `enum`, `allOf`, `oneOf`                                      |\n\n\n## Installation\n\nInstall via LuaRocks:\n\n```\nluarocks install jsonschema-mocker\n```\n\n\n## Usage\n\n```lua\nlocal jsonschema_mocker = require \"jsonschema-mocker\"\n\nmath.randomseed(os.time())\n\nlocal mocker = jsonschema_mocker.new()\n\nlocal res = mocker:mock({\n  type = \"object\",\n  properties = {\n    age = { type = \"integer\", minimum = 0 },\n    name = { type = \"string\" },\n    activated = { type = \"boolean\" },\n    hobbies = { type = \"array\", items = { type = \"string\" }, minItems = 0, maxItems = 5 },\n    rank = { enum = { \"A\", \"B\", \"C\", \"D\" } },\n  }\n})\n\n--[[ res\n{\n  activated = false,\n  age = 27,\n  hobbies = { \"v7t8fCape\", \"OEt7ExyKuUzBentHd\", \"S6MtSh\", \"IrowzGG7POFoDBio\" },\n  name = \"DP6CjCN7mlMnAo\",\n  rank = \"C\"\n}\n-- ]]\n```\n\n### Advanced usage\n\n```lua\nlocal jsonschema_mocker = require \"jsonschema-mocker\"\nlocal mocker = jsonschema_mocker.new({\n  -- integer mocker options\n  integer = {\n    minimum = 0,\n    maximum = 999,\n  },\n  \n  -- number mocker options\n  number = {\n    minimum = 0,\n    maximum = 999,\n  },\n  \n  -- string mocker options\n  string = {\n    min_length = 1,\n    max_length = 20,\n    charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\",\n    formatters = nil,\n  },\n  \n  -- array mocker options\n  array = {\n    min_items = 0,\n    max_items = 0,\n  },\n  \n  -- object mocker optiosn\n  object = {\n    only_required_properties = false,\n  },\n  \n  -- customize mock result function\n  customize = function(res, schema)\n    return res\n  end\n})\n```\n\nFor more usage samples, refer to the `/samples` directory.\n\n## License\n\n","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvm-001%2Flua-jsonschema-mocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvm-001%2Flua-jsonschema-mocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvm-001%2Flua-jsonschema-mocker/lists"}