Pobieranie schematu typu kolumny
Każdy typ kolumny w monday.com ma unikalny schemat ustawień, który określa, jak można skonfigurować kolumnę. Obejmuje dostępne właściwości, ich typy, ograniczenia i dozwolone wartości. Zapytanie get_column_type_schema pozwala programowo pobrać ten schemat dla dowolnego obsługiwanego typu kolumny.
Przydaje się to szczególnie do:
- Tworzenia dynamicznych integracji, które muszą tworzyć lub konfigurować kolumny bez definiowania ustawień dla każdego typu na sztywno
- Obsługi agentów AI, które muszą znać strukturę i możliwości kolumn, aby prawidłowo odczytywać lub zapisywać dane
- Weryfikowania ustawień kolumn przed przekazaniem ich do mutacji
create_columnlub mutacji tworzących kolumny określonego typu, takich jakcreate_status_column
Zwracany schemat JSON jest zgodny ze specyfikacją JSON Schema draft-07. Opisuje obiekt settings dla danego typu kolumny, w tym nazwy i typy właściwości, wartości wyliczeniowe, ograniczenia tablic oraz wymagane pola.
Strona dokumentacji każdego typu kolumny zawiera gotowe zapytanie, za pomocą którego można pobrać jego schemat. Przykłady dla poszczególnych typów znajdziesz na stronach dokumentacji typów kolumn.
Zapytania
Pobieranie schematu typu kolumny
- Zwraca obiekt schematu JSON, który definiuje strukturę ustawień określonego typu kolumny
- Można je wywołać tylko bezpośrednio na poziomie głównym. Nie można go zagnieżdżać w innym zapytaniu
query {
get_column_type_schema(
type: board_relation
)
}
{
"data": {
"get_column_type_schema": {
"schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"settings": {
"type": "object",
"description": "Column specific settings",
"properties": {
"allowCreateReflectionColumn": {
"type": "boolean",
"description": "Whether to allow creation of reflection columns"
},
"allowMultipleItems": {
"type": "boolean",
"description": "Whether to allow selection of multiple items"
},
"boardIds": {
"type": "array",
"description": "Array of related board IDs",
"items": {
"type": "integer"
}
},
"boardId": {
"type": "integer",
"description": "Default board ID for the relation"
}
},
"additionalProperties": false
}
}
}
}
}
}
Argumenty
| Argument | Typ | Opis |
|---|---|---|
| type | ColumnType! |
Typ kolumny, dla którego chcesz pobrać schemat. |
Więcej przykładów
Kolumna statusu (Status)
Schemat kolumny statusu pokazuje pełną strukturę konfiguracji etykiet, w tym dostępne wartości kolorów, maksymalną liczbę etykiet i wymagane pola.
query {
get_column_type_schema(
type: status
)
}
{
"data": {
"get_column_type_schema": {
"schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"settings": {
"type": "object",
"description": "Column specific settings",
"properties": {
"type": {
"type": "string",
"description": "The type of managed column (status)"
},
"labels": {
"type": "array",
"maxItems": 40,
"description": "Array of status labels",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The unique identifier for the label"
},
"label": {
"type": "string",
"maxLength": 30,
"description": "The display text for the label"
},
"color": {
"oneOf": [
{
"type": "string",
"enum": ["working_orange", "done_green", "stuck_red", "..."],
"description": "The color name from StatusColumnColors enum"
},
{
"type": "integer",
"description": "The color value from StatusColumnColors enum"
}
]
},
"index": {
"type": "integer",
"minimum": 0,
"maximum": 39,
"description": "The display order of the label"
},
"is_done": {
"type": "boolean",
"description": "Whether the label represents a done state"
}
},
"required": ["label", "color", "index"]
}
}
},
"required": ["labels"]
}
}
}
}
}
}
Kolumna daty (Date)
Schemat kolumny daty pokazuje dostępne opcje wyświetlania i formatowania.
query {
get_column_type_schema(
type: date
)
}
{
"data": {
"get_column_type_schema": {
"schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"settings": {
"type": "object",
"description": "Column specific settings",
"properties": {
"show_current_year": {
"type": "boolean",
"description": "Whether to show the current year"
},
"show_week_day": {
"type": "boolean",
"description": "Whether to show the day of the week"
},
"show_time_by_default": {
"type": "boolean",
"description": "Whether to show time by default"
},
"hide_footer": {
"type": "boolean",
"description": "Whether to hide the footer"
},
"date_format": {
"type": "string",
"description": "Date format configuration"
},
"time_format": {
"type": "string",
"description": "Time format configuration"
}
},
"additionalProperties": false
}
}
}
}
}
}
Odczytywanie schematu
Odpowiedź to standardowy obiekt JSON Schema. Poniżej znajdziesz wyjaśnienie najważniejszych elementów:
| Właściwość schematu | Co określa |
|---|---|
properties |
Dostępne pola ustawień i ich strukturę |
type |
Oczekiwany typ danych (string, boolean, integer, array, object) |
enum |
Zbiór dozwolonych wartości, np. nazw kolorów lub typów obliczeń |
required |
Pola wymagane podczas tworzenia lub konfigurowania kolumny |
maxItems |
Maksymalną liczbę elementów w tablicy, np. 40 etykiet statusu |
maxLength |
Maksymalną długość tekstu, np. 30 znaków w etykiecie statusu |
additionalProperties |
Czy można dodawać pola inne niż wymienione (false = nie można) |
description |
Zrozumiały dla użytkownika opis działania danego pola |
Obsługiwane typy kolumn
Do argumentu type możesz przekazać dowolną z poniższych wartości ColumnType: