From ea6b237bdff24c7330d92b755226ff3d2596841a Mon Sep 17 00:00:00 2001 From: Simon Harrer Date: Thu, 12 Sep 2024 13:02:03 +0200 Subject: [PATCH 1/2] Add field.examples, deprecate field.example --- README.md | 18 ++++++++++++------ datacontract.schema.json | 12 +++++++++++- definition.schema.json | 7 ++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a419951..e490fd9 100644 --- a/README.md +++ b/README.md @@ -94,12 +94,14 @@ models: description: The business timestamp in UTC when the order was successfully registered in the source system and the payment was successful. type: timestamp required: true - example: "2024-09-09T08:30:00Z" + examples: + - "2024-09-09T08:30:00Z" order_total: description: Total amount the smallest monetary unit (e.g., cents). type: long required: true - example: "9999" + example: + - 9999 customer_id: description: Unique identifier for the customer. type: text @@ -143,7 +145,8 @@ definitions: type: text format: uuid description: An internal ID that identifies an order in the online shop. - example: 243c25e5-a081-43a9-aeab-6d5d5b6cb5e2 + examples: + - 243c25e5-a081-43a9-aeab-6d5d5b6cb5e2 pii: true classification: restricted tags: @@ -154,7 +157,8 @@ definitions: title: Stock Keeping Unit type: text pattern: ^[A-Za-z0-9]{8,14}$ - example: "96385074" + example: + - "96385074" description: | A Stock Keeping Unit (SKU) is an internal unique identifier for an article. It is typically associated with an article's barcode, such as the EAN/GTIN. @@ -583,7 +587,8 @@ The Field Objects describes one field (column, property, nested field) of a data | exclusiveMinimum | `number` | A value of a number must greater than the value of this. Only evaluated if the value is not null. Only applies to numeric values. | | maximum | `number` | A value of a number must less than, or equal to, the value of this. Only evaluated if the value is not null. Only applies to numeric values. | | exclusiveMaximum | `number` | A value of a number must less than the value of this. Only evaluated if the value is not null. Only applies to numeric values. | -| example | `string` | An example value. | +| example | `string` | DEPRECATED. Use `examples` instead. An example value. | +| examples | `array` | Example values. | | pii | `boolean` | An indication, if this field contains Personal Identifiable Information (PII). | | classification | `string` | The data class defining the sensitivity level for this field, according to the organization's classification scheme. Examples may be: `sensitive`, `restricted`, `internal`, `public`. | | tags | Array of `string` | Custom metadata to provide additional context. | @@ -622,7 +627,8 @@ Models fields can refer to definitions using the `$ref` field to link to existin | exclusiveMinimum | `number` | A value of a number must greater than the value of this. Only evaluated if the value is not null. Only applies to numeric values. | | maximum | `number` | A value of a number must less than, or equal to, the value of this. Only evaluated if the value is not null. Only applies to numeric values. | | exclusiveMaximum | `number` | A value of a number must less than the value of this. Only evaluated if the value is not null. Only applies to numeric values. | -| example | `string` | An example value. | +| example | `string` | DEPRECATED. Use `examples` instead. An example value. | +| examples | `array` | Example values. | | pii | `boolean` | An indication, if this field contains Personal Identifiable Information (PII). | | classification | `string` | The data class defining the sensitivity level for this field, according to the organization's classification scheme. | | tags | Array of `string` | Custom metadata to provide additional context. | diff --git a/datacontract.schema.json b/datacontract.schema.json index 844afc4..9659b4c 100644 --- a/datacontract.schema.json +++ b/datacontract.schema.json @@ -953,8 +953,13 @@ }, "example": { "type": "string", + "deprecationMessage": "DEPRECATED. Use 'examples' instead.", "description": "An example value for this field." }, + "examples": { + "type": "array", + "description": "Example values for this field." + }, "pii": { "type": "boolean", "description": "An indication, if this field contains Personal Identifiable Information (PII)." @@ -1167,7 +1172,12 @@ }, "example": { "type": "string", - "description": "An example value." + "description": "An example value.", + "deprecationMessage": "DEPRECATED. Use 'examples' instead." + }, + "examples": { + "type": "array", + "description": "Example values." }, "pii": { "type": "boolean", diff --git a/definition.schema.json b/definition.schema.json index e07bccd..44a98c3 100644 --- a/definition.schema.json +++ b/definition.schema.json @@ -56,7 +56,12 @@ }, "example": { "type": "string", - "description": "An example value." + "description": "An example value.", + "deprecationMessage": "Use 'examples' instead." + }, + "examples": { + "type": "array", + "description": "Example values." }, "pii": { "type": "boolean", From c01ee98d77d9ce82ac9a1b5b8c1af7b8d7e55c70 Mon Sep 17 00:00:00 2001 From: Simon Harrer Date: Thu, 12 Sep 2024 13:43:30 +0200 Subject: [PATCH 2/2] UPDATE --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e490fd9..a7665f0 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ models: description: Total amount the smallest monetary unit (e.g., cents). type: long required: true - example: - - 9999 + examples: + - 9999 customer_id: description: Unique identifier for the customer. type: text @@ -157,8 +157,8 @@ definitions: title: Stock Keeping Unit type: text pattern: ^[A-Za-z0-9]{8,14}$ - example: - - "96385074" + examples: + - "96385074" description: | A Stock Keeping Unit (SKU) is an internal unique identifier for an article. It is typically associated with an article's barcode, such as the EAN/GTIN.