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

Validation errors on @@ placeholders in YAML editor #711

Closed
Kyune opened this issue Dec 14, 2021 · 5 comments
Closed

Validation errors on @@ placeholders in YAML editor #711

Kyune opened this issue Dec 14, 2021 · 5 comments
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode status: assigned theme: property-editing-support type: enhancement

Comments

@Kyune
Copy link

Kyune commented Dec 14, 2021

(Migrated from https://jira.spring.io/browse/STS-4201)
Version: 4.12.0.RELEASE

As far as I could tell using the search function this issue was never migrated to Github prior to this post, and since the original issue contained a workaround I'm guessing it was consistent enough that nobody felt the need to reopen the issue.

This week there were some configuration changes introduced into several of our projects that utilize maven variable substitution within application.yml files. These changes reproduced the issue as described in the original JIRA issue above. However, when I tried to apply the workaround of surrounding the values with double quotes, I found that this workaround did not consistently resolve the validation errors that it generated--see below for an example.

image

There was only one instance of substitution to workaround, and the error appears to be somewhat malformed and is reported on the last line of the file:

image

I already have validators suspended for performance reasons, and I can't find to seem any mechanism for preventing this validation...I also doubt I can get the changes re-engineered as I'm in the minority of developers that use STS (or an Eclipse-based IDE) at this company. Since the original issue was considered low priority I suspect I may stuck living with this--are there any logs I could provide that would be helpful, or a workaround that I may have missed by not searching through preferences correctly?

@martinlippert martinlippert transferred this issue from spring-attic/spring-ide Dec 21, 2021
@martinlippert
Copy link
Member

Would it be possible to attach one or multiple sample application.yml files that we could use to reproduce the exact situation?

@Kyune
Copy link
Author

Kyune commented Dec 21, 2021

I've anonymized the file that produces the error with some dummy values and then renamed it a bit so that GitHub will allow it to be attached:

application-yml.txt

I'm not able to reproduce this error very easily, as the handful of other .yml files I tried to apply the workaround to did not present the error that I am seeing with the contents of the attached file.

@kdvolder
Copy link
Member

kdvolder commented Jun 21, 2022

Taking a look at this now.

and I can't find to seem any mechanism for preventing this validation

From your screenshot it looks like the error comes from (a) language server, so presumably you could disable the language server, and that would stop the error (this might be a bit drastic and result in loss of other functions provided by language server as well, such as content-assist completions in yaml files).

@kdvolder
Copy link
Member

kdvolder commented Jun 21, 2022

I can reproduce the problem as shown in screenshot with that file (I.e. I am getting this same error Expecting a mapping node but got '' right at the end of the file.

That doesn't appear to have anything to do with the use of any "@...@" in the file however. I can remove the use of "@...@" entirely and the error remains.

The error instead, I think is the language server complaining (in a confusing way :-) about the 'empty' yaml document at the end of the file.

I.e. it is caused by the final --- document separator at the end of the file. This means that formally there is extra "yaml document" which contains nothing (i.e. the empty string "" as indicated in the error). What the error is literally saying is that it was hoping to see a sequence of key value pairs in the document rather than "nothing").

A simple workaround for that error is... simply delete the final --- which is completely unnecessary from the end of your document and the error goes away.

On our end, it shouldn't be too hard to fix our language server to ignore the unexpected 'empty document' in this case. So I'll see about making that change now.

@kdvolder
Copy link
Member

Verified the fix with latest vscode-spring-boot snapshot (it contains the same language server as STS Eclipse).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode status: assigned theme: property-editing-support type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants