Open andrewpollock opened 10 months ago
Definitions are handled. What seems to be tripping things up is the lack of type declaration for the defintion of def_cve_item
- I'm no expert on the various spec versions, but it looks like they should be explicitly stated in draft-07
After manually patching "type": "object"
in, I get the following:
type DefCveItem struct {
// Cve corresponds to the JSON schema field "cve".
Cve CveItem `json:"cve" yaml:"cve" mapstructure:"cve"`
}
I'm here after trying and failing to use https://github.com/a-h/generate (for my use case), running into a fresher variation of https://github.com/a-h/generate/issues/67 there...
My use case is similar to what's described in aforementioned issue: I'd like to generate structs from https://csrc.nist.gov/schema/nvd/api/2.0/cve_api_json_2.0.schema and that seems to involve something Moderately Complex (I am far from a JSON spec guru).
Where
schema-generate -p cves /tmp/cve_api_json_2.0.schema
generates:and then fails define
DefCveItem
at all, producing something that isn't compiler-satisfactory,with
go-jsonschema -p cves /tmp/cve_api_json_2.0.schema
at least I get:this just leaves the definition of
DefCveItem
a little... non-specific for my liking/needs.