Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: veepeeaee The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @veepeeaee! |
|
/hold |
|
/hold cancel |
|
/hold |
JoelSpeed
left a comment
There was a problem hiding this comment.
Is there a way that we could detect a loosening validation that went from format: string to oneOf: [{format: string}, {format: integer}]? This wouldn't necessarily break existing values, but could break older clients reading the types. Some may chose to allow this kind of change?
Any changes in Example - apiVersion: apiextensions.k8s.io/v1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: myresources.stable.example.com
spec:
group: stable.example.com
names:
plural: myresources
singular: myresource
kind: MyResource
shortNames:
- mr
scope: Namespaced
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
port:
- type: integer
- format: int32
+ oneOf:
+ - type: integer
+ format: int32
+ - type: string
+ format: uuidOutput I think this might be the best we can do with the current flattening-diff approach. Lmk what you think |
I don't think this is a limitation in the diff flattening approach actually. I think this is a limitation in having the individual validations reset the schema properties that they handle. I imagine that deferring that behavior instead of having that in each validation may unlock the ability to do more complex cross-property validations. I think the use case that @JoelSpeed is calling out here is absolutely reasonable for us to try and consider, but I think we need a bit more nuanced exploration into how we achieve that. In my head, I'm imaging some kind of more generic common logic shared between all validations that can automatically check if an existing schema configuration is still valid with a Without having reviewed this particular PR further, I'd say starting with implementing the basics is generally better than having nothing and this more complex behavior isn't something I'd likely block this PR on (although bonus points if you do get it implemented in this in a generically usable way). If we don't do it as part of this PR though, I would say we certainly should create an issue to track the need to do this work. |
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
Fix for #25
Depends on #37
Adds a validation for the
oneOfconstraint.The following changes are considered invalid -
oneOfconstraint where previously there was noneoneOfconstraintoneOfconstraintPotential improvements (in this or subsequent PRs)
oneOfconstraint?marshallSchemafunction tries to hash a schema based on the fields which are "structurally" relevant - here I've set fields like description and example to empty and converted the rest to json. Is there a better way/existing utility method?oneOfclause correctly, it doesn't prevent downstream validations from emitting false positives, because of index-wise comparison of the old and new sub-schemas (more details in the discussion in Property Validation:oneOf#25)