Skip to content

Conversation

@majiayu000
Copy link

@majiayu000 majiayu000 commented Dec 30, 2025

Fixes #8983

Changes

  • Add hack/jsonschema-gen/main.go: Tool to extract OpenAPIV3Schema from CRDs and convert to JSON Schema
  • Add hack/update-jsonschema.sh: Script to run the generator
  • Add schema/ directory with pre-generated JSON Schema files for v1, v1beta1, v1alpha1 APIs

Details

The generated schemas:

  • Use JSON Schema draft 2020-12
  • Are self-contained with no external $ref dependencies
  • Filter out Kubernetes-specific extensions (x-kubernetes-*)
  • Include proper $schema and $id metadata

Test plan

  • Unit tests pass for jsonschema-gen tool
  • Generated JSON files are valid JSON Schema
  • Schemas contain no external references ($ref)
Add self-contained JSON Schema generation tool for Tekton CRDs, enabling IDE autocompletion and validation

This change adds tooling to generate bundled JSON Schema files from
Tekton CRDs for external validation use cases. The generated schemas
can be used by IDEs, validation tools, and contributed to schemastore.org.

Changes:
- Add hack/jsonschema-gen/main.go: Tool to extract and convert
  OpenAPIV3Schema from CRDs to JSON Schema format
- Add hack/update-jsonschema.sh: Script to generate JSON schemas
- Add schema/ directory with generated JSON Schema files for all
  API versions (v1, v1beta1, v1alpha1)

The generated schemas:
- Use JSON Schema draft 2020-12
- Are self-contained with no external $ref dependencies
- Filter out Kubernetes-specific extensions (x-kubernetes-*)
- Include proper $schema and $id metadata

Fixes tektoncd#8983

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: majiayu000 <1835304752@qq.com>
@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Dec 30, 2025
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign wlynch after the PR has been reviewed.
You can assign the PR to them by writing /assign @wlynch in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Missing self-contained JSON Schema for Tekton resource validation

2 participants