Skip to content

Validation errors on @@ placeholders in YAML editor #711

Closed

Description

@Kyune

(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?

Activity

  1. added
    for: eclipse
    for: vscode
    on Dec 21, 2021
  2. martinlippert commented on Dec 21, 2021

    @martinlippert
    Member

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

  3. Kyune commented on Dec 21, 2021

    @Kyune
    Author

    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.

  4. added this to the 4.15.2.RELEASE milestone on Jun 21, 2022
  5. kdvolder commented on Jun 21, 2022

    @kdvolder
    Member

    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).

  6. kdvolder commented on Jun 21, 2022

    @kdvolder
    Member

    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.

  7. kdvolder commented on Jun 22, 2022

    @kdvolder
    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

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodestatus: assignedtheme: property-editing-supporttype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions