Repository navigation
Conversation
jmeridth
left a comment
There was a problem hiding this comment.
🤖 (summary) Thanks for picking up #119. The schema now enforces what the project and repository descriptions already promised, and the conditionals hold in both directions. Two things to sort out before merge: the LLM prompt checksum and a question about generated Go types, both inline.
|
|
||
| // A file without `header.project-si-source` must carry its own project information. | ||
| if header["project-si-source"] == _|_ { | ||
| project!: #Project |
There was a problem hiding this comment.
🤖 (medium) Heads-up: cue exp gengotypes reads this conditional project! as always required, so the generated Go field loses omitempty. ossf/si-tooling generates its types that way, so a regenerate there would start writing a project key into child files. As far as I can tell the @go optional attributes don't fix it, and splitting the rules into a separate definition does but needs parser changes. Is that worth handling here, or better as a follow-up with si-tooling?
There was a problem hiding this comment.
Thx for the heads-up, I haven't run gengotypes against this. I'd rather leave the Go types to a follow-up with si-tooling than add parser changes here, unless you want it in this PR.
There was a problem hiding this comment.
🤖 A follow-up works for me. Could you open an issue on ossf/si-tooling describing the omitempty change, so it's tracked before the next type regeneration there?
A file without header.project-si-source now has to include project, and a child file that sets it has to include repository, which is what the field descriptions already say. The editor's CUE parser skips the conditional blocks so the fallback schema stays the same. Fixes ossf#119 Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Points SCHEMA_URL at the schema commit and updates SCHEMA_SHA256. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
1471593 to
c511cac
Compare
|
Opened ossf/si-tooling#80 to track it. |
Fixes #119
The descriptions of
projectandrepositoryalready say when each one is required, but the schema left both optional, so a file with neither passedcue vet. I added two conditional fields to#SecurityInsights: withoutheader.project-si-sourcethe file needsproject, and with it the file needsrepository. A parent file can still ship just header and project. I didn't forbidprojectin child files since the description only says to omit it.Notes
All the examples and
.github/security-insights.ymlstill validate. I added tests totests/schema/required-fields.test.js, and the two rejection cases fail without the schema change.The editor's
cue-parser.jsdidn't know aboutifblocks, so I made it skip them.make check-schema-fallbackpasses with no change to the fallback. cue2openapi ignores the conditionals for now, so the OpenAPI output doesn't change. I can add that in a follow-up if you want it there too.