Skip to content

Commit 0dd0804

Browse files
committed
fix(spec): the currency-object sentence cites ADR-0104 on the bare-number clause only
ADR-0104 decides that a currency value is a bare number; the tenant default comes from the currency-mode contract, not from the ADR. The cite moves next to the bare-number clause in all four locales and in the changeset's quoted sentence. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzenS8UJFmncftEGHsd
1 parent 6d7035f commit 0dd0804

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎.changeset/27236-currency-object-value-lesson.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Metadata-protocol: none
1212

1313
The `{ value, currency }` shape was retired by ADR-0104 D1. A record write that still sends it to a `currency` field was refused with only "Amount must be a number", which does not say what to write instead.
1414

15-
- **`@objectstack/objectql`**: when a `currency` field's value is a plain object, the `invalid_number` refusal now reads: "Amount is a currency amount: write it as a bare number (e.g. 10), not an object such as { value, currency }. A currency field declares its currency in currencyConfig: the fixed mode's defaultCurrency, or under the dynamic mode (the default) the tenant default currency (ADR-0104)". The wire code stays `invalid_number`, with no new key on the error, so no client contract moves. A non-number string, an array, and an object on a `number` field keep the plain sentence.
15+
- **`@objectstack/objectql`**: when a `currency` field's value is a plain object, the `invalid_number` refusal now reads: "Amount is a currency amount: write it as a bare number (ADR-0104), such as 10, not an object such as { value, currency }. A currency field declares its currency in currencyConfig: the fixed mode's defaultCurrency, or under the dynamic mode (the default) the tenant default currency". The wire code stays `invalid_number`, with no new key on the error, so no client contract moves. A non-number string, an array, and an object on a `number` field keep the plain sentence.
1616
- **`@objectstack/spec`**: the validation-message catalog carries that sentence as `invalid_number_currency_object`, in en, zh-CN, ja-JP and es-ES. A deployment can override it under `validation.field.invalid_number_currency_object`, like any other built-in message.
1717

1818
What to do: nothing. Writes that were accepted are still accepted, and writes that were refused are still refused with the same code.

‎packages/spec/src/system/validation-message.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const BUILTIN_VALIDATION_MESSAGES: Record<string, Record<string, string>>
116116
// as an object, the retired `{ value, currency }` shape (ADR-0104 D1). The
117117
// sentence names no currency code: the field's `currencyConfig` or the
118118
// tenant default decides it (#27119 Q2 = X).
119-
invalid_number_currency_object: '{{label}} is a currency amount: write it as a bare number (e.g. 10), not an object such as { value, currency }. A currency field declares its currency in currencyConfig: the fixed mode\'s defaultCurrency, or under the dynamic mode (the default) the tenant default currency (ADR-0104)',
119+
invalid_number_currency_object: '{{label}} is a currency amount: write it as a bare number (ADR-0104), such as 10, not an object such as { value, currency }. A currency field declares its currency in currencyConfig: the fixed mode\'s defaultCurrency, or under the dynamic mode (the default) the tenant default currency',
120120
invalid_boolean: '{{label}} must be true or false',
121121
invalid_date: '{{label}} must be a valid date (ISO-8601)',
122122
invalid_datetime: '{{label}} must be a valid datetime (ISO-8601)',
@@ -179,7 +179,7 @@ export const BUILTIN_VALIDATION_MESSAGES: Record<string, Record<string, string>>
179179
invalid_url: '{{label}}必须是有效的 URL(scheme://...)',
180180
invalid_phone: '{{label}}必须是有效的电话号码',
181181
invalid_number: '{{label}}必须是数字',
182-
invalid_number_currency_object: '{{label}}是货币金额:请直接写数字(如 10),不要写成 { value, currency } 这样的对象。币种在字段的 currencyConfig 中声明:fixed 模式取 defaultCurrency,dynamic 模式(默认)取组织默认币种(ADR-0104)',
182+
invalid_number_currency_object: '{{label}}是货币金额:请直接写数字(ADR-0104),如 10,不要写成 { value, currency } 这样的对象。币种在字段的 currencyConfig 中声明:fixed 模式取 defaultCurrency,dynamic 模式(默认)取组织默认币种',
183183
invalid_boolean: '{{label}}必须是 true 或 false',
184184
invalid_date: '{{label}}必须是有效的日期(ISO-8601)',
185185
invalid_datetime: '{{label}}必须是有效的日期时间(ISO-8601)',
@@ -225,7 +225,7 @@ export const BUILTIN_VALIDATION_MESSAGES: Record<string, Record<string, string>>
225225
invalid_url: '{{label}}は有効な URL(scheme://...)を入力してください',
226226
invalid_phone: '{{label}}は有効な電話番号を入力してください',
227227
invalid_number: '{{label}}は数値で入力してください',
228-
invalid_number_currency_object: '{{label}}は通貨金額です。{ value, currency } のようなオブジェクトではなく、数値のみ(例: 10)で入力してください。通貨はフィールドの currencyConfig で宣言します。fixed モードでは defaultCurrency、dynamic モード(既定)では組織の既定通貨です(ADR-0104)',
228+
invalid_number_currency_object: '{{label}}は通貨金額です。{ value, currency } のようなオブジェクトではなく、数値のみ(ADR-0104、例: 10)で入力してください。通貨はフィールドの currencyConfig で宣言します。fixed モードでは defaultCurrency、dynamic モード(既定)では組織の既定通貨です',
229229
invalid_boolean: '{{label}}は true または false で入力してください',
230230
invalid_date: '{{label}}は有効な日付(ISO-8601)を入力してください',
231231
invalid_datetime: '{{label}}は有効な日時(ISO-8601)を入力してください',
@@ -271,7 +271,7 @@ export const BUILTIN_VALIDATION_MESSAGES: Record<string, Record<string, string>>
271271
invalid_url: '{{label}} debe ser una URL válida (scheme://...)',
272272
invalid_phone: '{{label}} debe ser un número de teléfono válido',
273273
invalid_number: '{{label}} debe ser un número',
274-
invalid_number_currency_object: '{{label}} es un importe de moneda: escríbalo como un número sin más (p. ej., 10), no como un objeto del tipo { value, currency }. El campo declara su moneda en currencyConfig: el defaultCurrency del modo fixed o, en el modo dynamic (el predeterminado), la moneda predeterminada del inquilino (ADR-0104)',
274+
invalid_number_currency_object: '{{label}} es un importe de moneda: escríbalo como un número sin más (ADR-0104), por ejemplo 10, no como un objeto del tipo { value, currency }. El campo declara su moneda en currencyConfig: el defaultCurrency del modo fixed o, en el modo dynamic (el predeterminado), la moneda predeterminada del inquilino',
275275
invalid_boolean: '{{label}} debe ser true o false',
276276
invalid_date: '{{label}} debe ser una fecha válida (ISO-8601)',
277277
invalid_datetime: '{{label}} debe ser una fecha y hora válidas (ISO-8601)',

0 commit comments

Comments
 (0)