Code Monkey home page Code Monkey logo

Comments (7)

lolopinto avatar lolopinto commented on August 14, 2024 1

ah, i misunderstood, you're transforming the result. will take a look later at that and try and fix it

from ent.

Swahvay avatar Swahvay commented on August 14, 2024

It happens here:

val = field.format(transformed.data[k]);

The struct field value is actually getting JSON stingified

from ent.

Swahvay avatar Swahvay commented on August 14, 2024

Commenting out that format line makes everything work as expected. There is another format call later on in transformFieldValue just after where the error above is being thrown. So maybe that's all the fix that's needed?

from ent.

lolopinto avatar lolopinto commented on August 14, 2024

I can't repro this in my tests in both v0.1.x and v0.2.0

can you give more context? what type of fields? what type of transform?

https://github.com/lolopinto/ent/compare/fix-1765?expand=1

from ent.

Swahvay avatar Swahvay commented on August 14, 2024

I'm doing a transformWrite on a create action to transform it into an edit, and passing a new set of data in the returned object. Basically I'm doing a deep-merge on the existing ent and the new data passed into it. One of the fields is defined as:

horses: StructTypeAsList({
  tsType: 'CompetitionEventHorseEntry',
  fields: {
    horseId: UUIDType({
      nullable: true,
      foreignKey: {
        schema: 'Horse',
        column: 'ID',
      },
    }),
    horseName: StringType({
      nullable: true,
      maxLen: 200,
    }),
  },
}),

And when going through the transform, it re-writes it into a JSON string with the DB storage keys instead of the camelCase keys. That then fails the validation later on.

from ent.

lolopinto avatar lolopinto commented on August 14, 2024

ok, i finally repro. I was returning a Map instead of {} and so I wasn't running into this :(

from ent.

lolopinto avatar lolopinto commented on August 14, 2024

closing this so I can keep track. will be in new versions soon

from ent.

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.