cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with creating entity with integers (SAP Cloud SDK NodeJS)

vfweiss
Participant

Hello all,

While prepping my test cases for #sitNL I ran into an issue with Entities who have INT32 values.

I build an App with CAP with the default Bookshop model and implemented the v2 proxy to have a working v2 service.

Downloaded that V2 metadata.xml and ran it through the generator to have my model.

So I wanted to create a Book:

const entry = Books.builder()
    .id(1)
    .title("Practical VIM")
    .stock(999)
    .authorId(201)
    .build();

Books.requestBuilder()
    .create(entry)
    .execute({ url: "http://localhost:3001" })
    .then(async output => {
        await console.log(output);
    });

And when I ran it, my server gave an error that Strings aren't supported for INT values.

After some debugging I found in the deserializer from the payload-value-converter in the cloud-sdk-core, that it was converting my value to a String ('Edm.Int32': toString). After adding a new function that always converted the int32 to an Integer value it worked again.

Was I missing anything or is this function not working correctly for INT32 values at this moment?

Accepted Solutions (1)

Accepted Solutions (1)

Junjie
Advisor
Advisor

Hi Vincent,

thank you very much for reporting the issue.

We fixed the bug last December and released a new SDK version last week.

Please try to build entities with integer attributes, now.

Please let me know, if you have any questions.

Best regards,

Junjie

Answers (1)

Answers (1)

Hello Vincent,

thank you for bringing this to our attention. I just looked into it and it seems that you indeed found a bug. I will investigate further and let you know whether this really is a bug and if so, when we will fix this.