Giter Club home page Giter Club logo

Comments (11)

ChristopherJennings avatar ChristopherJennings commented on July 23, 2024 1

@Simply007, I noticed you're doing the same thing with the models as I did when I was trying out the TS SDK. For example, in order to make the names translate from body_copy to bodyCopy. I ended up writing a helper method to blanket map these items instead of having to map them individually. See https://gist.github.com/ChristopherJennings/3086c7225f6b391ecca9feb6bf3affc4 for my implementation. I then used this in the propertyResolver. This is likely something that should just get included in the TS SDK though.

from sample-app-react.

Simply007 avatar Simply007 commented on July 23, 2024

New branch created:
https://github.com/Kentico/cloud-sample-app-js/tree/migrate_to_typescript_sdk

from sample-app-react.

Simply007 avatar Simply007 commented on July 23, 2024

63010d0

  • models created
  • delivery client encapsulation created

TODO:
Use client in the sores and rewrite components to use new models

from sample-app-react.

petrsvihlik avatar petrsvihlik commented on July 23, 2024

This could be mentioned somewhere in the readme of the TS SDK.

from sample-app-react.

ChristopherJennings avatar ChristopherJennings commented on July 23, 2024

It kind of is: https://github.com/Enngage/KenticoCloudDeliveryTypeScriptSDK#property-binding-in-models

That example notes that the names are all lower case, which is true, but the example also assumes that the code name doesn't include spaces, which typically are there and could be converted using this method.

from sample-app-react.

ChristopherJennings avatar ChristopherJennings commented on July 23, 2024

This has been added as an issue on the SDK repo: kontent-ai/delivery-sdk-js#6

from sample-app-react.

Enngage avatar Enngage commented on July 23, 2024

I believe that @Simply007 used the generator to generate models which included the bindings that automatically convert '_' into camelcase format and no extra effort was required for this (correct me if I'm wrong).

from sample-app-react.

ChristopherJennings avatar ChristopherJennings commented on July 23, 2024

@Enngage, you're probably right. I guess we'll just have to see what @Simply007 has to say.

from sample-app-react.

Simply007 avatar Simply007 commented on July 23, 2024

Yeap I have used generator and then converted typescript models to javascript syntax.
Since we agreed to use typescript, I will regenerate models without any modification and it will be sufficient.
It would be great thet mapping would be done automatically and used @ChristopherJennings modifier, but for now I will use generated code.

Thanks for tips :-)

from sample-app-react.

Enngage avatar Enngage commented on July 23, 2024

@Simply007 , the code generator should already do, what Chris mentioned automatically. What you might however do manually is to use proper models instead of 'IContentItem' for modular item properties as Cloud does not provide this link.

from sample-app-react.

Simply007 avatar Simply007 commented on July 23, 2024

New pull request cretated:

from sample-app-react.

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.