Giter Site home page Giter Site logo

Comments (3)

Jgfrausing avatar Jgfrausing commented on June 28, 2024

I looked into the issue, and have found a possible cause.
Why are field and sys deleted from the object before diff is created?

const fromTypeDef = Object.assign({}, to)
delete(fromTypeDef.fields)
delete(fromTypeDef.sys)
const toTypeDef = Object.assign({}, to)
delete(toTypeDef.fields)
delete(toTypeDef.sys)

const typeDefDiff: DiffArray<IField> = diff(fromTypeDef, toTypeDef)
const fieldsDiff: DiffArray<IField> = diff(from.fields, to.fields)

Link to code

@gburgett and @bsgreenb what's your thought on this?

from contentful-schema-diff.

gburgett avatar gburgett commented on June 28, 2024

Hi @Jgfrausing,

The answer is directly below that line, where we check to see if typeDefDiff has any changes. If it does, we pass the new values to the second parameter of editContentType. That parameter takes the following fields:

export interface IContentTypeOptions {
  /** Name of the content type. */
  name: string,
  /** Description of the content type. */
  description?: string,
  /** ID of the field to use as the display field for the content type. */
  displayField?: string
}

Link to source

Note that "sys" and "fields" are not in that definition, so we ignore them for the purposes of that diff.

Now to your original issue, if you select that button, it should update the "displayField" property of the content type and therefore it ought to show up in the diff. Would you please provide two Contentful export JSON files of a content type that reproduces this issue? You can do this by exporting your space before checking the box, and then again after checking the box and hitting save on the content type.

Thank you,
Gordon

from contentful-schema-diff.

Jgfrausing avatar Jgfrausing commented on June 28, 2024

Hi @gburgett ,
Sorry for the delay. I've created a small sandbox env and changed the entry title field.
(Something went wrong in the process, so the field controls got changed as well)

The zipfile contains the states title.json and name.json and the diff output.

20210518080717_modify_person.zip

from contentful-schema-diff.

Related Issues (15)

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.