Skip to content

Commit

Permalink
Feat: add override attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenguigui authored Apr 25, 2024
1 parent 0e3f0e9 commit 27fa94c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/apis/hub/v1alpha1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type OpenAPISpec struct {
// +kubebuilder:validation:XValidation:message="must be a valid URL",rule="isURL(self)"
URL string `json:"url,omitempty"`

// Override holds data used to override OpenAPI specification.
// +optional
Override *Override `json:"override,omitempty"`

// Path specifies the endpoint path within the Kubernetes Service where the OpenAPI specification can be obtained.
// The Service queried is determined by the associated Ingress, IngressRoute, or HTTPRoute resource to which the API is attached.
// It's important to note that this option is incompatible if the Ingress or IngressRoute specifies multiple backend services.
Expand All @@ -84,6 +88,13 @@ type OpenAPISpec struct {
OperationSets []OperationSet `json:"operationSets,omitempty"`
}

type Override struct {
// +kubebuilder:validation:MaxItems=100
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:XValidation:message="must be a valid URL",rule="self.all(x, isURL(x))"
Servers []string `json:"servers"`
}

// OperationSet gives a name to a set of matching OpenAPI operations.
// This set of operations can then be referenced for granular filtering in APIAccesses.
type OperationSet struct {
Expand Down
15 changes: 15 additions & 0 deletions pkg/apis/hub/v1alpha1/crd/hub.traefik.io_apis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@ spec:
type: object
maxItems: 100
type: array
override:
description: Override holds data used to override OpenAPI specification.
properties:
servers:
items:
type: string
maxItems: 100
minItems: 1
type: array
x-kubernetes-validations:
- message: must be a valid URL
rule: self.all(x, isURL(x))
required:
- servers
type: object
path:
description: Path specifies the endpoint path within the Kubernetes
Service where the OpenAPI specification can be obtained. The
Expand Down
15 changes: 15 additions & 0 deletions pkg/apis/hub/v1alpha1/crd/hub.traefik.io_apiversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ spec:
type: object
maxItems: 100
type: array
override:
description: Override holds data used to override OpenAPI specification.
properties:
servers:
items:
type: string
maxItems: 100
minItems: 1
type: array
x-kubernetes-validations:
- message: must be a valid URL
rule: self.all(x, isURL(x))
required:
- servers
type: object
path:
description: Path specifies the endpoint path within the Kubernetes
Service where the OpenAPI specification can be obtained. The
Expand Down
26 changes: 26 additions & 0 deletions pkg/apis/hub/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 27fa94c

Please sign in to comment.