haystack icon indicating copy to clipboard operation
haystack copied to clipboard

Validation of YAML schema seems broken in PyCharm

Open tholor opened this issue 2 years ago • 3 comments

Describe the bug It seems that the automatic yaml validation using our haystack schema is not working anymore in PyCharm I'd expect invalid params of a component to be highlighted in the editor. I am pretty certain that this was working after the initial PR(https://github.com/deepset-ai/haystack/pull/2020) back then.

image

The schema of the yaml is correctly recognized by PyCharm: schema_haystack

Expected behavior A clear and concise description of what you expected to happen.

Additional context Example pipeline:


version: 1.7.0

components:    # define all the building-blocks for Pipeline
  - name: DocumentStore
    type: ElasticsearchDocumentStore
    params:
      host: localhost
  - name: Retriever
    type: BM25Retriever
    params:
      document_store: DocumentStore    # params can reference other components defined in the YAML
      top_k: 5
      this should: not work
  - name: Generator
    type: OpenAIAnswerGenerator
    params:
      api_key: some
      temperature: 0
      max_tokens: 15
      blub: test
  - name: TextFileConverter
    type: NodeThatNotExists

FAQ Check

System:

  • OS: Ubuntu
  • Haystack version (commit or version number): 1.7.1

tholor avatar Aug 19 '22 14:08 tholor

Note: validation works as expected in my env, so it shouldn't be an obvious bug

  • OSX 12.5
  • VSCode 1.70 + YAML v1.9.1
  • Haystack 1.7.1

masci avatar Aug 19 '22 14:08 masci

Maybe just a PyCharm issue then :thinking: . Could someone else with PyCharm try this one out?

tholor avatar Aug 19 '22 15:08 tholor

This seems to be a PyCharm issue (see here for the corresponding issue).

A workaround is to manually choose the schema file for the version you are working with: image

Then, automatic schema validation seems to work fine: image

bogdankostic avatar Aug 29 '22 14:08 bogdankostic

Given that this seems to be a PyCharm specific issue, I'll close this one for now.

ZanSara avatar Oct 19 '22 10:10 ZanSara