{"id":41235018,"url":"https://github.com/mapikit/object-definition","last_synced_at":"2026-01-23T01:02:00.178Z","repository":{"id":145703903,"uuid":"426405737","full_name":"mapikit/object-definition","owner":"mapikit","description":"A object schema library for meta-system","archived":false,"fork":false,"pushed_at":"2024-06-16T21:55:31.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-16T22:48:57.635Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapikit.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}},"created_at":"2021-11-09T22:25:46.000Z","updated_at":"2024-06-16T21:55:34.000Z","dependencies_parsed_at":"2024-01-23T17:15:45.862Z","dependency_job_id":"7e0ea395-3c2e-4575-9432-9a00397c0ca6","html_url":"https://github.com/mapikit/object-definition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mapikit/object-definition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapikit%2Fobject-definition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapikit%2Fobject-definition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapikit%2Fobject-definition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapikit%2Fobject-definition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapikit","download_url":"https://codeload.github.com/mapikit/object-definition/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapikit%2Fobject-definition/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28676466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T01:00:35.747Z","status":"ssl_error","status_checked_at":"2026-01-23T01:00:19.529Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-23T01:01:59.649Z","updated_at":"2026-01-23T01:02:00.035Z","avatar_url":"https://github.com/mapikit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Object Definition\nThe standard library for schema and type definition in Meta-System.\n\n## Features\nThis library contains the typescript type definition and two functions to both validate if your type definition is properly declared, and if a given object adheres to such object definition.\n\nFor information on how to define such objects, go to the [Meta-System Documentation](https://mapikit.github.io/meta-system-docs/docs/api-docs/configuring/object-definition).\n\n## API Reference\n### Object Definition Type\nYou should use this type in your application if you use Typescript and you are writing the definitions by hand in your code. To do so, just import `ObjectDefinition` from the index file of the library.\n\n### isObjectDefinition : Function\nThis function validates the object definition to see if it has the correct interface. If the definition is badly formatted, the function throws.\n\n```typescript\nconst goodDefinition = {/*definition here*/};\nconst badDefinition = {/*definition here*/};\n\nisObjectDefinition(goodDefinition); // OK\nisObjectDefinition(badDefinition); // THROWS\n```\n\n### validateObject : Function\nThe `validateObject` function checks whether a given object adheres to another given ObjectDefinition. The function returns an object with a property `errors`, which is an array contaning data about errors found during validation. It is empty if the object is properly delcared.\n\n```typescript\nconst objectTypeDefinition = {\n  name: { type: \"string\" },\n  age: { type: \"number\" },\n  hobbies: { type: \"array\", subtype: \"string\" }\n};\n\nconst goodObject = {\n  name: \"John Doe\",\n  age: 33,\n  hobbies: [ \"piano\", \"swimming\" ];\n};\n\nconst badObject = {\n  name: \"Mary Ferry\",\n  age: 27,\n  hobbies: [ \"bowling\", false ]\n};\n\nconsole.log(validateObject(goodObject, objectTypeDefinition))\n  // { errors: [] }\n\nconsole.log(validateObject(badObject, objectTypeDefinition))\n  // { errors: [{ path: 'hobbies.1', error: 'Array subtype not respected: string' }] }\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapikit%2Fobject-definition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapikit%2Fobject-definition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapikit%2Fobject-definition/lists"}