feat(api): POST /api/admin/field-definitions (create field definition)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 14:09:08 +02:00
parent b490db13b1
commit b508273a52
4 changed files with 374 additions and 4 deletions
+75 -1
View File
@@ -30,7 +30,12 @@ export interface paths {
/** List all field definitions. Requires `ViewInternal`. */
get: operations["list_field_definitions"];
put?: never;
post?: never;
/**
* Create a field definition. Requires `EditCatalogue`. All type/binding consistency
* (term needs a vocabulary, authority takes no vocabulary, scalars take no binding) is
* validated by `FieldType::from_parts`, which returns `None` for any bad combination.
*/
post: operations["create_field_definition"];
delete?: never;
options?: never;
head?: never;
@@ -339,6 +344,9 @@ export interface components {
kind: string;
labels: components["schemas"]["LabelView"][];
};
CreatedField: {
key: string;
};
CreatedId: {
id: string;
};
@@ -382,6 +390,16 @@ export interface components {
kind: string;
labels: components["schemas"]["LabelInput"][];
};
NewFieldDefinitionRequest: {
authority_kind?: string | null;
/** @description text | localized_text | integer | date | boolean | term | authority */
data_type: string;
group?: string | null;
key: string;
labels: components["schemas"]["LabelInput"][];
required: boolean;
vocabulary_id?: string | null;
};
NewTermRequest: {
external_uri?: string | null;
labels: components["schemas"]["LabelInput"][];
@@ -599,6 +617,62 @@ export interface operations {
};
};
};
create_field_definition: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["NewFieldDefinitionRequest"];
};
};
responses: {
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["CreatedField"];
};
};
/** @description Malformed vocabulary_id or authority_kind */
400: {
headers: {
[name: string]: unknown;
};
content?: never;
};
401: {
headers: {
[name: string]: unknown;
};
content?: never;
};
403: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Duplicate key */
409: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Inconsistent type/binding */
422: {
headers: {
[name: string]: unknown;
};
content?: never;
};
};
};
login: {
parameters: {
query?: never;