{"id":18045435,"url":"https://github.com/lance/ajv-test","last_synced_at":"2025-04-05T03:41:58.660Z","repository":{"id":66679288,"uuid":"436360470","full_name":"lance/ajv-test","owner":"lance","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-08T22:25:45.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T11:48:48.296Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/lance.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-08T19:00:16.000Z","updated_at":"2021-12-08T22:25:48.000Z","dependencies_parsed_at":"2023-04-13T11:03:45.740Z","dependency_job_id":null,"html_url":"https://github.com/lance/ajv-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Fajv-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Fajv-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Fajv-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lance%2Fajv-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lance","download_url":"https://codeload.github.com/lance/ajv-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284914,"owners_count":20913691,"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-10-30T18:13:14.184Z","updated_at":"2025-04-05T03:41:58.639Z","avatar_url":"https://github.com/lance.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Illustration of a problem I'm having with Ajv\n\nI'd like to precompile my validation functions, and also use some custom formatters. This project includes some code illustrating a problem I am having.\n\nMy schema in `schema/schema.json` is simple. There is a single `time` field with a format of `js-date-time`. The format validation code is in `schema/formats.js`.\n\nI generate the validation function with the command `ajv compile -c ./schema/formats.js -s ./schema/schema.json -o ./schema/validate.js`, which can also be run via `npm run build` for convenience.\n\nThe code that uses this validation function is in `app.js` and simply attempts to validate an object with what should be a valid value. When I call `validate()`, however, I get an error.\n\n```\nTypeError: formats0 is not a function\n```\n\nIf you look at the prettified JavaScript generated for the validation function, it's easy to see that, in fact, `formats0` is _not_ a function.\n\n```\nconst formats0 = {\n  _items: ['require(\"ajv-formats/dist/formats\").', { str: \"fullFormats\" }, \"\"],\n}[\"js-date-time\"];\n```\n\nI'm not sure what I am doing wrong here. Any guidance is appreciated.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flance%2Fajv-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flance%2Fajv-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flance%2Fajv-test/lists"}