Vscode-yaml: CircleCI schemastore one-of selector does not work

Created on 29 Sep 2020  路  4Comments  路  Source: redhat-developer/vscode-yaml

In Circleci config v.2.1, in executors there's several types to be chosen: docker, machine, macos, windows.

In schemastore JSON schema for circleci I can see that they are provided in "oneOf" array, however this does not work:

image

Could this be checked? I'm not sure if this this a problem of the plugin interpreting schema or the schema itself.

question

Most helpful comment

@JPinkney yes, you're right, there's a probably old schema, didn't noticed that. Thanks, I've created a PR there to fix it (https://github.com/SchemaStore/schemastore/pull/1266).

All 4 comments

This is actually an interesting issue. It looks like what's happening is machine actually requires image underneath it. It also looks like resource_class shouldn't be under machine_executor (according to the schema) because thats part of the dockerExecutor part of the schema. So what's happening is because machine doesn't validate correctly it's actually trying to validate against the dockerExecutor in the schema instead.

With this YAML

version: 2.1
executors:
  machine_executor:
    machine:
      docker_layer_caching: true

we get Missing property "image". which is the correct error

then when we add resource_class

version: 2.1
executors:
  machine_executor:
    machine:
      docker_layer_caching: true
    resource_class: medium

we get the missing property docker error because it's trying to match against the dockerExecutor instead of the machineExecutor, since resource_class is in the oneOf of dockerExecutor.

In this case everything is actually behaving as expected

docker does not have resource_class, this is part of the executor, not docker or machine.

I'm not familiar with circle ci at all, i'm just trying to interpret what the schema is saying: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/circleciconfig.json#L350

@JPinkney yes, you're right, there's a probably old schema, didn't noticed that. Thanks, I've created a PR there to fix it (https://github.com/SchemaStore/schemastore/pull/1266).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Chagrilled picture Chagrilled  路  4Comments

riker09 picture riker09  路  5Comments

joshuaavalon picture joshuaavalon  路  4Comments

matus-cuper picture matus-cuper  路  5Comments

ssbarnea picture ssbarnea  路  3Comments