You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Schemas for datasets, groups, and organizations can be defined using either **JSON** or **YAML** files. The extension [automatically detects the format based on the file extension](./ckanext/scheming/loader.py) (`.json`, `.yaml`, or `.yml`). While examples often show YAML for datasets and JSON for organizations, you are free to use whichever format you prefer for any entity type.
105
+
103
106
## Schema Types
104
107
With this plugin, you can customize the group, organization, and dataset entities in CKAN. Adding and enabling a schema will modify the forms used to update and create each entity, indicated by the respective `type` property at the root level. Such as `group_type`, `organization_type`, and `dataset_type`. Non-default types are supported properly as is indicated throughout the examples.
105
108
@@ -261,10 +264,9 @@ A single `fields` list replaces the `dataset_fields` and `resource_fields` schem
261
264
## Field Keys
262
265
### `field_name`
263
266
264
-
The `field_name` value is the name of an existing CKAN dataset or resource
265
-
field or a new extra field. Existing dataset
266
-
field names include:
267
+
The `field_name` value is the name of an existing CKAN dataset or resource field (columns in the `package` or `resource` database tables) or a new extra field.
267
268
269
+
Existing dataset field names include (but are not limited to):
268
270
* `name` - the URI for the dataset
269
271
* `title`
270
272
* `notes` - the dataset description
@@ -273,9 +275,10 @@ field names include:
273
275
* `maintainer`
274
276
* `maintainer_email`
275
277
276
-
New field names should follow the current lowercase_with_underscores
277
-
naming convention. Don't name your field `mySpecialField`, use
278
-
`my_special_field`instead.
278
+
New field names should follow the current lowercase_with_underscores naming convention. Don't name your field `mySpecialField`, use `my_special_field` instead.
279
+
280
+
>[!NOTE]
281
+
> The `ckan_dataset.yaml` file provided in this extension is just an example schema that mirrors standard CKAN behavior. It defines many of these standard fields, but you are free to include or exclude them in your custom schemas.
279
282
280
283
281
284
### `label`
@@ -331,6 +334,30 @@ for each group.
331
334
label: Phone Number
332
335
```
333
336
337
+
* `label`: This is the human-readable label for the **entire group** of repeating fields (e.g., "Contacts"). It typically appears as the header for the section.
338
+
* `repeating_label`: This is the label used for the **singular item**, often used in the "Add [Label]" button (e.g., "Add Contact").
339
+
340
+
Both `label` and `repeating_label` support internationalization dictionaries:
341
+
342
+
```yaml
343
+
- field_name: contacts
344
+
label:
345
+
en: Contacts
346
+
es: Contactos
347
+
repeating_label:
348
+
en: Contact
349
+
es: Contacto
350
+
repeating_subfields:
351
+
352
+
- field_name: address
353
+
label:
354
+
en: Address of the contact point
355
+
es: Dirección del punto de contacto
356
+
required: true
357
+
358
+
...
359
+
```
360
+
334
361
335
362
### `start_form_page`
336
363
@@ -451,7 +478,10 @@ the default value for this field.
451
478
### `preset`
452
479
453
480
A `preset` specifies a set of default values for other field keys. They
454
-
allow reuse of definitions for validation and snippets for common field types.
481
+
allow reuse of definitions for validation and snippets for common field types.
482
+
483
+
>[!TIP]
484
+
> Presets can be used for all schemas: **datasets, groups, and organizations.**
455
485
456
486
This extension includes the following presets in [presets.json](ckanext/scheming/presets.json):
457
487
@@ -647,7 +677,7 @@ Internally all extra fields are stored as strings. If you are attempting to save
647
677
648
678
For example if you use a simple "yes/no" question, you will need to let ckanext-scheming know that this data needs to be stored *and retrieved* as a boolean. This is acheieved using [`validators`](#validators) and [`output_validators`](#output_validators) keys.
649
679
650
-
```
680
+
```yaml
651
681
- field_name: is_camel_friendly
652
682
label: Is this camel friendly?
653
683
required: true
@@ -672,8 +702,28 @@ sent to the user.
672
702
673
703
### `create_validators`
674
704
675
-
The `create_validators` value if present overrides `validators` during
676
-
create only.
705
+
The `create_validators` value, if present, overrides `validators` **during creation only**.
706
+
When updating an existing record, the standard `validators` list is used instead.
707
+
708
+
This is useful for:
709
+
- Fields that are mandatory when creating a dataset but read-only or optional during updates.
710
+
- Setting initial default values or identifiers that shouldn't be validated the same way afterwards.
0 commit comments