-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from solo-io/disable-validation-option
Add option to disable kubebuilder markers
- Loading branch information
Showing
7 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
changelog: | ||
- type: NEW_FEATURE | ||
issueLink: https://github.com/solo-io/gloo-mesh-enterprise/issues/17005 | ||
resolvesIssue: false | ||
description: | | ||
Adds support for disabling kubebuilder markers and validations to omit them from the generated OpenAPI schema. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
components: | ||
schemas: | ||
test7.Msg: | ||
description: This is a top-level message. | ||
properties: | ||
a: | ||
format: int32 | ||
type: integer | ||
blist: | ||
items: | ||
type: string | ||
type: array | ||
nested: | ||
properties: | ||
a: | ||
type: string | ||
b: | ||
type: string | ||
c: | ||
type: string | ||
d: | ||
type: string | ||
defaultValue: | ||
type: string | ||
embedded: | ||
type: string | ||
intOrString: | ||
type: string | ||
schemaless: | ||
description: Schemaless field | ||
type: string | ||
type: object | ||
object: | ||
description: Should maintain valid Type marker. | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
val: | ||
x-kubernetes-preserve-unknown-fields: true | ||
type: object | ||
info: | ||
title: OpenAPI Spec for Solo APIs. | ||
version: "" | ||
openapi: 3.0.1 | ||
paths: null |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
syntax = "proto3"; | ||
|
||
package test7; | ||
|
||
import "struct.proto"; | ||
|
||
// This is a top-level message. | ||
// | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
message Msg { | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
Nested nested = 1; | ||
|
||
// +kubebuilder:validation:Maximum=100 | ||
// +kubebuilder:validation:Minimum=5 | ||
// +kubebuilder:validation:ExclusiveMaximum=true | ||
// +kubebuilder:validation:ExclusiveMinimum=true | ||
// +kubebuilder:validation:MultipleOf=2 | ||
// +kubebuilder:validation:XValidation:rule="self != 27",message="must not equal 27" | ||
int32 a = 2; | ||
|
||
// +kubebuilder:validation:MinItems=1 | ||
// +kubebuilder:validation:MaxItems=5 | ||
// +kubebuilder:validation:UniqueItems=true | ||
repeated string blist = 3; | ||
|
||
// +kubebuilder:validation:Type=value | ||
google.protobuf.Value val = 4; | ||
|
||
// Should maintain valid Type marker. | ||
// | ||
// +kubebuilder:validation:Type=object | ||
google.protobuf.Struct object = 5; | ||
|
||
// This is a nested message. | ||
// | ||
// +kubebuilder:validation:MinProperties=1 | ||
// +kubebuilder:validation:MaxProperties=2 | ||
message Nested { | ||
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9_]*$" | ||
// +kubebuilder:validation:Required | ||
string a = 1; | ||
|
||
// +kubebuilder:validation:Enum=Allow;Forbid;Replace | ||
// +kubebuilder:validation:Required | ||
string b = 2; | ||
|
||
// +kubebuilder:validation:MaxLength=100 | ||
// +kubebuilder:validation:MinLength=1 | ||
string c = 3; | ||
|
||
// +kubebuilder:validation:Format=date-time | ||
string d = 4; | ||
|
||
// +kubebuilder:validation:XIntOrString | ||
string int_or_string = 5; | ||
|
||
// +kubebuilder:default=forty-two | ||
// +kubebuilder:example=forty-two | ||
string default_value = 6; | ||
|
||
// Schemaless field | ||
// | ||
// +kubebuilder:validation:Schemaless | ||
string schemaless = 7; | ||
|
||
// +kubebuilder:validation:EmbeddedResource | ||
// +kubebuilder:validation:Nullable | ||
string embedded = 8; | ||
} | ||
} | ||
|