{"id":15290436,"url":"https://github.com/stackbit/schema","last_synced_at":"2026-01-19T06:01:29.353Z","repository":{"id":40748977,"uuid":"277386635","full_name":"stackbit/schema","owner":"stackbit","description":"Stackbit schema tools","archived":false,"fork":false,"pushed_at":"2023-01-07T05:19:00.000Z","size":734,"stargazers_count":2,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-28T10:49:56.753Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/stackbit.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}},"created_at":"2020-07-05T21:31:02.000Z","updated_at":"2021-09-26T19:17:45.000Z","dependencies_parsed_at":"2023-02-06T12:35:12.867Z","dependency_job_id":null,"html_url":"https://github.com/stackbit/schema","commit_stats":null,"previous_names":["stackbithq/schema"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/stackbit/schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fschema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fschema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fschema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fschema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackbit","download_url":"https://codeload.github.com/stackbit/schema/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fschema/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2024-09-30T16:08:11.248Z","updated_at":"2026-01-19T06:01:29.332Z","avatar_url":"https://github.com/stackbit.png","language":"JavaScript","readme":"# Stackbit Schema\n\nStackbit schema tools\n\n## Install\n\n```bash\nnpm install @stackbit/schema\n```\n\n## Utility Functions\n\n\n### `loadModels(models)`\n\nTakes raw `models` map as defined by stackbit.yaml format and returns an array of sanitized models.\n\n```yaml\n# part of stackbit.yaml\n\nmodels:\n  post:\n    type: page\n    layout: post\n    folder: blog\n    fields:\n      - type: string\n        name: title\n        label: Title\n        required: true\n      # ...fields\n  person:\n    type: data\n    label: Person\n    folder: authors\n    fields:\n      # ...fields\n```\n\n```js\nconst stackbitYaml = await parseFile('path/to/stackbit.yaml');\nconst models = loadModels(stackbitYaml.models);\n```\n\nThe returned `models` is a sanitized array of models:\n```js\n[\n  {\n    \"name\": \"post\",\n    \"type\": \"page\",\n    \"label\": \"Post\",\n    \"fieldLabel\": \"title\",\n    \"layout\": \"post\",\n    \"folder\": \"blog\",\n    \"fields\": [ /* fields */ ]\n  },\n  {\n    \"name\": \"person\",\n    \"type\": \"data\",\n    \"label\": \"Person\",\n    \"folder\": \"authors\",\n    \"fields\": [ /* fields */ ]\n  }\n]\n```\n\n### `getModelByQuery(query, models)`\n\nTakes a query object representing a loaded content file and `models` array returned by `loadModels()`\nand returns a model matching the query.\n\n```js\nconst model = getModelByQuery({ filePath: 'authors/john-doe.json' }, models);\n// model =\u003e model for \"person\" type\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbit%2Fschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackbit%2Fschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbit%2Fschema/lists"}