Skip to content

Commit 30c6935

Browse files
committed
Add list of supported types
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent ca19675 commit 30c6935

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,55 @@ The binary lands in `$(go env GOPATH)/bin` (usually `~/go/bin`). Make sure that
5454

5555
Head over to [https://github.com/cozystack/cozyvalues-gen/releases](https://github.com/cozystack/cozyvalues-gen/releases), grab the archive for your OS/arch, unpack it somewhere on your `$PATH`.
5656

57+
## Supported value types
58+
59+
| Annotation token | Go type | JSON Schema | Examples |
60+
| ------------------------------ | ------------------------------------------ | ----------------------- | ------------------------------------ |
61+
| `string` | `string` | string | `"hello"` |
62+
| `bool` | `bool` | boolean | `true` |
63+
| `int`, `int32`, `int64` | matching signed integer | number | `42` |
64+
| `float32`, `float64` | matching float | number | `3.14` |
65+
| `quantity` | `resource.Quantity` | string | `"500Mi"`, `"100m"`, `"4Gi"` |
66+
| `duration` | `metav1.Duration` | string | `"5m"`, `"1h30m"` |
67+
| `time` | `metav1.Time` | string (RFC 3339) | `"2025-08-07T12:00:00Z"` |
68+
| `object` | `k8sRuntime.RawExtension` | any JSON/YAML | `{"aaa": 123, "foo": "bar"}` |
69+
| `emptyobject` | empty struct (`struct{}`) **** no fields | `{}` | `{}` |
70+
| `*<primitive>` | pointer to that primitive (`nil` allowed) | primitive or `null` | `"asd"`, `null`|
71+
| `<CustomType>` | generated struct | object | declared from `@field` annotations |
72+
| `*<CustomType>` | pointer to generated struct | object or `null` | `null` |
73+
| `[]<T>` | slice / YAML sequence | list | `[]string`, `[]*int`, `[]CustomType` |
74+
| `map[string]<T>` | map / YAML mapping | object | keys are always **strings** |
75+
76+
### String-format aliases
77+
78+
These tokens map to a plain `string` field, **plus** `format: "<alias>"` in the OpenAPI schema:
79+
80+
| `format` | Example value |
81+
| --------------- | -------------------------------------- |
82+
| `bsonobjectid` | `507f1f77bcf86cd799439011` |
83+
| `uri` | `https://grafana.example.com` |
84+
| `email` | `user@example.com` |
85+
| `hostname` | `db.internal` |
86+
| `ipv4` | `192.168.0.10` |
87+
| `ipv6` | `2001:db8::1` |
88+
| `cidr` | `10.0.0.0/24` |
89+
| `mac` | `00:1A:2B:3C:4D:5E` |
90+
| `uuid`, `uuid3`, `uuid4`, `uuid5` | `550e8400-e29b-41d4-a716-446655440000` |
91+
| `isbn`, `isbn10`, `isbn13` | `9783161484100` |
92+
| `creditcard` | `4242 4242 4242 4242` |
93+
| `ssn` | `123-45-6789` |
94+
| `hexcolor` | `#ff8800` |
95+
| `rgbcolor` | `rgb(255,136,0)` |
96+
| `byte` | `SGVsbG8=` (base64) |
97+
| `password` | *(hidden by most UIs)* |
98+
| `date` | `2025-08-07` |
99+
100+
> **Tip:** use any alias exactly like a regular type, e.g.
101+
> ```yaml
102+
> ## @param apiURL {uri} External URL of the API
103+
> apiURL: ""
104+
> ```
105+
57106
---
58107
59108
Created for the Cozystack project. 🚀

0 commit comments

Comments
 (0)