-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update management of locale-based props for GraphQL transformers (#629)
* refactor: updated some properties management in graphql transformers * chore: push refreshed lock file * chore: changesets added
- Loading branch information
1 parent
29ab14e
commit a4e8796
Showing
13 changed files
with
354 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
'@commercetools-test-data/category': patch | ||
--- | ||
|
||
Fixed the return type for some properties in the GraphQL representation: | ||
|
||
- name | ||
- description | ||
- slug | ||
- metaTitle | ||
- metaKeywords | ||
- metaDescription | ||
|
||
They all were returning a value with type `TLocalizedStringGraphql` where they should be returning a `string`. | ||
|
||
From the consumer point of view, mocking those values won't change so they can still use the `LocalizedString` common model to set it up: | ||
|
||
```js | ||
Category.random() | ||
.name(LocalizedString.random().en('Shoes').de('Schuhe')) | ||
.buildGraphql(); | ||
``` | ||
|
||
The actual `string` returned will be the one with the default locale (`en`) or the first one if that one does not exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
'@commercetools-test-data/product': patch | ||
--- | ||
|
||
Fixed the return type for some properties in the GraphQL representation: | ||
|
||
- name | ||
- description | ||
- slug | ||
- metaTitle | ||
- metaKeywords | ||
- metaDescription | ||
|
||
They all were returning a value with type `TLocalizedStringGraphql` where they should be returning a `string`. | ||
|
||
From the consumer point of view, mocking those values won't change so they can still use the `LocalizedString` common model to set it up: | ||
|
||
```js | ||
Product.random() | ||
.name(LocalizedString.random().en('Shoes').de('Schuhe')) | ||
.buildGraphql(); | ||
``` | ||
|
||
The actual `string` returned will be the one with the default locale (`en`) or the first one if that one does not exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@commercetools-test-data/commons': minor | ||
--- | ||
|
||
Added a new helper in the `LocalizedString` model which allows to get the default locale value out of all configured ones. | ||
|
||
The default value has been configured to be `en`. | ||
|
||
In case the model does not have that one configured, the helper will return the first one configured. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.