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

feat: api插件配置拓展 新增过滤空字段 #112

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ZC-A
Copy link
Collaborator

@ZC-A ZC-A commented Mar 10, 2025

No description provided.

@@ -207,27 +207,40 @@ class UniformApiConfig(BaseSpaceConfig):
value_type = SpaceConfigValueType.JSON.value
default_value = {}
example = {"meta_apis": "{meta_apis url}", "api_categories": "{api_categories url}"}
# 拓展后也支持 example = {"key": {"meta_apis": "{meta_apis url}", "api_categories": "{api_categories url}"}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example 改成新协议,同时注释兼容老协议,新协议的 common 字段默认可以不暴露

@@ -137,10 +136,17 @@ def _dispatch_schedule_trigger(self, data, parent_data, callback_data=None):
return False

space_configs = space_infos_result.get("data", {}).get("configs", {})
if space_configs.get("uniform_api", {}).get("common", {}).get("exclude_none_fields", False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里变复杂了,可以考虑定义 data model 来处理,这样处理有点难看,也可以后续优化

@@ -51,11 +51,19 @@ class UniformAPIMetaSerializer(serializers.Serializer):


def _get_space_uniform_api_list_info(space_id, request_data, config_key):
uniform_api_config = SpaceConfig.get_config(space_id=space_id, config_name=UniformApiConfig.name)
if not uniform_api_config.get(config_key):
uniform_api_configs = SpaceConfig.get_config(space_id=space_id, config_name=UniformApiConfig.name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要加 s,还是一份配置

@normal-wls
Copy link
Member

  1. ci 问题修复
  2. 目前的实现有点像是在各个消费点做 if 处理,不太建议这个做法。建议是写一个统一的数据处理器

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants