Skip to content

json_schemas: actor.schema.json .version regex is looser than platform admission (accepts 3-part SemVer, platform rejects) #667

Description

@DaveHanns

Problem

The published actor schema at packages/json_schemas/schemas/actor.schema.json:25 defines the .version pattern as:

"pattern": "^([0-9]+)\\.([0-9]+)(\\.[0-9]+){0,1}$"

This regex accepts BOTH 2-part MAJOR.MINOR and 3-part MAJOR.MINOR.PATCH version strings.

However, the actual platform admission gate in apify-core (src/packages/simple-schema/src/regexs.ts:2) enforces a stricter regex:

^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$

This is MAJOR.MINOR only, each segment 0-99. Empirically verified 2026-06-17 on test Actor pYSXdpQa55nSb6SID: "version": "1.0.0" is rejected at POST /v2/acts/{id}/versions.

Consequence: every third-party linter, IDE integration, or SDK that validates against the published @apify/json_schemas reports 3-part SemVer as valid — but the platform rejects it on push. Users (and agents that consume the schema) get contradictory signals from the two sources of truth.

Proposal

Two coordinated changes:

  1. Tighten the published regex in packages/json_schemas/schemas/actor.schema.json:25 to match the platform:

    "pattern": "^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$"
  2. Export the regex as a shared constant so apify-core can consume a single source of truth (currently defined in two places that could drift again). Options:

    • Export from @apify/consts as MAJOR_MINOR_VERSION_REGEX.
    • Or add a packages/utilities helper assertValidActorJsonVersion(v: string).

    Then update apify-core src/packages/simple-schema/src/regexs.ts:2 to import the shared constant.

Impact

Medium. Every external tool that validates against the published schema (Renovate/Dependabot custom manifests, IDE JSON validators, third-party SDKs) reports false-positive "valid" for 3-part SemVer. Combined with apify-docs's three "1.0.0" examples (separate issue against apify-docs) and the CLI's lack of client-side validation before upload, the whole MAJOR.MINOR invariant is under-defended.

Related

  • Cross-refs: apify-docs fix for three "1.0.0" docs examples; apify-cli client-side validation before upload; apify-core regex constant unification.

Surfaced during an evaluation of Apify surfaces for agent-driven Actor development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions