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

[Breaking]: architectural change to omit draft model __typename creation #478

Merged
merged 12 commits into from
Feb 9, 2024
Merged
Prev Previous commit
Next Next commit
chore(test-data): update commons README
  • Loading branch information
jaikamat committed Feb 8, 2024
commit 972f9308ee5b729840c8cb340da6ecb290f53316
24 changes: 23 additions & 1 deletion models/commons/README.md
Original file line number Diff line number Diff line change
@@ -67,26 +67,37 @@ const clientLogging = ClientLogging.random().build<TClientLogging>();
```ts
import {
KeyReference,
KeyReferenceDraft,
type TKeyReference,
type TKeyReferenceDraft,
} from '@commercetools-test-data/commons';

const productKeyRef = KeyReference.random()
.typeId('product')
.build<TKeyReference<'product'>>();
const productKeyRefDraft = KeyReferenceDraft.random()
.typeId('product')
.build<TKeyReferenceDraft<'product'>>();
```

## `LocalizedString`

```ts
import {
LocalizedString,
LocalizedStringDraft,
type TLocalizedString,
type TLocalizedStringDraft,
} from '@commercetools-test-data/commons';

const name = LocalizedString.random().build<TLocalizedString>();
const nameDraft = LocalizedStringDraft.random().build<TLocalizedString>();

// Presets
const emptyName = LocalizedString.presets.empty().build<TLocalizedString>();
const emptyNameDraft = LocalizedStringDraft.presets
.empty()
.build<TLocalizedStringDraft>();
```

## `Money`
@@ -114,16 +125,27 @@ const priceDraft = PriceDraft.random().build<TPriceDraft>();
## `Reference`

```ts
import { Reference, type TReference } from '@commercetools-test-data/commons';
import {
Reference,
ReferenceDraft,
type TReference,
type TReferenceDraft,
} from '@commercetools-test-data/commons';

const productRef = Reference.random()
.typeId('product')
.build<TReference<'product'>>();
const productRefDraft = ReferenceDraft.random()
.typeId('product')
.build<TReferenceDraft<'product'>>();

// Presets
const categoryRef = Reference.presets
.category()
.build<TReference<'category'>>();
const categoryRefDraft = ReferenceDraft.presets
.category()
.build<TReferenceDraft<'category'>>();
```

## `PriceTier`
Loading