Closed awwaiid closed 5 months ago
Ah -- I think the issue is around instances which have no fields. Here is a model that has a field:
sig Thing {
id: Int
}
run example { some Thing }
With that, here is a fragment of the json output:
{
"bitwidth":4,
"command":"Run example",
"incremental":true,
"instances":[
{
"skolems":{
},
"state":0,
"values":{
"Int":{
},
"String":{
},
"none":{
},
"seq/Int":{
},
"this/Thing":{
"id":{
"arity":2,
"data":[
[
"Thing$0",
"6"
],
[
"Thing$0",
"6"
]
]
}
},
...
So you can see that once it has some fields it does fill in some nested values.
The relevant text output here is:
this/Thing={Thing$0, Thing$1}
this/Thing<:id={Thing$0->6, Thing$1->5}
And the text output for the original model which has no fields:
this/Thing={Thing$0, Thing$1}
I'm wondering what this JSON should look like to be nice and clean. Let's say you have ThingNoField and ThingWithField. Maybe
{
"instances": [
{
"skolems": {},
"state": 0,
"values": {
"this/ThingNoField": [
{
"label": "ThingNoField$0",
"fields": {}
},
{
"label": "ThingNoField$1",
"fields": {}
}
],
"this/ThingWithField": [
{
"label": "ThingWithField$0",
"fields": {
"id": "6"
}
},
{
"label": "ThingWithField$1",
"fields": {
"id": "7"
}
}
]
}
}
]
}
Though I suspect I am missing something in the correct way to serialize instances, this feels like the way I think of an instance of having some label and some fields and those fields have values.
Fixed
The
-t json
option is a great idea! However, it doesn't appear to be outputting instances. I've done this testing off of #249, which appears to be the most functional current branch.Here is a console session:
You can see that even though there is an instance in the regular text/table output, the json output doesn't have anything. This appears true for any model I've tried.