oxid-esales / graphql-configuration-access
OXID eSales GraphQL配置访问模块
v1.1.0
2024-07-05 12:55 UTC
Requires
- php: ^8.1
- doctrine/dbal: ^v2.7
- oxid-esales/graphql-base: ^v9.0.0
Requires (Dev)
- codeception/codeception: ^5.0
- codeception/module-asserts: ^3.0
- codeception/module-db: *
- codeception/module-phpbrowser: *
- codeception/module-rest: *
- mikey179/vfsstream: ~1.6.8
- oxid-esales/codeception-modules: dev-b-7.1.x
- oxid-esales/oxideshop-ce: dev-b-7.1.x
- phpmd/phpmd: ^2.11
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.4
- qossmic/deptrac-shim: ^1.0.2
- squizlabs/php_codesniffer: 3.*
- dev-b-7.2.x
- v1.1.0
- v1.1.0-rc.1
- v1.0.0
- dev-b-7.1.x
- dev-b-7.1.x-fix-sonarcloud
- dev-b-7.2.x-improve-module-list
- dev-b-7.1.x-fixate-dependencies
- dev-b-7.0.x-new_dev_recipes-OXDEV-7845
- dev-b-7.0.x
- dev-b-7.0.x-list_queries-OXDEV-7460-rebased
- dev-b-7.0.x-list_queries-OXDEV-7460
- dev-b-7.0.x-shop_queries-OXDEV-7459
- dev-b-7.0.x-type_validation-OXDEV-7352
- dev-b-7.0.x-remove_datatypes_description-OXDEV-7509
This package is auto-updated.
Last update: 2024-09-19 09:31:32 UTC
README
graphql-configuration-access
基于GraphQL的OXAPI访问配置设置
为什么使用此架构
为了获取和更新配置,我们为每个值类型实现了一个不同的查询/突变。我们选择此架构是因为GraphQL的严格性不允许动态类型。如果没有这些类型,API消费者在查询后或突变前始终需要将值进行转换,例如,如果我们决定使用json编码的字符串。
要获取特定配置的类型,我们提供了如shopSettings
/moduleSettings
/themeSettings
之类的查询,以确定配置的类型。结果您将获得设置类型数组
type SettingType {
name: string!
type: FieldType!
isSupported: boolean!
}
enum FieldType {
'str'
'select'
'bool'
'num
'arr'
'aarr'
}
文档
- 完整文档可在此处找到。
安装
切换到商店根目录(文件composer.json
以及目录source/
和vendor/
位于此处)。
# Install desired version of oxid-esales/graphql-configuration-access module, in this case - latest released 1.x version
$ composer require oxid-esales/graphql-configuration-access ^1.0.0
如果您尚未安装oxid-esales/graphql-base
模块,Composer将为您安装。
安装模块后,您需要通过OXID eShop管理员或CLI激活它。
$ vendor/bin/oe-console oe:module:activate oe_graphql_base $ vendor/bin/oe-console oe:module:activate oe_graphql_configuration_access
如何使用
一个好的起点是检查GraphQL Base模块中的“如何使用”部分
通过GraphQL阻止模块的激活/禁用
文件module_blockilst.yaml包含了一组列表,这些模块是必要的,以处理配置或通过GraphQL激活/禁用模块,或者应该被阻止在一般情况下通过GraphQL激活/禁用。例如,oe_graphql_base
和oe_graphql_configuration_access
被列在其中。
测试
代码风格检查,语法检查,静态分析
$ composer update $ composer static
单元/集成/验收测试
- 将此模块安装到运行的OXID eShop
- 重置商店的数据库
$ bin/oe-console oe:database:reset --db-host=db-host --db-port=db-port --db-name=db-name --db-user=db-user --db-password=db-password --force
- 运行单元+集成测试
$ composer phpunit
- 运行单元测试
$ ./vendor/bin/phpunit -c vendor/oxid-esales/graphql-configuration-access/tests/phpunit.xml
- 运行集成测试
$ ./vendor/bin/phpunit --bootstrap=./source/bootstrap.php -c vendor/oxid-esales/graphql-configuration-access/tests/phpintegration.xml
- 运行验收测试
$ composer codeception