-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty Object in Request Payload #3596
Comments
Hi @illunix, |
"@microsoft/kiota-abstractions": "^1.0.0-preview.28",
"@microsoft/kiota-authentication-azure": "^1.0.0-preview.24",
"@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.27",
"@microsoft/kiota-serialization-form": "^1.0.0-preview.15",
"@microsoft/kiota-serialization-json": "^1.0.0-preview.27",
"@microsoft/kiota-serialization-multipart": "^1.0.0-preview.8",
"@microsoft/kiota-serialization-text": "^1.0.0-preview.23", |
|
Pre release that I used v1.8.0-preview.202310260001 and For both versions I used same packages |
When you generate, do you enable the backing store? (-b or --backing-store) |
The offer object is empty in request body but in console log it's okey @baywet const cmd: GetCheckoutUrlCommand = {
priceId: this.planId,
offer: this.offer,
baseSuccessUrl: `${window.location.origin}/offer-published`
}
console.log(cmd)
this._testProjApi.checkout.url
.post(cmd)
.then(q => window.location.href = q?.url ?? '')
.catch(() => this.isLoading.update(() => false)); "/checkout/url": {
"post": {
"tags": [
"Checkout"
],
"operationId": "Get checkout url",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestProj.Core.Commands.Commerce.GetCheckoutUrlCommand"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestProj.Core.DTOs.Commerce.CheckoutUrlDto"
}
}
}
},
"400": {
"description": "Bad Request"
},
"422": {
"description": "Client Error",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Microsoft.AspNetCore.Http.HttpValidationProblemDetails"
}
}
}
}
}
}
}, "TestProj.Core.Commands.Commerce.GetCheckoutUrlCommand": {
"type": "object",
"properties": {
"priceId": {
"type": "string",
"nullable": true
},
"offer": {
"$ref": "#/components/schemas/TestProj.Core.DTOs.Commerce.OfferDto"
},
"baseSuccessUrl": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}, |
Can you share how the offer is created? |
What this parameter do? I don't use that @baywet |
It allows you to do dirty tracking for scenarios where you:
In that scenario, the backing store only sends the changed property, not the whole object representation. Since this is something we've recently revamped in the last preview, I was wondering whether it could be the source of the issue. Can you share a code snippet of how the offer is created? |
You mean the generated code? Or what you mean by where offer is created |
Also when I add -b parameter I get errors about Property 'backingStore' is missing in type on every interface |
export function serializeGetCheckoutUrlCommand(writer: SerializationWriter, getCheckoutUrlCommand: GetCheckoutUrlCommand | undefined = {} as GetCheckoutUrlCommand) : void {
writer.writeStringValue("baseSuccessUrl", getCheckoutUrlCommand.baseSuccessUrl);
writer.writeObjectValue<OfferDto>("offer", getCheckoutUrlCommand.offer, );
writer.writeStringValue("priceId", getCheckoutUrlCommand.priceId);
} |
I meant the part of your code that built the offer property here const cmd: GetCheckoutUrlCommand = {
priceId: this.planId,
offer: this.offer,
baseSuccessUrl: `${window.location.origin}/offer-published`
}
This is probably because the dependencies are misaligned, we're still working on that. But As you're not passing that argument, disregard it for now. |
this.offer comes from input property that is OfferDto type, nothing special |
in this generated code export function serializeGetCheckoutUrlCommand(writer: SerializationWriter, getCheckoutUrlCommand: GetCheckoutUrlCommand | undefined = {} as GetCheckoutUrlCommand) : void {
writer.writeStringValue("baseSuccessUrl", getCheckoutUrlCommand.baseSuccessUrl);
writer.writeObjectValue<OfferDto>("offer", getCheckoutUrlCommand.offer, );
writer.writeStringValue("priceId", getCheckoutUrlCommand.priceId);
} This line Looking at our own repositories, this looks like a bug that was inserted recently. |
just submitted #3597 to address this issue. |
Hi, @baywet
|
@rners01 Can you submit a new issue at https://github.com/microsoft/kiota-typescript for that please? |
@baywet created - microsoft/kiota-typescript#1129 |
I am encountering a peculiar issue in the latest release and pre-release versions of the TypeScript Client Generator, where my object appears empty in the request payload. Before sending the request, I log the object to the console using console.log to ensure it's populated correctly. This process worked as expected in version v1.4.0. However, post-upgrade, the object in the request payload is showing as empty, despite the console log indicating otherwise. I am seeking assistance or insights to resolve this issue.
The text was updated successfully, but these errors were encountered: