-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
Hello,
I have these types:
package signals
type Addressable struct {
Address int `yaml:"address"`
}
type Unitable struct {
UnitOfMeasurement string `yaml:"uom"`
}package A
type EntryA struct {
signals.Addressable
signals.Unitable
Name string `yaml:"name"`
}And I would like to generate a schema for EntryA. I would prefer this schema to look like this:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://dev.azure.com/Allseas/Innovations/_git/CAM_scl-code-gen.git/schemas/A/entry-a",
"$ref": "#/$defs/EntryA",
"$defs": {
"Addressable": {
"properties": {
"address": {
"type": "integer"
}
},
"required": [
"address"
]
},
"Unitable": {
"properties": {
"uom": {
"type": "string"
}
},
"required": [
"uom"
]
},
"EntryA": {
"allOf": [
{
"$ref": "#/$defs/Addressable"
},
{
"$ref": "#/$defs/Unitable"
},
{
"properties": {
"name": {
"type": "string"
}
},
"type": "object",
"additionalProperties": false,
"required": [
"name"
]
}
]
}
}
}Currently, the schemas are merged and not reused:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://dev.azure.com/Allseas/Innovations/_git/CAM_scl-code-gen.git/schemas/A/entry-a",
"$ref": "#/$defs/EntryA",
"$defs": {
"EntryA": {
"properties": {
"address": {
"type": "integer"
},
"uom": {
"type": "string"
},
"name": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"address",
"uom",
"name"
]
}
}
}Metadata
Metadata
Assignees
Labels
No labels