Skip to content

feat: Allow custom type declaration in SimpleSchema - #238

Merged
haarchri merged 1 commit into
crossplane:mainfrom
BigGold1310:simpleschema-nested-types
Aug 3, 2026
Merged

haarchri merged 1 commit into
crossplane:mainfrom
BigGold1310:simpleschema-nested-types

Conversation

@BigGold1310

@BigGold1310 BigGold1310 commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Description of your changes

Allows the definition of custom types within a SimpleSchema declaration.
Looks like:

apiVersion: aws.u5d.io/v1
kind: XEKS
metadata:
  name: test
spec:
  request: myType
status:
  result: myType
customTypes:
  myType:
    value1: string | required=true
    value2: integer | default=42

Fixes #199

I have:

Need help with this checklist? See the cheat sheet.

Signed-off-by: Cyrill Näf <cyrill.naef@gmail.com>
@BigGold1310
BigGold1310 force-pushed the simpleschema-nested-types branch from 65f7793 to 410f1d8 Compare August 2, 2026 20:25
@BigGold1310
BigGold1310 marked this pull request as ready for review August 2, 2026 20:58
@BigGold1310
BigGold1310 requested review from a team, jcogilvie and tampakrap as code owners August 2, 2026 20:58
@BigGold1310
BigGold1310 requested review from haarchri and removed request for a team August 2, 2026 20:58
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The XRD generator now reads customTypes from SimpleSchema input and passes them to spec and status OpenAPI conversion. A table-driven test validates reusable nested objects, required fields, integer defaults, and generated XRD metadata.

Changes

SimpleSchema custom type support

Layer / File(s) Summary
Custom type schema generation
cmd/crossplane/xrd/generate.go, cmd/crossplane/xrd/generate_test.go
inputXR captures customTypes. SimpleSchema conversion uses the custom types for both spec and status. Tests validate nested request and result objects, required fields, integer typing, default value 42, and namespaced XRD metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: adamwg


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Feature Gate Requirement ❓ Inconclusive The feature-gate check may apply to this behavior change, but the repository’s feature-flag mechanism and experimental-feature criteria are not yet verified. Inspect existing feature gates and command behavior to determine whether this CLI enhancement requires a flag.
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation reads customTypes and passes them to both spec and status schema generation, with tests for reusable nested types.
Out of Scope Changes check ✅ Passed The code and test changes directly support custom type handling in SimpleSchema and contain no unrelated changes.
Breaking Changes ✅ Passed The change only adds optional customTypes handling in cmd/crossplane/xrd; it removes no public fields or flags and preserves existing SimpleSchema behavior.
Title check ✅ Passed The title is 51 characters, stays under 72 characters, and clearly describes support for custom types in SimpleSchema.
Description check ✅ Passed The description explains the customTypes feature, provides an example, references issue #199, and notes test coverage.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/crossplane/xrd/generate_test.go`:
- Around line 784-803: Update the comparison in the test around the generated
schema to include JSONSchemaProps.Required instead of globally ignoring it.
Ensure the assertions explicitly verify that both spec.request.Required and
status.result.Required contain value1, while preserving the existing comparisons
for other schema fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f39acff3-182f-4bfb-b03f-6a7628e4408c

📥 Commits

Reviewing files that changed from the base of the PR and between a3f848e and 410f1d8.

📒 Files selected for processing (2)
  • cmd/crossplane/xrd/generate.go
  • cmd/crossplane/xrd/generate_test.go

Comment thread cmd/crossplane/xrd/generate_test.go

