fix(cmd): emit enum values and filter hidden definitions in cue2openapi - #461
Draft
eddie-knight wants to merge 2 commits into
Draft
fix(cmd): emit enum values and filter hidden definitions in cue2openapi#461eddie-knight wants to merge 2 commits into
eddie-knight wants to merge 2 commits into
Conversation
- Disjunctions of string literals now emit OpenAPI enum values (handles nested chains and *"default" markers). - Hidden definitions (#_Name) are omitted from output; refs to them are rewritten to the visible definition they constrain. - Hidden struct fields (_name) no longer leak as properties. - make test now also runs the cmd/ test suite in CI. Signed-off-by: Eddie Knight <knight@linux.com>
…er tests - Error out in the pre-pass when a #_ definition does not unify with a visible definition, instead of silently leaving it in the output where it only surfaced as a confusing leak-check test failure. - Document that ref rewriting intentionally drops the hidden definition's extra constraints, that findBaseIdent ignores attribute-only structs, and that CUE default markers are deliberately not emitted as OpenAPI defaults. - Treat only unquoted _name labels as hidden fields; a quoted "_name" is an exported CUE field. - Assert exact enum values (citing their CUE sources), assert the rewritten $ref structurally instead of via a loose substring match, and add a table test for collectEnumStrings' non-enum fallback. - Run the test suites with -count=1: they read *.cue schemas at runtime, which Go's test cache cannot track. Signed-off-by: Eddie Knight <knight@linux.com>
20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description 🤖
Downstream impact
Although no CUE schemas change, the generated
generated/openapi.yaml(published as a release asset and consumed by@gemara/react's type generation) changes shape: 17 schemas gainenum(generated TS types become literal unions instead ofstring), two$refs move from_MappingStrict/_AssessmentLogStricttoMapping/AssessmentLog, and two hidden schemas plus two hidden fields disappear from the output.Schema Changes
Schema Changes Made
auditlog.cue) changescapabilitycatalog.cue) changescontrolcatalog.cue) changesenforcementlog.cue) changesevaluationlog.cue) changesguidancecatalog.cue) changesmappingdocument.cue) changespolicy.cue) changesprinciplecatalog.cue) changesriskcatalog.cue) changesthreatcatalog.cue) changesvectorcatalog.cue) changesSchema Change Details
Testing
Related Issues
Reviewer Hints
Self-review checklist