Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - YAML error : Expected a 'String' but got a 'Mapping' node

I am adding my own custom properties in a YAML file. The existing Spring properties work fine but my own custom ones become underlined in yellow, which creates a warning in the project. There is an option to add to the metadata but once I do that the warning becomes this error :

Expected a 'String' but got a 'Mapping' node

This is what I am adding :

com:
  foo:
    bar:
      foobar:
        someString: hello
        someBoolean: true

Where is this YAML metadata stored and how can I tell it that com is not a String and is really a mapping node?

******EDIT******

I found the metadata is stored in the META-INF folder in a file called additional-spring-configuration-metadata.json. If I tell Eclipse to generate the metadata for com for example, this gets added to said file :

{"properties": [{
  "name": "com",
  "type": "java.lang.String",
  "description": "A description for 'com'"
}]}

What do you have to change java.lang.String to in order for com to accept foo and so on?

like image 315
Martin Avatar asked Jul 29 '26 04:07

Martin


1 Answers

Hello I am the maintainer of the mentioned eclipse plugin (https://marketplace.eclipse.org/content/yaml-editor)

Normally when you have got problems with yaml editor plugin it's recommended to create an issue for this at https://github.com/de-jcup/eclipse-yaml-editor/issues

I tried out your given example and there is no error appearing with current version 1.6.2. Are you sure you are really using Yaml-Editor to open your file and not another installed editor ? To ensure you should try out to open your file by context action (e.g. inside project explorer) at your file and Open with -> Yaml Editor.

If there are still problems, please create an issue at github and add the link to this question.

Screenshot-Yaml-Editor-with-Example

like image 144
de-jcup Avatar answered Jul 30 '26 17:07

de-jcup



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!