@haarchri haarchri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haarchri
haarchri merged commit 082703a into crossplane:main Aug 3, 2026
10 of 11 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
crossplane 2.5.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* renovate: Add release-2.4 to the base branches by @adamwg in crossplane/cli#144
* validate: Use crossplane:stable as the default image by @adamwg in crossplane/cli#148
* chore(deps): update module github.com/sigstore/cosign/v2 to v2.6.3 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#150
* chore(deps): update module github.com/sigstore/rekor to v1.5.2 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#152
* fix(deps): update module github.com/docker/cli to v29.6.0+incompatible (main) by @crossplane-renovate[bot] in crossplane/cli#146
* fix(deps): update module github.com/emicklei/dot to v1.11.0 (main) by @crossplane-renovate[bot] in crossplane/cli#147
* fix(render): annotate functions when reusing an existing network by @jcogilvie in crossplane/cli#159
* render: Have the context function listen on a TCP port by @adamwg in crossplane/cli#163
* chore(deps): update module github.com/sigstore/cosign/v3 to v3.0.6 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#151
* fix(deps): update module github.com/docker/cli to v29.6.1+incompatible (main) by @crossplane-renovate[bot] in crossplane/cli#164
* chore(deps): update module oras.land/oras-go/v2 to v2.6.1 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#178
* chore(deps): update renovatebot/github-action action to v46.1.18 (main) by @crossplane-renovate[bot] in crossplane/cli#175
* projects: Correctly build multi-arch Python functions by @adamwg in crossplane/cli#192
* chore(deps): update module oras.land/oras-go/v2 to v2.6.2 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#189
* projects: Skip empty documents when applying init and extra resources by @ytsarev in crossplane/cli#208
* chore(deps): update module github.com/yuin/goldmark to v1.7.17 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#183
* fix(deps): update module github.com/crossplane/crossplane/apis/v2 to v2.3.4 (main) by @crossplane-renovate[bot] in crossplane/cli#209
* fix(deps): update module google.golang.org/grpc to v1.82.1 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#201
* Fix two potential race conditions in project-related code by @adamwg in crossplane/cli#171
* feat: add --json-schema flag to xrd convert by @fernandezcuesta in crossplane/cli#142
* validate: Recognize Kubernetes built-in resources by @ihopenre-eng in crossplane/cli#197
* chore(deps): update actions/checkout digest to d23441a (main) by @crossplane-renovate[bot] in crossplane/cli#217
* chore(deps): update actions/stale digest to 1e223db (main) by @crossplane-renovate[bot] in crossplane/cli#218
* fix(deps): update module github.com/getkin/kin-openapi to v0.144.0 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#222
* chore(deps): update module github.com/google/cel-go to v0.29.0 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#220
* chore(deps): update module github.com/go-chi/chi/v5 to v5.3.0 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#219
* chore(deps): update module github.com/sigstore/timestamp-authority/v2 to v2.1.0 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#174
* chore(deps): update module github.com/klauspost/compress to v1.18.7 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#227
* chore(deps): update cachix/install-nix-action digest to 630ae54 (main) by @crossplane-renovate[bot] in crossplane/cli#228
* build: Calculate checksums after the nix fixup phase by @adamwg in crossplane/cli#235
* chore(deps): update module github.com/sigstore/sigstore-go to v1.2.1 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#186
* chore(deps): update github/codeql-action digest to f205ea1 (main) by @crossplane-renovate[bot] in crossplane/cli#232
* fix(deps): update module github.com/docker/cli to v29.7.1+incompatible (main) by @crossplane-renovate[bot] in crossplane/cli#234
* chore(deps): update renovatebot/github-action action to v46.2.0 (main) by @crossplane-renovate[bot] in crossplane/cli#233
* feat: Allow custom type declaration in SimpleSchema by @BigGold1310 in crossplane/cli#238
* schemas: Indent .lock.json for readability by @Bham06 in crossplane/cli#231
* fix(common/load/streamToUnstructured): skip empty documents by @nkzk in crossplane/cli#241
* fix(deps): update module github.com/go-git/go-billy/v5 to v5.9.1 (main) by @crossplane-renovate[bot] in crossplane/cli#240
* chore(deps): update renovatebot/github-action action to v46.2.1 (main) by @crossplane-renovate[bot] in crossplane/cli#239
* feat: Add --replace flag to crossplane xrd generate by @BigGold1310 in crossplane/cli#243
* feat: add GetX/SetX accessors to generated Go models by @erikmiller-gusto in crossplane/cli#160
* generator: make generated Go types implement runtime.Object and provide AddToScheme by @erikmiller-gusto in crossplane/cli#162
* generator: make generated Go getters tolerate a nil receiver by @erikmiller-gusto in crossplane/cli#246
* chore(deps): update github/codeql-action digest to 5595cca (main) by @crossplane-renovate[bot] in crossplane/cli#244
* fix(deps): update module github.com/go-git/go-git/v5 to v5.19.2 (main) by @crossplane-renovate[bot] in crossplane/cli#245
* ci: fix Renovate's Nix updates and bump nixpkgs to nixos-26.05 by @jbw976 in crossplane/cli#257
* chore(deps): update renovatebot/github-action action to v46.2.2 (main) by @crossplane-renovate[bot] in crossplane/cli#261
* fix(deps): update module google.golang.org/protobuf to v1.36.12 (main) by @crossplane-renovate[bot] in crossplane/cli#262
* chore(deps): update dependency renovate to v44.23.3 (main) by @crossplane-renovate[bot] in crossplane/cli#260
* chore(deps): lock file maintenance (main) by @crossplane-renovate[bot] in crossplane/cli#258
* fix(deps): update module github.com/alecthomas/kong to v1.16.1 (main) by @crossplane-renovate[bot] in crossplane/cli#268
* chore(deps): update dependency renovate to v44.27.0 (main) by @crossplane-renovate[bot] in crossplane/cli#267
* chore(deps): update gomod2nix digest to 1201ddd (main) by @crossplane-renovate[bot] in crossplane/cli#259
* chore(deps): update korthout/backport-action action to v4.6.0 (main) by @crossplane-renovate[bot] in crossplane/cli#250
* chore(deps): update actions/checkout action to v6.1.0 (main) by @crossplane-renovate[bot] in crossplane/cli#249
* fix(ci): clean /homeless-shelter before Renovate's Nix commands by @jbw976 in crossplane/cli#279
* fix(deps): update module golang.org/x/mod to v0.40.0 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#271
* fix(schemas): fix Go model generation for validation-only combinators and shared k8s package collisions by @haarchri in crossplane/cli#269
* chore(deps): lock file maintenance (main) by @crossplane-renovate[bot] in crossplane/cli#272
* chore(deps): update cachix/install-nix-action digest to 13d8dd5 (main) by @crossplane-renovate[bot] in crossplane/cli#273
* chore(deps): update module github.com/google/cel-go to v0.30.0 [security] (main) by @crossplane-renovate[bot] in crossplane/cli#284
* fix(deps): update module github.com/getkin/kin-openapi to v0.147.0 (main) by @crossplane-renovate[bot] in crossplane/cli#280
* fix(deps): update module github.com/docker/go-connections to v0.8.1 (main) by @crossplane-renovate[bot] in crossplane/cli#276
* chore(deps): update dependency renovate to v44.33.2 (main) by @crossplane-renovate[bot] in crossplane/cli#275
* chore(deps): update github/codeql-action digest to ff2f1c6 (main) by @crossplane-renovate[bot] in crossplane/cli#274
* fix(dependency): generate schemas for transitive package dependencies by @haarchri in crossplane/cli#270
* fix(deps): update module github.com/google/go-containerregistry to v0.21.9 (main) by @crossplane-renovate[bot] in crossplane/cli#247
* chore(deps): lock file maintenance (main) by @crossplane-renovate[bot] in crossplane/cli#287

## New Contributors
* @ytsarev made their first contribution in crossplane/cli#208
* @ihopenre-eng made their first contribution in crossplane/cli#197
* @BigGold1310 made their first contribution in https:/

See merge request: Harmonybrew/homebrew-core!17385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XRD generation from simpleschema cannot define named nested types

2 participants