GithubHelp home page GithubHelp logo

Comments (2)

germanbisurgi avatar germanbisurgi commented on May 25, 2024

Hi @simontaurus,

When adding uuid items with the "+ Item" button everything works like expected. Because the uuid editor create their own value at creation in order to be universally unique.

When copying items the Array editor will check if it#s item is type string and has format uuid. In that case the uuid will be regenerated. In this case it does not override uuid because it#s items are of type object

I guess the issue it's about setting the array value directly in which 2 items are identical. If that is so the value should be stripped off from duplicated items before setting the value of the array. Additionally the constrain "uniqueItems" can be added to the array schema to show validation errors.

I'm closing this because i think that was the issue, which is not a json editor bug, but feel free to reopen it if i missed something :)

from json-editor.

simontaurus avatar simontaurus commented on May 25, 2024

@germanbisurgi: I don't have permissions to reopen the issue, but it would be great to have some further discussion:

When copying items the Array editor will check if it#s item is type string and has format uuid. In that case the uuid will be regenerated. In this case it does not override uuid because it#s items are of type object

Makes sense, so the copied item is a true and full copy, including the uuid. But actually the uuid seems to be regenerated first and then copied so it's not possible to keep the uuid of the first element and also not achievable to create more than two array items with the same uuid:

First array element get's a uuid:
grafik
Copying the first element asigns a new uuid to the first element and the second element has the same uuid.
grafik
Copying the second element asigns a new uuid to the second element and the third element has the same uuid, which is now different from the uuid of the first element:
grafik

One could also argue that a UUID is per definition global unique and should never be duplicated. However, with a fixed copyRow callback (see #1483) it would be a workaround to enforce the uuid regeneration there.

from json-editor.

Related Issues (20)

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.