Skip to content

Commit b06c666

Browse files
committed
feat: extend copilot instruction for meshEntity refs
1 parent 78000bd commit b06c666

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/.copilot-instructions.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,38 @@ Resources use consistent schema structures:
8383
- `spec` - Object specification (user-defined configuration)
8484
- `status` - Object status (system-managed state)
8585

86+
### meshEntity Reference Pattern
87+
When referring to other meshEntities (like `project_role_ref` in landingzone resources), implement them with this pattern:
88+
- **User provides**: Only the `name` attribute (required)
89+
- **System sets**: The `kind` attribute automatically (computed with default value)
90+
91+
Example implementation:
92+
```go
93+
schema.SingleNestedAttribute{
94+
MarkdownDescription: "the meshProject role",
95+
Required: true,
96+
Attributes: map[string]schema.Attribute{
97+
"name": schema.StringAttribute{
98+
Required: true,
99+
MarkdownDescription: "The identifier of the meshProjectRole",
100+
},
101+
"kind": schema.StringAttribute{
102+
MarkdownDescription: "meshObject type, always `meshProjectRole`.",
103+
Computed: true,
104+
Default: stringdefault.StaticString("meshProjectRole"),
105+
Validators: []validator.String{
106+
stringvalidator.OneOf([]string{"meshProjectRole"}...),
107+
},
108+
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
109+
},
110+
},
111+
}
112+
```
113+
114+
This pattern ensures:
115+
- Simplified user experience (only need to specify the name)
116+
- Consistent reference structure across all meshEntity references
117+
86118
## Common Development Tasks
87119

88120
### Adding a New Resource

0 commit comments

Comments
 (0)