<commit_before>---
kep-number: 0
title: Publish CRD OpenAPI
authors:
  - "@roycaihw"
owning-sig: sig-api-machinery
reviewers:
  - "@apelisse"
  - "@liggitt"
  - "@mbohlool"
  - "@sttts"
approvers:
  - "@liggitt"
  - "@sttts"
editor: TBD
creation-date: 2019-02-07
last-updated: 2019-02-11
status: provisional
see-also:
  - [Validation for CustomResources design doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/customresources-validation.md)
---

# Publish CRD OpenAPI

## Table of Contents

* [Table of Contents](#table-of-contents)
* [Summary](#summary)
* [Motivation](#motivation)
    * [Goals](#goals)
* [Proposal](#proposal)
    * [Build Schema/Definition](#build-schemadefinition)
    * [Build Spec](#build-spec)
    * [Aggregate and Publish Spec from apiextensions-apiserver](#aggregate-and-publish-spec-from-apiextensions-apiserver)
    * [Aggregate and Publish Spec from kube-aggregator](#aggregate-and-publish-spec-from-kube-aggregator)
    * [Risks and Mitigations](#risks-and-mitigations)
* [Graduation Criteria](#graduation-criteria)
* [Implementation History](#implementation-history)

## Summary

In CustomResourceDefinition (CRD) we allow CRD author to define OpenAPI v3 schema, to
enable server-side [validation for CustomResources (CR)](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/customresources-validation.md).
The validation schema format is compatible for creating OpenAPI documentation for CRs,
which can be used by clients like kubectl to perform client-side validation
(e.g. `kubectl create` and `kubectl apply`),
schema explanation (`kubectl explain`), and client generation.<commit_msg>mark crd openapi kep as implementable<commit_after>---
kep-number: 0
title: Publish CRD OpenAPI
authors:
  - "@roycaihw"
owning-sig: sig-api-machinery
reviewers:
  - "@apelisse"
  - "@liggitt"
  - "@mbohlool"
  - "@sttts"
approvers:
  - "@liggitt"
  - "@sttts"
editor: TBD
creation-date: 2019-02-07
last-updated: 2019-02-13
status: implementable
see-also:
  - [Validation for CustomResources design doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/customresources-validation.md)
---

# Publish CRD OpenAPI

## Table of Contents

* [Table of Contents](#table-of-contents)
* [Summary](#summary)
* [Motivation](#motivation)
    * [Goals](#goals)
* [Proposal](#proposal)
    * [Build Schema/Definition](#build-schemadefinition)
    * [Build Spec](#build-spec)
    * [Aggregate and Publish Spec from apiextensions-apiserver](#aggregate-and-publish-spec-from-apiextensions-apiserver)
    * [Aggregate and Publish Spec from kube-aggregator](#aggregate-and-publish-spec-from-kube-aggregator)
    * [Risks and Mitigations](#risks-and-mitigations)
* [Graduation Criteria](#graduation-criteria)
* [Implementation History](#implementation-history)

## Summary

In CustomResourceDefinition (CRD) we allow CRD author to define OpenAPI v3 schema, to
enable server-side [validation for CustomResources (CR)](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/customresources-validation.md).
The validation schema format is compatible for creating OpenAPI documentation for CRs,
which can be used by clients like kubectl to perform client-side validation
(e.g. `kubectl create` and `kubectl apply`),
schema explanation (`kubectl explain`), and client generation.
{'fraction_non_alphanumeric': 0.12955465587044535, 'fraction_numerical': 0.010410641989589358, 'mean_word_length': 5.154804270462633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '523798', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1105, 'n_words': 256}