Giter Site home page Giter Site logo

ahmdigital / content-model-graph Goto Github PK

View Code? Open in Web Editor NEW
37.0 12.0 4.0 903 KB

Graph your Sanity.io content model straight in your Studio using this tool

License: MIT License

JavaScript 2.47% Dockerfile 2.15% TypeScript 95.38%
content-modelling sanity-io domain-model content-model tool plugin schema sanity structured-content

content-model-graph's People

Contributors

caitlynn avatar camjc avatar jheanly avatar joshredwards avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

content-model-graph's Issues

Array of references not showing up

Thanks for that plugin! Really easy to use ๐Ÿ‘

There's a little catch though that I stumpled upon.

image

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.

Export to svg file

Its hard to share these right now, especially big ones. Give me a button!

Incorrect model when using references as types

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',
          },
        },
      ],
    },
  ],
}

correct

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',
        },
      ],
    },
  ],
}

incorrect

BUG - Breaking studio

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!

Feature: allow to ignore types

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 ๐Ÿ‘

Action Required: Fix Renovate Configuration

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]"

Crashes Sanity Studio

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:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
    at Object.throwInvalidHookError (/static/js/vendor.bundle.js:23203:13)
    at useState (/static/js/vendor.bundle.js:5054:21)
    at ContentModelGraph (/static/js/app.bundle.js:245329:39)
    at ProxyComponent.hotComponentRender (/static/js/app.bundle.js:106831:16)
    at ProxyComponent.proxiedRender (/static/js/app.bundle.js:106848:36)
    at finishClassComponent (/static/js/vendor.bundle.js:25495:31)
    at updateClassComponent (/static/js/vendor.bundle.js:25448:24)
    at beginWork$1 (/static/js/vendor.bundle.js:27211:16)
    at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:7361:14)
    at Object.invokeGuardedCallbackDev (/static/js/vendor.bundle.js:7410:16)
    Component stack:
    in ContentModelGraph
    in component (created by RenderTool)
    in RenderTool (created by SchemaErrorReporter)
    in RouteScope (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in SchemaErrorReporter (created by DefaultLayout)
    in DefaultLayout (created by withRouter(DefaultLayout))
    in withRouter(DefaultLayout) (created by DefaultLayoutContainer)
    in RouterProvider (created by DefaultLayoutContainer)
    in LoginWrapper (created by DefaultLayoutContainer)
    in DefaultLayoutContainer (created by SanityRoot)
    in div (created by SanityRoot)
    in SanityRoot
    in AppContainer

Any hints as to how I can overcome this?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • [patch] Update dependency styled-components to v5.3.11

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • node 16
github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v2
  • github/codeql-action v1
  • github/codeql-action v1
  • github/codeql-action v1
npm
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
nvm
.nvmrc
  • node 16

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.