-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
use apollo openapi create properties file, can not create explanatory note #5095
Comments
🤖 嘿,@pengbiaobeyond!很高兴再次见到你,希望你一切都好! 根据我对Apollo的理解,Apollo的OpenAPI在创建properties配置文件时,不支持在文件中创建注释。这是因为Apollo的设计理念是将配置中心视为一个数据库,而不是一个文件系统。因此,所有的配置项(包括注释)都存储在数据库中,而不是文件中。 在Apollo中,你可以为每个配置项添加注释,这些注释将存储在数据库中,而不是properties文件中。当你通过Apollo的OpenAPI获取配置时,你可以获取到这些注释,但是它们不会出现在properties文件中。 如果你需要在properties文件中添加注释,你可能需要在获取配置后,自行将注释添加到文件中。但请注意,这可能会使得配置的管理变得更加复杂,因为你需要同时管理数据库中的注释和文件中的注释。 希望这个解答能帮助到你。如果你有更多的问题,欢迎继续提问。 Sources
|
Hope to receive a manual reply |
希望老师帮忙确认下,是否是上边的解释,否则机器人回复心里没底 |
是存在数据库里的,ui上的文本里面也是通过读数据库来渲染的 🤔️ |
ui上的文本里边的注释在数据库中item表中的数据是key、value字段的值是空,comment字段的值是注释; |
如果存在注释的话,注释和key、value在item表里是两条数据 |
但是openApi只能创建一条数据 |
无法渲染注释 |
只有下图的红框的数据才可以渲染成注释,第一条数据是第二条数据的注释 |
找了下代码,确实是这样 function parsePropertiesText(namespace) {
var result = "";
var itemCnt = 0;
namespace.items.forEach(function (item) {
//deleted key
if (item.isDeleted) {
return;
}
if (item.item.key) {
//use string \n to display as new line
var itemValue = item.item.value.replace(/\n/g, "\\n");
result +=
item.item.key + " = " + itemValue + "\n";
} else {
result += item.item.comment + "\n";
}
itemCnt++;
});
namespace.itemCnt = itemCnt;
return result;
} |
所以说openApi目前是无法支持给properties配置文件添加注释的对吧 |
表格里面可以看到,但是文本里面好像是渲染不出来 |
恩恩,就是数据库表里可以看到,只是无法渲染到页面上对吧 |
可以等明天maintainer大佬来给个准确的回复 😳 |
好的,辛苦您明天帮我问下,谢谢 |
麻烦大佬今天帮忙看下 |
辛苦老师帮忙看下,拜托 |
我认为你的想法是对的,但我并不是官方人员,没法给你准确的回复 😂 |
我明白,但是通过openapi去添加properties配置文件中的内容时,是无法添加注释的 |
如果是单个配置的话是可以的,下面是我的测试代码和结果 @Test
public void testCreate() {
OpenItemDTO itemDTO = new OpenItemDTO();
itemDTO.setKey("testKey");
itemDTO.setValue("testValue");
itemDTO.setComment("测试注释");
itemDTO.setDataChangeCreatedBy(operator);
OpenItemDTO result = client.createItem(appId, env, null, null, itemDTO);
System.out.println(result);
} |
好的,明白了,谢谢 |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions. |
use apollo openapi create properties file, can not create explanatory note
![image](https://private-user-images.githubusercontent.com/46187883/306198357-f54f1d58-0d23-4d47-ab00-5fcf13dc2333.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTQyNjcsIm5iZiI6MTczOTYxMzk2NywicGF0aCI6Ii80NjE4Nzg4My8zMDYxOTgzNTctZjU0ZjFkNTgtMGQyMy00ZDQ3LWFiMDAtNWZjZjEzZGMyMzMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEwMDYwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRlZDQ2NjdkMGVhYjE5NmEzZDNjODNjNjJlZDBjNzY2NmY4ZjhmODliYzdlM2YwMTIxMTkyYjBjNDhhOTRkNjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.e6H3Ngq3VkhMrgEHEL0kTvQCH4UDNjghhTwjE3LzZ8U)
使用apollo的openapi创建properties配置文件,不能创建注释
zhe这里的备注只存放在库里,并不是文件中的注释信息
The text was updated successfully, but these errors were encountered: