Skip to content

feat: support cue exp gengotypes#125

Merged
eddie-knight merged 1 commit intoossf:mainfrom
trumant:support-go-type-gen
Apr 28, 2025
Merged

feat: support cue exp gengotypes#125
eddie-knight merged 1 commit intoossf:mainfrom
trumant:support-go-type-gen

Conversation

@trumant
Copy link
Contributor

@trumant trumant commented Apr 8, 2025

This PR adds make cuegen which when run will produce output like > Generating types from cue schema ... and the file cue_types_gen.go

Additional tasks: make lintcue and make lintyml are added to ensure that contributors and CI are able to run the same linting processes easily inside and outside of GitHub Actions.

@trumant trumant force-pushed the support-go-type-gen branch from 289992b to 2d431ac Compare April 8, 2025 20:09
This PR adds comments and `@go` annotations to the schema
so we can use [cue exp gengotypes](https://cuelang.org/docs/reference/command/cue-help-exp-gengotypes/)
to generate the code in `ossf/si-tooling`.

A Makefile is added and integrated in the CI workflow
to ensure the cue schema and example files can be consistently validated
by contributors and in CI.

Signed-off-by: Travis Truman <trumant@gmail.com>
@trumant trumant force-pushed the support-go-type-gen branch from 2d431ac to 997afbc Compare April 27, 2025 13:31
@trumant trumant changed the title POC: schema changes to support cue exp gengotypes feat: support cue exp gengotypes Apr 27, 2025
@trumant trumant marked this pull request as ready for review April 27, 2025 13:36
trumant added a commit to trumant/si-tooling that referenced this pull request Apr 27, 2025
This PR updates the v2 go source to use the results
of running `cue exp gengotypes` against the canonical
schema in ossf/security-insights-spec

Additional supporting changes added in this PR are:
- Makefile for common CI/contributor tasks
- replace gopkg.in/yaml.v3 with github.com/goccy/go-yaml
- CI workflows to run the tests

The generated code here is based on the changes in ossf/security-insights#125

Signed-off-by: Travis Truman <trumant@gmail.com>
@@ -1,4 +1,5 @@
//// Definitions ////
package security_insights_spec
@go("si") // this doesn't appropriately override the package name in the generated code currently due to a bug in cue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddie-knight eddie-knight merged commit 3953b12 into ossf:main Apr 28, 2025
2 checks passed
@trumant trumant deleted the support-go-type-gen branch April 28, 2025 13:22
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.

2 participants