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

Pydantic FoldingRangeParams query field ValidationError #153

Closed
hlouzada opened this issue Mar 17, 2021 · 1 comment · Fixed by #154
Closed

Pydantic FoldingRangeParams query field ValidationError #153

hlouzada opened this issue Mar 17, 2021 · 1 comment · Fixed by #154
Assignees
Labels
bug Something isn't working

Comments

@hlouzada
Copy link

hlouzada commented Mar 17, 2021

There seems to be an error with FoldingRangeParams as it's missing the query field. Although it's not specified by LSP and it might be unneeded. As the new release now uses pydantic (#151) it is requiring the query filed and throwing an error if not used.

As specified by LSP:

export interface FoldingRangeParams extends WorkDoneProgressParams,
	PartialResultParams {
	/**
	 * The text document.
	 */
	textDocument: TextDocumentIdentifier;
}

See LSP Reference for more details.

Error Traceback:

Traceback (most recent call last):
  File "C:\Users\hendr\anaconda3\envs\ciermag-develop\lib\site-packages\pygls\protocol.py", line 144, in deserialize_message
    deserialize_params(data, get_params_type)
  File "C:\Users\hendr\anaconda3\envs\ciermag-develop\lib\site-packages\pygls\protocol.py", line 130, in deserialize_params
    data['params'] = params_type(**params)
  File "pydantic\main.py", line 400, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for FoldingRangeParams
query
  field required (type=value_error.missing)

A possible solution is to remove the query from the FoldingRangeParams implementation:

class FoldingRangeParams(WorkDoneProgressParams, PartialResultParams):
query: str
text_document: TextDocumentIdentifier

@danixeee danixeee self-assigned this Mar 17, 2021
@danixeee danixeee added the bug Something isn't working label Mar 17, 2021
@danixeee danixeee mentioned this issue Mar 17, 2021
8 tasks
@danixeee
Copy link
Contributor

@hlouzada Fix is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants