Skip to content

Commit

Permalink
fix: build labelAllLocales property for GraphQL FieldDefinition m…
Browse files Browse the repository at this point in the history
…odel (#609)

* fix: `DiscountsCustomView.filters` and `DiscountsCustomViewInput.filter` generated data

* feat: add `labelAllLocales` prop to `FieldDefinition` model

* fix: rebase issues

* chore: add changeset
  • Loading branch information
ragafus authored Jul 1, 2024
1 parent 5e22dd9 commit 98fa1de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/honest-toys-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-test-data/type': patch
---

Build `labelAllLocales` property for GraphQL `FieldDefinition` model
7 changes: 7 additions & 0 deletions models/type/src/field-definition/builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ describe('builder', () => {
value: expect.any(String),
}),
]),
labelAllLocales: expect.arrayContaining([
expect.objectContaining({
__typename: 'LocalizedString',
locale: expect.any(String),
value: expect.any(String),
}),
]),
required: expect.any(Boolean),
inputHint: expect.any(String),
__typename: 'FieldDefinition',
Expand Down
6 changes: 5 additions & 1 deletion models/type/src/field-definition/transformers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LocalizedString } from '@commercetools-test-data/commons';
import { Transformer } from '@commercetools-test-data/core';
import type { TFieldDefinition, TFieldDefinitionGraphql } from './types';

Expand All @@ -10,7 +11,10 @@ const transformers = {
}),
graphql: Transformer<TFieldDefinition, TFieldDefinitionGraphql>('graphql', {
buildFields: ['label', 'type'],
addFields: () => ({ __typename: 'FieldDefinition' }),
addFields: ({ fields }) => ({
labelAllLocales: LocalizedString.toLocalizedField(fields.label),
__typename: 'FieldDefinition',
}),
}),
};

Expand Down

0 comments on commit 98fa1de

Please sign in to comment.