Closed SRetip closed 4 months ago
It's clearly not good when typify crashes! In this case it goes through these transformations:
expanding the oneOf:
{
"type": "object",
"oneOf": [
{
"allOf": [
{
"$ref": "#/definitions/SourceUploadedUserSourceInfo",
},
{
"properties": {
"relativePath": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
}
},
"required": [
"type"
]
}
]
},
{
"allOf": [
{
"$ref": "#/definitions/NetCoreZipUploadedUserSourceInfo"
},
{
"properties": {
"relativePath": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
}
},
"required": [
"type"
]
}
]
}
]
}
then inlining the references:
{
"type": "object",
"oneOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"artifactSelector": {
"type": "string"
},
"runtimeVersion": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"Source"
]
}
},
"required": [
"type"
]
},
{
"properties": {
"relativePath": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
}
},
"required": [
"type"
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"netCoreMainEntryPath": {
"type": "string"
},
"runtimeVersion": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"NetCoreZip"
]
}
},
"required": [
"type"
]
},
{
"properties": {
"relativePath": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
}
},
"required": [
"type"
]
}
]
}
]
}
then resolving those inner allOfs:
{
"type": "object",
"oneOf": [
{
"type": "object",
"properties": {
"artifactSelector": {
"type": "string"
},
"runtimeVersion": {
"type": "string"
},
"relativePath": {
"type": "string"
},
"type": {
"allOf": [
{
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
},
{
"type": "string",
"enum": [
"Source"
]
}
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"netCoreMainEntryPath": {
"type": "string"
},
"runtimeVersion": {
"type": "string"
},
"relativePath": {
"type": "string"
},
"type": {
"allOf": [
{
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
},
{
"type": "string",
"enum": [
"NetCoreZip"
]
}
]
}
},
"required": [
"type"
]
}
]
}
In particular, we see these unresolvable allOf
s:
"type": {
"allOf": [
{
"type": "string",
"enum": [
"UploadedUserSourceInfo"
]
},
{
"type": "string",
"enum": [
"Source"
]
}
]
}
So we get:
{
"type": "object",
"oneOf": [
{
"type": "object",
"properties": {
"artifactSelector": {
"type": "string"
},
"runtimeVersion": {
"type": "string"
},
"relativePath": {
"type": "string"
},
"type": false
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"netCoreMainEntryPath": {
"type": "string"
},
"runtimeVersion": {
"type": "string"
},
"relativePath": {
"type": "string"
},
"type": false
},
"required": [
"type"
]
}
]
}
Since type
is both false
(i.e. unsatisfiable) and in the required
list, the schema becomes simply:
{
"oneOf": [
false,
false
]
}
The best we could generate for the UploadedUserSourceInfo
type is--I think--an "impossible" type like:
pub enum UploadedUserSourceInfo {}
Hello, ran into this problem: When trying to process a circuit like this:
I get the following error:
Having analyzed where it comes from, I realized that the main problem is in this part of the code: typify-impl\src\merge.rs line 255-258
As a result of execution, we get that merged_subschemas.len() is equal to 0.
Is this logic anticipated, and would it be more appropriate to substitute it with a straightforward merging of two Vec?
If you approve of this approach, I'm prepared to carry out the implementation.