{"id":15505893,"url":"https://github.com/simply007/schema-definition-changes","last_synced_at":"2025-07-19T02:04:00.108Z","repository":{"id":94605405,"uuid":"238207676","full_name":"Simply007/schema-definition-changes","owner":"Simply007","description":" Schema definition issues with solution for Gatsby source plugin Kontent","archived":false,"fork":false,"pushed_at":"2023-06-10T00:33:06.000Z","size":312,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T23:13:18.198Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Simply007.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-04T13:03:34.000Z","updated_at":"2020-02-04T13:06:59.000Z","dependencies_parsed_at":"2025-01-04T00:03:09.603Z","dependency_job_id":null,"html_url":"https://github.com/Simply007/schema-definition-changes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Simply007/schema-definition-changes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simply007%2Fschema-definition-changes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simply007%2Fschema-definition-changes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simply007%2Fschema-definition-changes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simply007%2Fschema-definition-changes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Simply007","download_url":"https://codeload.github.com/Simply007/schema-definition-changes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simply007%2Fschema-definition-changes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265872178,"owners_count":23842137,"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-02T09:24:49.994Z","updated_at":"2025-07-19T02:04:00.087Z","avatar_url":"https://github.com/Simply007.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Schema definition issues with solution for Gatsby source plugin for Kontent\n\n## Issues\n\n* Mainly https://github.com/Kentico/gatsby-source-kontent/issues/106\n* Might fix https://github.com/Kentico/gatsby-source-kontent/issues/107 as well\n\n## Solution\n\nQueries with complicated filter:\n\n```gql\n  query BeltIdentifierTypeQuery(\n    $url_slug: String!\n    $language: String!\n  ) {\n    pitches: allKontentItemBeltPitch(\n      filter: {\n        usedByContentItems: {\n          elemMatch: {\n            system: { type: { eq: \"belt_series\" } }\n            elements: {\n              belt_type: {\n                linked_items: {\n                  elemMatch: {\n                    elements: { url_slug: { value: { eq: $url_slug } } }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n      ...\n```\n\nCould be extracted to `isUsedInBeltSeries` and `beltTypeUrlSlug` fields precalculated in [gatsby-node.js](gatsby-node.js) and then use in the filter: \n\n### Example\n\n```gql\nquery getPitchesInBeltSeriesByUrlSlug($url_slug: String!) {\n  allKontentItemBeltPitch(filter: {fields: {beltTypeUrlSlug: {eq: $url_slug}, isUsedInBeltSeries: {eq: true}}}) {\n    nodes {\n      internal {\n        type\n      }\n      system {\n        name\n        codename\n      }\n      ...\n    }\n  }\n}\n```\n\ni.e. with query variables:\n\n```json\n{\n  \"url_slug\": \"belt-type-1\"\n}\n```\n\n## How to run\n\n```sh\ngit clone --recurse-submodules github.com/Simply007/schema-definition-changes\n# this automatically clones the plugin sub module to /plugins/@kentico/gatsby-source-kontent\ncd schema-definition-changes\ncd plugins/@kentico/gatsby-source-kontent\n# (optional) checkout proper version\n# git checkout tags/4.3.0\nnpm install\nnpm run build\ncd ../../..\nnpm install\nnpm run develop\n```\n\n## How to connect to own project\n\n1. Perform steps from [How to run](#how-to-run) (except of the `gatsby develop`)\n1. [Register on Kentico Kontent](http://app.kontent.ai)\n1. [Create an empty project](https://docs.kontent.ai/tutorials/set-up-projects/manage-projects/creating-and-archiving-projects)\n1. [Enable Content Management API](https://docs.kontent.ai/tutorials/set-up-projects/migrate-content/importing-to-kentico-kontent#a-enabling-the-api-for-your-project)\n1. Import [content.zip](/content.zip) data using [Template manager](https://kentico.github.io/kontent-template-manager/import-from-file)\n    * Use `Project Id` and `Content Management API key` from previously generated project.\n1. Place the `ProjectId` to the  [`/gatsby-config.js`](/gatsby-config.js#L13) configuration file.\n1. run `npm run develop`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimply007%2Fschema-definition-changes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimply007%2Fschema-definition-changes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimply007%2Fschema-definition-changes/lists"}