when content key is aaa-bb--cc, yamlMapping key has Double quotation mark "aaa-bb--cc":value1
Closed this issue · 11 comments
YamlInput yamlInput = Yaml.createYamlInput(content),
YamlMapping yamlMapping = yamlInput.readYamlMapping();
aaa-bb--cc: value1
when content key is aaa-bb--cc, yamlMapping key has Double quotation mark "aaa-bb--cc":value1
@YeJiaL thank you for reporting this. I'll assign someone to take care of it soon.
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV
available or because the project does not have enough funds.
Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.
@zoeself
content
# 111
spring: # inline
datasource:
url: jdbc:mysql://123
driver-class-name: org.mariadb.jdbc.Driver
druid:
validation-query: select 1
解析后的yamlMapping内容
# 111
spring:
datasource:
url: "jdbc:mysql://123"
"driver-class-name": org.mariadb.jdbc.Driver
@druid:
"validation-query": select 1
how to remove Double quotation mark?(1. key "driver-class-name" 2.url value )
@zoeself
content
# 111
spring: # inline
datasource:
url: jdbc:mysql://123
driver-class-name: org.mariadb.jdbc.Driver
druid:
validation-query: select 1
解析后的yamlMapping内容
# 111
spring:
datasource:
url: "jdbc:mysql://123"
"driver-class-name": org.mariadb.jdbc.Driver
@druid:
"validation-query": select 1
how to remove Double quotation mark?(1. key "driver-class-name" 2.url value )
@YeJiaL you don't have the appropriate role to remove this task.
Only users with PO or ARCH roles are allowed.
@YeJiaL That is intended behaviour, they are escaped because the strings contain -
, which is a special charcter in YAML.
@YeJiaL That is intended behaviour, they are escaped because the strings contain
-
, which is a special charcter in YAML.
@amihaiemil Can you provide an option for outputting in the original format? It is not guaranteed whether there is a problem after adding quotation marks. I guess the value of the URL may also contains a special character
@YeJiaL we will consider implementing an abstract visitor, then printing should also become easier. But in the meantime, you could implement your own visitor and print the YamlMapping as you wish.
@YeJiaL we will consider implementing an abstract visitor, then printing should also become easier. But in the meantime, you could implement your own visitor and print the YamlMapping as you wish.
@amihaiemil In the current version, how can I output in the original format through any settings?
@YeJiaL there is no such setting at the moment. A visitor for printing would be the easiest solution.
key:
- property1: value1
property2: value2 - property1: value3
property2: value4
Unable to parse this form of string correctly @amihaiemil @zoeself