Skip to content

apify run and the schema commands ignore inputSchema and outputSchema in actor.json #1534

Open

Description

@DaveHanns

Problem

actor.json accepts inputSchema and outputSchema as aliases of input and output, and the docs say they can be used interchangeably. The platform build copies a set inputSchema over input, and a set outputSchema over output, before it resolves any schema. When both keys are set, the alias wins. Every template in apify/actor-templates now uses the aliases (apify/actor-templates#822).

The CLI reads only the base keys:

  • readInputSchema in src/lib/input_schema.ts reads only input. When input is unset, it falls back to .actor/INPUT_SCHEMA.json, ./INPUT_SCHEMA.json, .actor/input_schema.json, and ./input_schema.json.
  • readOutputSchema in the same file, and the output schema check in apify validate-schema, read only output and have no fallback.

Affected commands:

  • apify run: validates the input and fills in defaults from the input schema.
  • apify validate-schema: validates the input and output schemas.
  • apify actor generate-schema-types: generates input and output types.
  • apify edit-input-schema (hidden): opens the input schema in the editor.
  • apify create and apify init: prefill INPUT.json from the input schema.

Example: a fresh project from the js-cypress template sets "inputSchema": "./input_schema.json" and "outputSchema": "./output_schema.json". The CLI finds the input schema only because .actor/input_schema.json is one of its fallback paths. It does not find the output schema: apify validate-schema skips it, and apify actor generate-schema-types writes no output types. The same holds for every template.

When inputSchema points anywhere else, for example "./schemas/input.json", or holds an inline schema, the CLI finds no input schema:

  • apify run runs without input validation or defaults.
  • apify validate-schema skips the input schema.
  • apify actor generate-schema-types fails with Input schema has not been found at .actor/INPUT_SCHEMA.json.
  • apify edit-input-schema opens an empty schema at .actor/INPUT_SCHEMA.json instead of the configured file.

When both inputSchema and input are set, or an old INPUT_SCHEMA.json is still in the project, the CLI uses a different file than the platform.

What we want

  • readInputSchema resolves inputSchema first when it is set, then input, exactly as the platform does. It falls back to the default paths only when neither is set. An empty string counts as unset, as on the platform.
  • readOutputSchema and the output schema check in apify validate-schema resolve outputSchema first, then output.
  • Both aliases accept a path relative to .actor/ or an inline schema object, like the base keys.
  • When both the alias and the base key are set, the alias wins without an error. The docs do not state a precedence, but the platform build applies this one and accepts both keys.

How it's tested

A new test/local/lib/input-schema.test.ts for the readers in src/lib/input_schema.ts, which have no unit tests today:

  • readInputSchema: inputSchema as a path outside the default locations returns that file; inputSchema as an inline object returns the object; with both inputSchema and input set, it returns the inputSchema schema; an empty inputSchema falls through to input; only input set and neither set keep today's behavior; inputSchema pointing at a missing file warns, or throws with throwOnMissing.
  • readOutputSchema: outputSchema as a path and as an inline object; with both set, it returns the outputSchema schema; only output set keeps today's behavior.

Command cases:

  • test/local/commands/validate-schema.test.ts: a project with inputSchema and outputSchema validates both schemas.
  • test/local/commands/actor/generate-schema-types.test.ts: a project with inputSchema and outputSchema generates input.ts and output.ts.

Links

Activity

  1. added theissue type on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-buildersIssues owned by the Builders team.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions