crossplane / crossplane/cli

go schema generator fails when generating formatted string fields

Open
#312 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
19
Forks
31
Avg merge
3d 4h
Merged PRs (30d)
52

Description

### What happened?

My XRD Shema defines an email formatted string arrayfield.
This field is generated as `*[]openapi_types.Email`

Using this formats, the generated schema files will not compile due to 2 issues.

1. the import `openapi_types "github.com/oapi-codegen/runtime/types"` is missing
2. the openapi_types.Email does not implement the `DeepCopyInto` func

### How can we reproduce it?

Create a XRD defining a string array field with format email.

```yaml
members:
type: array
description: Member principal namees for the group
items:
type: string
format: email
pattern: '^[^@\s]+@[^@\s]+\.[^@\s]+$'
```

Put the XRD into apis/my-yrd/definition.yaml

Run `crossplane project build`

### What environment did it happen in?

* Crossplane CLI version: v2.5.0
* Platform (e.g., linux/amd64): linux/amd64
* Crossplane version (if applicable): not relevant

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by placing the shown XRD in apis/my-yrd/definition.yaml and running `crossplane project build`. Inspect the Go schema generator and its generated schema output for the formatted email array field. Done means the generated files compile, include the required runtime import, and handle the generated Email type's DeepCopyInto requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.