Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and update deprecated primary field usage #568

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
114 changes: 58 additions & 56 deletions tests/datacontract-1.html
jochenchrist marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1748,62 +1748,64 @@ <h1 class="text-base font-semibold leading-6 text-gray-900">

<h3 class="text-base font-semibold leading-6 text-gray-900" id="modal-title">Data Contract YAML</h3>
</div>
<pre class="overflow-x-auto text-sm bg-gray-50 p-4"><code>dataContractSpecification: 1.1.0
id: orders-unit-test
info:
title: Orders Unit Test
version: 1.0.0
description: The orders data contract
owner: checkout
contact:
url: https://wiki.example.com/teams/checkout
email: [email protected]
servers:
production:
type: snowflake
account: my-account
database: my-database
schema_: my-schema
terms:
usage: This data contract serves to demo datacontract CLI export.
limitations: Not intended to use in production
billing: free
noticePeriod: P3M
models:
orders:
description: The orders model
type: table
fields:
order_id:
type: varchar
required: true
primary: false
unique: true
pii: true
classification: sensitive
pattern: ^B[0-9]+$
minLength: 8
maxLength: 10
tags:
- order_id
order_total:
type: bigint
required: true
primary: false
unique: false
description: The order_total field
minimum: 0
maximum: 1000000
order_status:
type: text
required: true
primary: false
unique: false
enum:
- pending
- shipped
- delivered
</code></pre>
<pre class="overflow-x-auto text-sm bg-gray-50 p-4">
<code>
dataContractSpecification: 1.1.0
id: orders-unit-test
info:
title: Orders Unit Test
version: 1.0.0
description: The orders data contract
owner: checkout
contact:
url: https://wiki.example.com/teams/checkout
email: [email protected]
servers:
production:
type: snowflake
account: my-account
database: my-database
schema_: my-schema
terms:
usage: This data contract serves to demo datacontract CLI export.
limitations: Not intended to use in production
billing: free
noticePeriod: P3M
models:
orders:
description: The orders model
type: table
fields:
order_id:
type: varchar
required: true
primaryKey: false
unique: true
pii: true
classification: sensitive
pattern: ^B[0-9]+$
minLength: 8
maxLength: 10
tags:
- order_id
order_total:
type: bigint
required: true
primaryKey: false
unique: false
description: The order_total field
minimum: 0
maximum: 1000000
order_status:
type: text
required: true
primaryKey: false
unique: false
enum:
- pending
- shipped
- delivered
</code></pre>
</div>
<div class="mt-5 sm:mt-6">
<button type="button" onclick="document.getElementById('dialog-datacontract-yaml').close()"
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/breaking/datacontract-fields-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ models:
required: false
field_primary:
type: string
primary: false
primaryKey: false
field_references:
type: string
references: my_table.field_type
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/breaking/datacontract-fields-v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ models:
required: true
field_primary:
type: string
primary: true
primaryKey: true
field_references:
type: string
references: my_table.field_format
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/dbml/datacontract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ models:
$ref: '#/definitions/order_id'
required: true
unique: true
primary: true
primaryKey: true
order_timestamp:
description: The business timestamp in UTC when the order was successfully registered in the source system and the payment was successful.
type: timestamp
Expand Down Expand Up @@ -95,7 +95,7 @@ models:
description: Primary key of the lines_item_id table
required: true
unique: true
primary: true
primaryKey: true
order_id:
$ref: '#/definitions/order_id'
references: orders.order_id
Expand Down
18 changes: 9 additions & 9 deletions tests/fixtures/dbml/import/datacontract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,39 @@ models:
order_id:
type: text
required: true
primary: true
primaryKey: true
unique: true
description: An internal ID that identifies an order in the online shop.
order_timestamp:
type: timestamp
required: true
primary: false
primaryKey: false
unique: false
description: The business timestamp in UTC when the order was successfully
registered in the source system and the payment was successful.
order_total:
type: variant
required: true
primary: false
primaryKey: false
unique: false
description: Total amount the smallest monetary unit (e.g., cents).
customer_id:
type: text
required: false
primary: false
primaryKey: false
unique: false
description: Unique identifier for the customer.
customer_email_address:
type: text
required: true
primary: false
primaryKey: false
unique: false
description: The email address, as entered by the customer. The email address
was not verified.
processed_timestamp:
type: timestamp
required: true
primary: false
primaryKey: false
unique: false
description: The timestamp when the record was processed by the data platform.
line_items:
Expand All @@ -53,19 +53,19 @@ models:
lines_item_id:
type: text
required: true
primary: true
primaryKey: true
unique: true
description: Primary key of the lines_item_id table
order_id:
type: text
required: false
primary: false
primaryKey: false
unique: false
references: orders.order_id
description: An internal ID that identifies an order in the online shop.
sku:
type: text
required: false
primary: false
primaryKey: false
unique: false
description: The purchased article number
6 changes: 3 additions & 3 deletions tests/fixtures/dbml/import/datacontract_schema_filtered.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ models:
lines_item_id:
type: text
required: true
primary: true
primaryKey: true
unique: true
description: Primary key of the lines_item_id table
order_id:
type: text
required: false
primary: false
primaryKey: false
unique: false
references: orders.order_id
description: An internal ID that identifies an order in the online shop.
sku:
type: text
required: false
primary: false
primaryKey: false
unique: false
description: The purchased article number
12 changes: 6 additions & 6 deletions tests/fixtures/dbml/import/datacontract_table_filtered.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ models:
order_id:
type: text
required: true
primary: true
primaryKey: true
unique: true
description: An internal ID that identifies an order in the online shop.
order_timestamp:
type: timestamp
required: true
primary: false
primaryKey: false
unique: false
description: The business timestamp in UTC when the order was successfully
registered in the source system and the payment was successful.
order_total:
type: variant
required: true
primary: false
primaryKey: false
unique: false
description: Total amount the smallest monetary unit (e.g., cents).
customer_id:
type: text
required: false
primary: false
primaryKey: false
unique: false
description: Unique identifier for the customer.
customer_email_address:
type: text
required: true
primary: false
primaryKey: false
unique: false
description: The email address, as entered by the customer. The email address
was not verified.
processed_timestamp:
type: timestamp
required: true
primary: false
primaryKey: false
unique: false
description: The timestamp when the record was processed by the data platform.
2 changes: 1 addition & 1 deletion tests/fixtures/examples/datacontract_formats_valid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ models:
id:
type: text
required: true
primary: true
primaryKey: true
unique: true
title: ID
description: A unique identifier
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/lint/valid_datacontract_references.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models:
$ref: '#/definitions/order_id'
required: true
unique: true
primary: true
primaryKey: true
definitions:
order_id:
domain: checkout
Expand Down
Loading