mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-16 17:33:14 +00:00
Merge pull request #3220 from natasha41575/OpenApiVersionField
Add multiple versions of OpenAPI schema to kyaml
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -395,9 +396,9 @@ func (rs *ResourceSchema) PatchStrategyAndKey() (string, string) {
|
||||
}
|
||||
|
||||
const (
|
||||
// kubernetesAPIAssetName is the name of the asset containing the statically compiled in
|
||||
// OpenAPI definitions for Kubernetes built-in types
|
||||
kubernetesAPIAssetName = "kubernetesapi/swagger.json"
|
||||
// kubernetesAPIDefaultVersion is the latest version number of the statically compiled in
|
||||
// OpenAPI schema for kubernetes built-in types
|
||||
kubernetesAPIDefaultVersion = kubernetesapi.DefaultOpenApi
|
||||
|
||||
// kustomizationAPIAssetName is the name of the asset containing the statically compiled in
|
||||
// OpenAPI definitions for Kustomization built-in types
|
||||
@@ -436,7 +437,11 @@ func initSchema() {
|
||||
}
|
||||
|
||||
// parse the swagger, this should never fail
|
||||
if err := parse(kubernetesapi.MustAsset(kubernetesAPIAssetName)); err != nil {
|
||||
assetName := filepath.Join(
|
||||
"kubernetesapi",
|
||||
kubernetesAPIDefaultVersion,
|
||||
"swagger.json")
|
||||
if err := parse(kubernetesapi.OpenApiMustAsset[kubernetesAPIDefaultVersion](assetName)); err != nil {
|
||||
// this should never happen
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user