cue
cue copied to clipboard
openapi export: (ExpandReferences: true) unsupported op for number &
What version of CUE are you using (cue version)?
$ cue version
cue version v0.15.0-rc.1
CUE language version v0.15.0
Go version go1.25.3
-buildmode exe
-compiler gc
-trimpath true
CGO_ENABLED 0
GOARCH arm64
GOOS darwin
GOARM64 v8.0
What did you do?
a.cue
#def: {
a: *100 | int64
b: int64
}
cue def a.cue --out openapi+yaml
When running under default cue v0.15.0-rc.1 I get two quite different outputs for a and b
openapi: 3.0.0
info:
title: Generated by cue.
version: no version
paths: {}
components:
schemas:
def:
type: object
required:
- a
- b
properties:
a:
type: integer
minimum: -9223372036854775808
maximum: 9223372036854775807
default: 100
b:
type: integer
format: int64
But when running under custom build where
https://github.com/cue-lang/cue/blob/82c321f237881dea51d0b383d3579ba6746a6acc/internal/encoding/encoder.go#L84
is set to ExpandReferences: true like
case build.OpenAPI:
cfg := &openapi.Config{
ExpandReferences: true,
}
Upon running the command, I get following error:
cue def a.cue --out openapi+yaml
#def.a: unsupported op for number &