Skip to content

Commit

Permalink
Remove $schema from generated schema
Browse files Browse the repository at this point in the history
The resource fails to create with `$schema`.
  • Loading branch information
kazk committed Dec 19, 2020
1 parent 52beb01 commit 436f7ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion examples/crd_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ fn verify_crd() {
],
"schema": {
"openAPIV3Schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"description": "Auto-generated derived type for MyFoo via `CustomResource`",
"properties": {
"spec": {
Expand Down
3 changes: 2 additions & 1 deletion kube-derive/src/custom_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,10 @@ impl CustomDerive for CustomResource {
let crd_meta = quote! { { "name": #crd_meta_name } };
let jsondata = if apiextensions == "v1" {
quote! {
// Don't use definitions
// Don't use definitions and don't include `$schema` because these are not allowed.
let gen = schemars::gen::SchemaSettings::openapi3().with(|s| {
s.inline_subschemas = true;
s.meta_schema = None;
}).into_generator();
let schema = gen.into_root_schema_for::<Self>();
let jsondata = serde_json::json!({
Expand Down

0 comments on commit 436f7ab

Please sign in to comment.