Skip to content

schemas: remove unnecessary ml-kem oneOf indirection#233

Merged
cpu merged 1 commit intoC2SP:mainfrom
cpu:cpu-mlkem-schema-tweaks
Apr 27, 2026
Merged

schemas: remove unnecessary ml-kem oneOf indirection#233
cpu merged 1 commit intoC2SP:mainfrom
cpu:cpu-mlkem-schema-tweaks

Conversation

@cpu
Copy link
Copy Markdown
Member

@cpu cpu commented Apr 13, 2026

oneOf with a single option doesn't offer us much, and comes at the cost of ugly code generation (e.g. interface{} types in generated Go code). Instead, just use a direct $ref of the one group definition in use.

Using go-jsonschema's output as an example:

Before:

  type MlkemTestSchemaJson struct {
  	// ...
  	TestGroups []interface{} `json:"testGroups"`
  }

After:

  type MlkemTestSchemaJson struct {
  	// ...
  	TestGroups []MLKEMTestGroup `json:"testGroups"`
  }

`oneOf` with a single option doesn't offer us much, and comes at the
cost of ugly code generation (e.g. `interface{}` types in generated Go
code). Instead, just use a direct `$ref` of the one group definition in
use.
@cpu cpu self-assigned this Apr 13, 2026
@cpu cpu merged commit acd97b2 into C2SP:main Apr 27, 2026
4 checks passed
@cpu cpu deleted the cpu-mlkem-schema-tweaks branch April 27, 2026 13:39
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