encoding/openapi: ynable to generate OpenAPI Schema due to non-concrete value bounding
What version of CUE are you using (cue version)?
$ cue version v0.12.0 (Go Mod import)
Does this issue reproduce with the latest stable release?
#Resource: {
requests: {
cpu: number
memory: number
}
limits: {
cpu: number & >= requests.cpu
memory: number & >= requests.memory
}
}
What did you do?
Using Go API to generate OpenAPI V3 Schema generates the following error,
#parameter.deployment.resource.limits.cpu: non-concrete value requests.cpu for bound >=
Follow the method described in the doc, https://cuelang.org/docs/concept/how-cue-works-with-openapi/
What did you expect to see?
v0.5.x does not report this error
What did you see instead?
I understand that OpenAPI does not support this feature, so we may provide an option to ignore such unsupported features?
This issue may be caused by https://github.com/cue-lang/cue/commit/e1ceed434f211be0c6bdd3d8fea767765b1b0b92
@lujiajing1126 - please can you include some example CUE that reproduces the problem?
@lujiajing1126 - please can you include some example CUE that reproduces the problem?
#Resource: {
requests: {
cpu: number
memory: number
}
limits: {
cpu: >=requests.cpu & {
number
}
memory: >=requests.memory & {
number
}
}
}
An example pasted above
Thanks @lujiajing1126 - please can you confirm what OpenAPI you would expect to be output here?
cc @rogpeppe
Friendly nudge @lujiajing1126 - what would you expect the OpenAPI output here to be?
Friendly nudge @lujiajing1126 - what would you expect the OpenAPI output here to be?
Sorry for the late reply.
openapi: 3.0.0
info:
title: Generated by cue.
version: no version
paths: {}
components:
schemas:
Resource:
type: object
required:
- requests
- limits
properties:
requests:
type: object
required:
- cpu
- memory
properties:
cpu:
type: number
memory:
type: number
limits:
type: object
required:
- cpu
- memory
properties:
cpu:
type: number
memory:
type: number
This is what I expect, generated by cue v0.5.0. I understand for OpenAPI V3 Schema, it is not possible to compare two fields.