Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Aug 5, 2022
1 parent 6fd5980 commit 35ba0d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions kyaml/openapi/README.md
Expand Up @@ -31,14 +31,19 @@ You may need to update the version of Kind these scripts use by changing `KIND_V
In this directory, fetch the openapi schema, generate the
corresponding swagger.go for the kubernetes api, and update `kubernetesapi/openapiinfo.go`:

```
make all
```

If you want to run the steps individually instead of using `make all`, you can run
the following commands:

```
make kustomizationapi/swagger.go
make kubernetesapi/swagger.go
make kubernetesapi/openapiinfo.go
```

Then, follow the instructions in the next section to make the newly generated schema available for use.

You can optionally delete the old `swagger.pb` and `swagger.go` files if we no longer need to support that kubernetes version of
openapi data. Make sure you rerun `make kubernetesapi/openapiinfo.go` after deleting any old schemas.

Expand Down
8 changes: 4 additions & 4 deletions kyaml/openapi/openapi.go
Expand Up @@ -573,13 +573,13 @@ func SetSchema(openAPIField map[string]string, schema []byte, reset bool) error

// use builtin version
kubernetesOpenAPIVersion = version
if version == "" {
version = kubernetesapi.DefaultOpenAPI
if kubernetesOpenAPIVersion == "" {
return nil
}

if _, ok := kubernetesapi.OpenAPIMustAsset[version]; !ok {
if _, ok := kubernetesapi.OpenAPIMustAsset[kubernetesOpenAPIVersion]; !ok {
return fmt.Errorf("the specified OpenAPI version is not built in")
}

customSchema = nil
// if the schema is changed, initSchema should parse the new schema
globalSchema.schemaInit = false
Expand Down

0 comments on commit 35ba0d7

Please sign in to comment.