You are not logged in.
Pages: 1
Hello everyone!
Thank you, ab, for a great tool for working with OpenAPI.
How can I pass the ObjectOption parameter to Request (IJsonClient) method, so that the parameter PayLoad is saved to JSON only with non-empty values for POST method?
"required": [
"projectId",
"subject"
],
"properties": {
"projectId": {
"type": "integer"
},
"subject": {
"type": "string"
},
"statusId": {
"type": "integer"
},
"priorityId": {
"type": "integer"
}
}
For example:
PayLoad.ProjectID:=21;
PayLoad.Subject:='subject'
//PayLoad.StatusId:=0
//PayLoad.PriorityId:=0
OpenApiClient.IssueCreate(eo2Json,PayLoad, [woDontStoreDefault,woDontStoreVoid]);
PayLoad --> {ProjectID:21,Subject:'subject'}, but not {ProjectID:21,Subject:'subject',StatusId:0,PriorityId:0} as now
Last edited by Alek (2025-01-27 10:57:04)
Offline
I have added a new jcoPayloadWithoutVoid option.
But note that it is global for all methods.
You can change the option before the call, if you are sure that your code is thread-safe (which should be the case from an UI).
See https://github.com/synopse/mORMot2/commit/7795c5a3b
For something tuned for a given method, you could make a manual call to the server, managing by hand the input/output parameters.
Offline
It works perfectly.
Also a similar questions. Sometimes you need to pass a list of parameters in a query (array of simple type), id=1,2,3 but not as id=1&id=2&id=3
or name=str1,str2,str3 but not name=str1?name=str2&name=str3
mormot has an excellent opportunity to use the second way.
The lines are generated in the code:
'*id', IntegerDynArrayToCsv(id) or '*name', GetSetNameCustom(TypeInfo(TEnumNameArray))
If I remove the sign *, I will get the result I need.
How can I do this in an elegant way?
Last edited by Alek (2025-01-28 10:25:06)
Offline
Pages: 1