Open AWhetter opened 4 years ago
Actually even if I include that remote schema, DefImpact still isn't created.
I eventually got this to work by moving the definition of baseMetricV2 and baseMatricV3 to top level definitions, and def_impact
references those definitions. So it appears that nested structs are what is not created.
I can reproduce this with https://raw.githubusercontent.com/mozilla-releng/balrog/main/src/auslib/blobs/schemas/apprelease-v4.yml. Neither the fileUrls
nor platforms
structs get created with useful contents. Instead, I have:
// FileUrls Key/value pairs where the key is a platform name (aka Build Target) and the values are the platform specific details.
type FileUrls struct {
}
// Platforms Key/value pairs whose keys are the names of platforms (aka Build Targets) and values are platform-specific update details.
type Platforms struct {
}
I don't think this is an intended use-case of this tool -- what is possible however, is to write a go generate
script that more or less tailors the logic in https://github.com/a-h/generate/blob/master/cmd/schema-generate/main.go with the added step of pulling nested definitions when needed. This is what I'll be doing.
I've just encountered the exact same use case as @AWhetter today, and @ls-emilio-assuncao I was wondering if you have anything you can share about how you resolved your need?
I'm new to go so I apologise for the lack of details here, but I'm trying to convert https://csrc.nist.gov/schema/nvd/feed/1.1/nvd_cve_feed_json_1.1.schema to go structs. It references https://csrc.nist.gov/schema/nvd/feed/1.1/CVE_JSON_4.0_min_1.1.schema. I've downloaded both and I'm running using
~/go/bin/schema-generate ~/Downloads/CVE_JSON_4.0_min_1.1.schema.json ~/Downloads/nvd_cve_feed_json_1.1.schema.json
. The output file cannot be compiled, and fails with./structs.go:52:11: undefined: DefImpact
.def_impact
references another remote schema which I haven't included, so I think it's failing to report that it's missing another schema?