{"id":17204530,"url":"https://github.com/bboure/joi4j","last_synced_at":"2026-01-19T07:32:46.992Z","repository":{"id":38271735,"uuid":"173136017","full_name":"bboure/joi4j","owner":"bboure","description":"Adds Joi validation for Neo4j data types","archived":false,"fork":false,"pushed_at":"2023-01-06T01:40:58.000Z","size":806,"stargazers_count":2,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T17:53:52.620Z","etag":null,"topics":["joi","neo4j","normalization","validation","validation-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/bboure.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}},"created_at":"2019-02-28T15:22:05.000Z","updated_at":"2021-07-13T20:52:33.000Z","dependencies_parsed_at":"2023-02-05T01:46:59.224Z","dependency_job_id":null,"html_url":"https://github.com/bboure/joi4j","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboure%2Fjoi4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboure%2Fjoi4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboure%2Fjoi4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bboure%2Fjoi4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bboure","download_url":"https://codeload.github.com/bboure/joi4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445651,"owners_count":20939953,"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":["joi","neo4j","normalization","validation","validation-library"],"created_at":"2024-10-15T02:22:16.865Z","updated_at":"2026-01-19T07:32:46.987Z","avatar_url":"https://github.com/bboure.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This plugin for [Joi](https://github.com/hapijs/joi/) adds validation for Neo4j (Cypher) types that are not mapped to native javascript, as explained [here](https://neo4j.com/docs/driver-manual/current/cypher-values)\n\n# Supported types\n\n| Type          | Supported          |\n| ------------- | ------------------ |\n| Date          | :white_check_mark: |\n| Time          | :x:                |\n| LocalTime     | :x:                |\n| DateTime      | :white_check_mark: |\n| LocalDateTime | :white_check_mark: |\n| Duration      | :x:                |\n| Point         | :white_check_mark: |\n\n# Requirements/Compatibility\n\n| Package      | version |\n| ------------ | ------- |\n| neo4j-driver | \u003e=4.0.0 |\n| joi          | \u003e=17    |\n\n# Install\n\n```bash\nyarn add joi4j\n# or\nnpm install joi4j\n```\n\n# Usage\n\n```javascript\n// import necessary validators and extend Joi\nconst { neo4jDate, neo4jDateTime } = require('joi4j');\nconst Joi = require('joi').extend(neo4jDate, neo4jDateTime);\n\ntry {\n  const schema = Joi.neo4jDate();\n  const date = await schema.validateAsync(\"2019-12-08\");\n  // date is a neo4j.types.Date\n} catch (error) {\n  ...\n}\n```\n\n## With typescript\n\nThe library exports a type to help you extend Joi and benefit from ts autocomplete:\n\n```ts\nimport BaseJoi, { Root } from 'joi';\nimport { Joi4j, neo4jPoint, neo4jDate } = require('joi4j');\n// Extend BaseJoi and add Joi4j typing\nconst Joi: Root \u0026 Joi4j = BaseJoi.extend(neo4jPoint, neo4jDate);\n\n```\n\n# Available validators\n\n## `neo4jDate` - inherits from `any`\n\nValidates that the input is a correct [Neo4j Date](https://github.com/neo4j/neo4j-javascript-driver/blob/1.7/src/v1/temporal-types.js#L192) instance. If the `convert` preference is `true` (enabled by default), a string or native javascript `Date` object will be converted to a Neo4j Date.\n\n```js\nconst schema = Joi.neo4jDate();\nawait schema.validateAsync('2019-12-08');\n```\n\n### `neo4jDate.min(date)`\n\nSpecifies the value must be greater than or equal to `date`.\n\n### `neo4jDate.max(date)`\n\nSpecifies the value must be less than or equal to `date`.\n\n### `neo4jDate.greater(date)`\n\nSpecifies the value must be greater than `date`.\n\n### `neo4jDate.less(date)`\n\nSpecifies the value must be less than `date`.\n\n## `neo4jDateTime` - inherits from `any`\n\nValidates that the input is a correct [Neo4j DateTime](https://github.com/neo4j/neo4j-javascript-driver/blob/1.7/src/v1/temporal-types.js#L305) instance. If the `convert` preference is `true` (enabled by default), a string or native javascript `Date`. object will be converted to a Neo4j DateTime.\n\n```js\nconst schema = Joi.neo4jDateTime();\nawait schema.validateAsync('2019-12-08T13:59:18+02:00');\n```\n\n### `neo4jDateTime.min(date)`\n\nSpecifies the value must be greater than or equal to `date`.\n\n### `neo4jDateTime.max(date)`\n\nSpecifies the value must be less than or equal to `date`.\n\n### `neo4jDateTime.greater(date)`\n\nSpecifies the value must be greater than `date`.\n\n### `neo4jDateTime.less(date)`\n\nSpecifies the value must be less than `date`.\n\n## `neo4jLocalDateTime` - inherits from `any`\n\nValidates that the input is a correct [Neo4j LocalDateTime](https://github.com/neo4j/neo4j-javascript-driver/blob/1.7/src/v1/temporal-types.js#L242) instance. If the `convert` preference is `true` (enabled by default), a string or native javascript `Date`. object will be converted to a Neo4j LocalDateTime.\n\n```js\nconst schema = Joi.neo4jLocalDateTime();\nawait schema.validateAsync('2019-12-08T13:59:18+02:00');\n```\n\n### `neo4jLocalDateTime.min(date)`\n\nSpecifies the value must be greater than or equal to `date`.\n\n### `neo4jLocalDateTime.max(date)`\n\nSpecifies the value must be less than or equal to `date`.\n\n### `neo4jLocalDateTime.greater(date)`\n\nSpecifies the value must be greater than `date`.\n\n### `neo4jLocalDateTime.less(date)`\n\nSpecifies the value must be less than `date`.\n\n## `neo4jPoint` - inherits from `any`\n\nValidates that the input is a correct [Neo4j Point](https://neo4j.com/docs/cypher-manual/current/syntax/spatial/).\nIf the `convert` preference is `true` (enabled by default), a key-value pair object will be converted to a Neo4j Point if specified. If not provided, the srid will be assumed from the keys.\n\n```js\nconst schema = Joi.neo4jPoint();\nawait schema.validateAsync({ lon: 2.154007, lat: 41.390205 });\n```\n\n#### `neo4jPoint.coordinates()`\n\nValidates that the point is a correct coordinates point `(latitude, longitude [, height])`\n\n#### `neo4jPoint.cartesian()`\n\nValidates that the point is a correct coordinates point `(x, y [, z])`.\n\n#### `neo4jPoint.is2d()`\n\nValidates that the point is a correct 2D point (no height or z is given).\n\n#### `neo4jPoint.is3d()`\n\nValidates that the point is a correct 2D point (either height or z is given).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbboure%2Fjoi4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbboure%2Fjoi4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbboure%2Fjoi4j/lists"}