-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CVE Schema: could not generate type for field "...": definition does not exist in schema: #164
Comments
hi @beyer-stefan can you please share the command you are using (including all the flags and masking the base paths of your filesystem) please? |
I am running into a very similar issue with netbox schema, and found this issue. I replicated @beyer-stefan 's issue using v0.15.0. wget https://raw.githubusercontent.com/CVEProject/cve-schema/master/schema/v5.0/docs/CVE_JSON_5.0_bundled.json
go-jsonschema -p cve CVE_JSON_5.0_bundled.json Produces this error:
The definition does exist.
|
My issue with the netbox schema may be related. wget https://raw.githubusercontent.com/netbox-community/devicetype-library/master/schema/generated_schema.json
wget https://raw.githubusercontent.com/netbox-community/devicetype-library/master/schema/components.json If you do type ConsolePort struct {
// Type corresponds to the JSON schema field "type".
Type *ConsolePortType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"`
}
type ConsolePortType string
const ConsolePortTypeDb25 ConsolePortType = "db-25" But if you do the same for components.json, which references that console-port in generated_schema.json, it fails. I did wonder if the dash in netbox's schema was an issue (requires extra quotes with jq command), but I removed all the dashes and got a dashless version of the same error. go-jsonschema -p netbox components.json Produces error:
|
@ytjohn thanks for taking the time to investigate! I will look into it 🙏 |
I poked at this a bit more today. It seems like it's the depth level. In the netbox-comunity schema, if I rewrite generated_schema.json like so
And in components.json I would repoint the references, I can read these and move forward. Of course, I'd have to do this to every second level down. "definitions": {
"console-port": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"$ref": "generated_schema.json#/definitions/console-port-properties"
},
"poe": {
"type": "boolean"
}
},
"required": [
"name",
"type"
]
},
"console-server-port": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"$ref": "file://generated_schema.json#/definitions/console-port-properties"
}
},
"required": [
"name",
"type"
]
}, |
Hello again. Thanks this great library. I now realize this is a known issue, or the very least, related to a known issue. From the README, nested names aren't supported yet.
I thought this meant included a nested def from somewhere else in the file. But - it does seem to apply equally well to properties. And indeed in the code, there is a TODO item for this. The top level names work, but properties is part of a sub-path. I wrote some rather horrible code for properties. This works "for me", but seems like the wrong approach (splitting the string).
|
I am trying to make CVE JSON 5.0 bundle.json from CVE Schema work, but I run into:
go-jsonschema: Failed: could not generate type for field "metrics": could not generate type for field "cvssV2_0": could not generate type for field "accessComplexity": definition does not exist in schema: "metrics/items/properties/cvssV2_0/definitions/accessComplexityType" (from ref "#/definitions/metrics/items/properties/cvssV2_0/definitions/accessComplexityType")
As far as I can tell
accessComplexityType
does exist.Does anybody have an idea what I am missing here?
The text was updated successfully, but these errors were encountered: