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

Cannot use IDE schema validator with Calliope model YAML files #558

Open
1 of 3 tasks
irm-codebase opened this issue Feb 6, 2024 · 1 comment
Open
1 of 3 tasks
Labels
possibly-revisit v0.7 (upcoming) version 0.7
Projects

Comments

@irm-codebase
Copy link

What happened?

The YAML schema is missing a couple of things that cause standard configurations to return linting errors. I am using the YAML support plugin for VSCode, but this should apply to any other schema-based linter.

I'll be adding the bugs to this list. Here are the ones I've found so far:

  1. import is not defined in the schema, causing it to return an error when using the command.

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

Version

v0.7.0

Relevant log output

Errors returned:
1. `Property import is not allowed. yaml-schema: Model configuration schema`
@brynpickering
Copy link
Member

brynpickering commented Feb 6, 2024

The import key is removed from the dictionary after resolving its contents and before the model definition reaches the schema validator. This means that standard VSCode schema validator won't work well.

In fact, the way we allow a. relative file imports, b. applications of overrides, and c. loading tabular data, means that IDE schema validators are likely to complain frequently. For instance, the schema requires a technology to define a parent, but you could define the following two YAML files:

file1.yaml

  techs:
    tech1:
      parent: supply

file2.yaml

  techs:
    tech1:
      flow_cap_max: 10

And merge them together with import in model.yaml:

import:
  - file1.yaml
  - file2.yaml

Your IDE linter will complain that there is no parent defined in file2.yaml. However, this is perfectly valid for Calliope.

Similarly, the schema checks that cost_... parameters have defined costs as one of the dims. But you could define this in tech_groups and it would be valid for Calliope:

tech_groups:
  foo: 
    cost_flow_cap:
      data: null
      index: monetary
      dims: costs
techs:
  bar:
    inherit: foo
    cost_flow_cap.data: 1  # the IDE linter will complain.

@brynpickering brynpickering added possibly-revisit v0.7 (upcoming) version 0.7 and removed bug labels Feb 6, 2024
@brynpickering brynpickering changed the title YAML schema bugs Cannot use IDE schema validator with Calliope model YAML files Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possibly-revisit v0.7 (upcoming) version 0.7
Projects
No open projects
v0.7.0
Awaiting triage
Development

No branches or pull requests

2 participants