ahmdigital / content-model-graph Goto Github PK
View Code? Open in Web Editor NEWGraph your Sanity.io content model straight in your Studio using this tool
License: MIT License
Graph your Sanity.io content model straight in your Studio using this tool
License: MIT License
Thanks for that plugin! Really easy to use ๐
There's a little catch though that I stumpled upon.
The schema is in german, sorry about that, if it makes it easier to understand I will translate it for you, but I think you will get the idea:
The "Gerichte" document is not totally isolated as it appears in the graph but is actually referenced in the "Runden" document. It is references inside an array of references. So my guess is that references in that form are not correctly displayed yet.
Here's the part of the "Runden" schema where the dishes are referenced
{
title: "Gerichte",
name: "dishes",
type: "array",
of: [
{
type: "reference",
to: [{ type: "dish" }],
},
],
},
Let me know if you need any other info or help.
Its hard to share these right now, especially big ones. Give me a button!
Due to GraphQL restrictions, references cannot be inline in arrays and have to be extracted and referenced as types. The issue is that this library faild to build the correct model when the references are not inline.
This is the code for inline references and the model built (correct):
{
name: 'myObject',
type: 'object',
fields: [
{
name: 'myArrayOfReferences',
type: 'array',
of: [
{
name: 'myReferencedTypeReference',
type: 'reference',
to: {
type: 'myReferencedType',
},
},
],
},
],
}
And this is the code with the reference as an external type (which is equivalent to the previous code) and the model built (incorrect):
{
name: 'myReferencedTypeReference',
type: 'reference',
to: {
type: 'myReferencedType',
},
},
{
name: 'myObject',
type: 'object',
fields: [
{
name: 'myArrayOfReferences',
type: 'array',
of: [
{
type: 'myReferencedTypeReference',
},
],
},
],
}
Here's the dependencies
"@sanity/base": "^2.10.5",
"@sanity/components": "^2.0.5",
"@sanity/core": "^2.10.5",
"@sanity/dashboard": "^2.10.5",
"@sanity/default-layout": "^2.10.5",
"@sanity/default-login": "^2.10.5",
"@sanity/desk-tool": "^2.10.5",
"@sanity/google-maps-input": "^2.10.5",
"@sanity/vision": "^2.10.5",
Graph wont render and crashes my studio instance.
Be very helpful to have this updated and working with the newer versions of Sanity.
Thanks for the great tool!
Hey! A common scenario is that non-document schemas are defined in schema.js
, like this:
export default createSchema({
name: 'default',
types: schemaTypes.concat(
[
// documents:
article,
category,
// non-documents:
link,
video,
]
),
});
It would be great if those could be excluded from the graph, since they are effectively just fields, and clutter the graph ๐ If you want, I could make a PR for this ๐
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: package.json
Error type: The renovate configuration file contains some invalid settings
Message: Configuration option 'packageRules[3].node' should be a json object, Configuration option 'packageRules[3].npm' should be a json object, Invalid configuration option: author, Invalid configuration option: bugs, Invalid configuration option: keywords, Invalid configuration option: license, Invalid configuration option: main, Invalid configuration option: name, Invalid configuration option: packageRules[0].@babel/preset-react, Invalid configuration option: packageRules[0].file-saver, Invalid configuration option: packageRules[0].lodash, Invalid configuration option: packageRules[0].prop-types, Invalid configuration option: packageRules[0].react, Invalid configuration option: packageRules[0].react-icons, Invalid configuration option: packageRules[0].styled-components, Invalid configuration option: packageRules[0].viz.js, Invalid configuration option: packageRules[1].@sanity/base, Invalid configuration option: packageRules[1].@sanity/components, Invalid configuration option: packageRules[2].@ahmdigital/eslint-config, Invalid configuration option: packageRules[2].babel-cli, Invalid configuration option: packageRules[2].babel-eslint, Invalid configuration option: packageRules[2].babel-preset-es2015, Invalid configuration option: packageRules[2].babel-preset-react, Invalid configuration option: renovate, Invalid configuration option: scripts, Invalid configuration option: version, The "node" object can only be configured at the top level of a config but was found inside "packageRules[3]", The "npm" object can only be configured at the top level of a config but was found inside "packageRules[3]"
This looks like a fantastic plugin!
Sadly, it immediately crashes Sanity Studio for me:
Stack trace:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
Any hints as to how I can overcome this?
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These problems occurred while renovating this repository. View logs.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
Dockerfile
node 16
.github/workflows/codeql-analysis.yml
actions/checkout v2
github/codeql-action v1
github/codeql-action v1
github/codeql-action v1
package.json
@babel/preset-react ^7.16.7
file-saver ^2.0.5
lodash ^4.17.21
prop-types ^15.8.1
react ^16.14.0
react-icons ^3.11.0
styled-components ^5.3.3
viz.js ^2.1.2
@ahmdigital/eslint-config 7.1.40
@typescript-eslint/parser 6.18.1
babel-cli 6.26.0
babel-preset-es2015 6.24.1
babel-preset-react 6.24.1
@sanity/base ^2.0.0
@sanity/components ^2.0.0
node ^16
.nvmrc
node 16
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.