Skip to content
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

Nested structs are not created #67

Open
AWhetter opened this issue Jan 17, 2020 · 5 comments
Open

Nested structs are not created #67

AWhetter opened this issue Jan 17, 2020 · 5 comments

Comments

@AWhetter
Copy link

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?

@AWhetter
Copy link
Author

Actually even if I include that remote schema, DefImpact still isn't created.

@AWhetter AWhetter changed the title Not all missing references are reported? Not all structs are created Jan 17, 2020
@AWhetter AWhetter changed the title Not all structs are created Nested structs are not created Jan 17, 2020
@AWhetter
Copy link
Author

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.

@bhearsum
Copy link

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 {
}

@ls-emilio-assuncao
Copy link

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.

@andrewpollock
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants