Updated example in the config schema page#560
Conversation
🔍 Linter ReportClick to expand full reportThis comment was automatically generated by the linter bot. |
🔍 Linter ReportClick to expand full reportThis comment was automatically generated by the linter bot. |
🔍 Linter ReportClick to expand full reportThis comment was automatically generated by the linter bot. |
🔍 Linter ReportClick to expand full reportThis comment was automatically generated by the linter bot. |
🔍 Linter ReportClick to expand full reportThis comment was automatically generated by the linter bot. |
🔍 Linter ReportClick to expand full reportThis comment was automatically generated by the linter bot. |
| ``` | ||
|
|
||
| **Custom scopes** created in the App Management UI are identified by **code only**. They do not define a separate **level** in the tree. For those scopes you must use **`byCode("your-custom-scope-code")`**. `byCodeAndLevel` is not used for custom scopes because there is no level to pass. See the configuration library [usage](https://github.com/adobe/aio-commerce-sdk/blob/main/packages/aio-commerce-lib-config/docs/usage.md) for more information. | ||
| Custom scopes created in the App Management UI are identified by **code only**. They do not define a separate level in the tree. For those scopes you must use `byCode("your-custom-scope-code")`. `byCodeAndLevel` is not used for custom scopes because there is no level to pass. See the configuration library [usage](https://github.com/adobe/aio-commerce-sdk/blob/main/packages/aio-commerce-lib-config/docs/usage.md) for more information. |
There was a problem hiding this comment.
Do we want to add the byWebsiteId, byStoreId and byStoreViewId and we support also?
@iivvaannxx it was released right?
There was a problem hiding this comment.
That's a good point, I forgot we added those (and yes, they were released last week). @danidelcar Find documentation of them here, they are not a critical thing, so don't sweat it.
iivvaannxx
left a comment
There was a problem hiding this comment.
Very well explained @danidelcar. Even though the steps are confusing because it's a lot of "if X do Y else do Z" you managed to explain it quite well. As I said, I'll try to make the #app.commerce.config work also when no dynamic lists are present so the documentation doesn't also have to explain that difference.
| ### With dynamicList | ||
|
|
||
| If you skip `initialize`, see [Initialization](https://github.com/adobe/aio-commerce-sdk/blob/main/packages/aio-commerce-lib-config/docs/usage.md#initialization) in the configuration library usage guide for more information. | ||
| When your schema includes a `dynamicList` field (requires `@adobe/aio-commerce-lib-config` version **1.6.0** or later), `options` and `default` are resolved at runtime. **Await** `initialize` and pass the action `params`. Use the live schema from `app.commerce.config` (not the generated JSON) so async `options` and `default` functions remain available: |
There was a problem hiding this comment.
This mentions "not the generated JSON" as if it was an option. I would emphasize that using the generated JSON is not an option in the first place because it doesn't get generated at all (when using dynamicList), because a JSON can't hold a function value.
|
|
||
| ```js | ||
| import { initialize } from "@adobe/aio-commerce-lib-config"; | ||
| import appConfig from "#app.commerce.config"; |
There was a problem hiding this comment.
Maybe add a comment that this #app.commerce.config is only available when using dynamicList? I'll try to make it work also when it's not present as it would not be a breaking change, but in the meantime, just in case.
| ``` | ||
|
|
||
| **Custom scopes** created in the App Management UI are identified by **code only**. They do not define a separate **level** in the tree. For those scopes you must use **`byCode("your-custom-scope-code")`**. `byCodeAndLevel` is not used for custom scopes because there is no level to pass. See the configuration library [usage](https://github.com/adobe/aio-commerce-sdk/blob/main/packages/aio-commerce-lib-config/docs/usage.md) for more information. | ||
| Custom scopes created in the App Management UI are identified by **code only**. They do not define a separate level in the tree. For those scopes you must use `byCode("your-custom-scope-code")`. `byCodeAndLevel` is not used for custom scopes because there is no level to pass. See the configuration library [usage](https://github.com/adobe/aio-commerce-sdk/blob/main/packages/aio-commerce-lib-config/docs/usage.md) for more information. |
There was a problem hiding this comment.
That's a good point, I forgot we added those (and yes, they were released last week). @danidelcar Find documentation of them here, they are not a critical thing, so don't sweat it.
| ```js | ||
| import { getConfigurationByKey, byCode } from "@adobe/aio-commerce-lib-config"; | ||
| import { initialize, getConfigurationByKey, byCode } from "@adobe/aio-commerce-lib-config"; | ||
| import appConfig from "#app.commerce.config"; |
There was a problem hiding this comment.
Caution there, as said in the comment above, this alias only works for now thanks to the code generation path executed when at least one dynamicList field is present.
Purpose of this pull request
This pull request (PR) documents that
initializefrom@adobe/aio-commerce-lib-configis required at the start of every App Builder runtime action that callsgetConfiguration,getConfigurationByKey, orsetConfiguration—per invocation, not once per deploy. Updates runtime examples to import#app.commerce.configand passappConfig.businessConfig.schematoinitialize, replacing guidance that pointed atconfiguration-schema.json.Affected pages
Additional information
major-updatelabel (if editorial scope warrants it)whatsnew
App Management docs now state that each runtime action using getConfiguration, getConfigurationByKey, or setConfiguration must call initialize first with app.commerce.config; configuration-schema examples import #app.commerce.config and initialize before reads/writes.