crossplane / crossplane/cli

Add a `crossplane xrd lint` command

Open
#69 9 comments 8 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
19
Forks
31
Avg merge
3d 4h
Merged PRs (30d)
52

Description

### What problem are you facing?

https://github.com/crossplane/docs/issues/564 tracks documenting best practices for API design. Put otherwise, best practices for writing XRDs. It occurred to me today that we could probably write a linter for a lot of these.

It could make sense for this to be part of `crossplane beta validate` too, but I think validation and linting are slightly different things. An XRD could have a valid OpenAPI schema, but one that we wouldn't recommend.

### How could Crossplane help solve your problem?

Add a linter for XRDs. Some things to look for:

* Overly restrictive status fields. Status fields aren't written by users, so they typically shouldn't be required, or generally validated beyond their type (e.g maximum integers, etc).
* Arrays of objects missing a `name` field.
* Boolean fields, which Kubernetes API conventions would typically recommend be enums.
* Missing server-side apply merge OpenAPI extensions where we'd expect them.
* General OpenAPI hygiene - fields missing descriptions etc

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.