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

[ISSUE-196] Fix JSON schema inconsistency #197

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jameskim0987
Copy link

@jameskim0987 jameskim0987 commented Sep 25, 2024

Fixes #196

Changes made in this PR:
1. fix type array to object since Data is of type pointer to ComponentData

@jameskim0987 jameskim0987 marked this pull request as ready for review September 25, 2024 16:40
@jameskim0987 jameskim0987 requested a review from a team as a code owner September 25, 2024 16:40
@jameskim0987 jameskim0987 force-pushed the issue-196-fix-json-schema-for-data branch from d46c295 to 4c3f071 Compare September 25, 2024 16:49
@nscuro
Copy link
Member

nscuro commented Sep 26, 2024

Thanks for the PR @jameskim0987! Unfortunately it's the opposite of what needs to be done.

The schema is defined by the CycloneDX specification: https://github.com/CycloneDX/specification/tree/master/schema

But our Go code is not adhering to it correctly, as detailed in #196. So the solution would be to modify the Go code, not the schema.

@jameskim0987 jameskim0987 force-pushed the issue-196-fix-json-schema-for-data branch from f031bdf to e3b655e Compare September 26, 2024 18:16
@jameskim0987
Copy link
Author

@nscuro Thanks for the clarification. I made the small change to the field type.
I have some questions:

  1. In the code base, I see if conditions for checking spec version. For examplebom-1.6.schema.json, does it belong to if specVersion < SpecVersion1_6 blocks or if specVersion < SpecVersion1_7 blocks (which doesn't seem to exist yet).
  2. How should I go about patching/adding tests for this specific field?
  3. I see a recursive func for Component
    func recurseComponent(component *Component, f func(c *Component)) {
    . From top level overview how does it work and would we have to do something similar for Data *[]ComponentData?

@jameskim0987
Copy link
Author

@nscuro Hi, would you be able to address the comment above when you get a chance? Thank you!

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

Successfully merging this pull request may close these issues.

JSON schema is not consistent with the golang structure
2 participants