Add a `crossplane xrd lint` command
Nobody has claimed this yet.
- #6385 by @undefinedhuman — closed without merging
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go, kubernetes, openapi
- Domain
- api, backend-api-design, cli
Research direction
Start at the crossplane xrd lint command and compare its intended scope with crossplane beta validate. Review the linked API design best-practices documentation and determine which XRD checks are in scope, including status requirements, array names, boolean enums, merge extensions, and field descriptions. Done means the command reports actionable lint findings for the agreed checks.
Written by the indexing model from the issue text.
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
namefield. - 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
- Dominant language
- Go
- Stars
- 19
- Forks
- 31
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 53
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from crossplane/cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
crossplane/cli#282 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
crossplane/cli#384 ·
-
crossplane/cli#379 · 1 assignee ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 68/100
crossplane/cli#370 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 28/100
crossplane/cli#369 ·
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
googleapis/librarian#7670 · 2 comments ·