Config.yml: trouble using keys that take multiple properties such as `run` or `save_cache`

I can’t get past validation whenever I try to use a key that has multiple properties. I’m using version 2.1. I ran into this error with the run and save_cache commands. I must be missing something because I see plenty of examples in the docs, but the error message returned says that maxProperties is 1.

Here’s my config:

version: 2.1
orbs:
  python: circleci/python@0.2.1

commands:
  build_spdb_clib:
    description: "Build spdb's C library"
    steps:
      - run: python setup.py build_ext --inplace

  install:
    description: "Install Python dependencies"
    steps:
      - checkout
      - python/load-cache
      - install_spdb
      - python/save-cache

  test_spdb:
    description: "Test spdb"
    steps:
      - run:
        command: python3 -m unittest
        environment:
          AWS_ACCESS_KEY_ID: testing
          AWS_SECRET_ACCESS_KEY: testing
          AWS_SECURITY_TOKEN: testing
          AWS_SESSION_TOKEN: testing

jobs:
  test_py3_5:
    docker:
      - image: circleci/python:3.5
    steps:
      - install
      - test_spdb

workflows:
  version: 2
  test:
    jobs:
      - test_py3_5

Here’s there pipeline error message:

ERROR IN CONFIG FILE:
[#/commands/test_spdb] 0 subschemas matched instead of one
1. [#/commands/test_spdb] expected type: String, found: Mapping
|   Command may be a string reference to another command
2. [#/commands/test_spdb/steps/0] 0 subschemas matched instead of one
|   1. [#/commands/test_spdb/steps/0] expected type: String, found: Mapping
|   |   Shorthand commands, like `checkout`
|   |   SCHEMA:
|   |     type: string
|   |   INPUT:
|   |     run: null
|   |     command: python3 -m unittest
|   |     environment:
|   |       AWS_ACCESS_KEY_ID: testing
|   |       AWS_SECRET_ACCESS_KEY: testing
|   |       AWS_SECURITY_TOKEN: testing
|   |       AWS_SESSION_TOKEN: testing
|   2. [#/commands/test_spdb/steps/0] maximum size: [1], found: [2]
|   |   long form commands like `run:`
|   |   SCHEMA:
|   |     maxProperties: 1
|   |   INPUT:
|   |     run: null
|   |     command: python3 -m unittest
|   |     environment:
|   |       AWS_ACCESS_KEY_ID: testing
|   |       AWS_SECRET_ACCESS_KEY: testing
|   |       AWS_SECURITY_TOKEN: testing
|   |       AWS_SESSION_TOKEN: testing

Thanks much,
Tim

Heya @movestill - would you mind linking to the docs where you’re seeing this example? environment configurations should be done on the job level, rather than in the steps group, as seen here: https://circleci.com/docs/2.0/configuration-reference/#environment :slight_smile:

Sure, this is where I saw it: https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-step

Tim