seanconnelly / cogs Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Consider the following two classes:
Class Cogs.Test.Parent Extends (%Persistent, Cogs.JsonClass)
{
Property Child As Child;
/// do ##class(Cogs.Test.Parent).Test()
ClassMethod Test()
{
do ..%KillExtent()
do ##class(Cogs.Test.Child).%KillExtent()
set obj = ..%New()
do obj.ChildSetObjectId(1)
w obj.%Save(),!
set child = ##class(Cogs.Test.Child).%New()
do child.ParentSetObjectId(1)
w child.%Save(),!
kill
set obj = ..%OpenId(1)
w obj.toJSON()
}
}
and:
Class Cogs.Test.Child Extends (%Persistent, Cogs.JsonClass)
{
Property Parent As Parent;
}
Calling do ##class(Cogs.Test.Parent).Test()
causes error. Limiting traversal depth or implementing output-once strategy can solve this problem.
XML with classes.
Class serialiser implements seen($this) to prevent recursive problems where two objects point to each other.
It appears that this specif code $get(seen($this)) causes $this to become a stale object in memory, the issue is a bug with the underlying platform, for more details...
https://community.intersystems.com/post/warning-stale-persistent-objects-created#comment-33396
The fix is to implement seen(""_$this)
Currently working on the fix and will release a new version today.
When a JSON string contains a boolean field with a value of 0 or 1, the parser does not recognise it as valid boolean values.
Readme contains:
Property DateOfBirth As %Date(SONNAME="BirthDate");
It should be JSONNAME.
I think $zcvt would be faster:
$zcvt(string","O","JSON")
for older versions (before 2015.2), without JSON translate table, current method can be used as a fallback.
A message with the following layout fails parsing:
{
"MandateListDto": [{
"Id": "40444019-fb52-40bd-82fa-be3d51a90ac8",
"Name": "TestDebtor",
"CreationDateUtc": "2017-07-15T08:25:59.6670000Z",
"MandateStatus": {
"Status": "Rejected",
"AuthenticationDate": "2017-07-15T00:00:00.0000000Z",
"MandateBankReferenceNumber": "",
"RejectReasons": [""]
}
}],
"PageIndex": 1,
"PageSize": 1,
"ErrorList": [],
"ResponseUtcTime": "2017-07-16T10:28:42.8798267Z",
"UserFriendlyDisplayList": []
}
It tries to parse the PageIndex property into the MandateStatus object.
I resolved this by inserting this line prior to "if "}]"[pre continue"
if ("}"=c),(ctype="") g END
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.