Skip to content

Move validators to pub_validation package and install via dart install - #4858

Draft
mosuem wants to merge 8 commits into
dart-lang:mainfrom
mosuem:pub-validation
Draft

Move validators to pub_validation package and install via dart install#4858
mosuem wants to merge 8 commits into
dart-lang:mainfrom
mosuem:pub-validation

Conversation

@mosuem

@mosuem mosuem commented Aug 14, 2026

Copy link
Copy Markdown
Member

Description

This PR moves in-tree package validators out of package:pub into a standalone package package:pub_validation.

Behavior on dart pub publish

  1. Workspace Dependency Detection:
    • If pub_validation (or the configured validation package) is declared in the package's pubspec.yaml (dev_dependencies, dependencies, or dependency_overrides), pub runs the locally resolved version using dart run <package>:<package>. This allows developers to pin, customize, or fork validator packages safely via audited workspace dependencies without fetching code at publish time.
  2. Fallback to Global Installation:
    • If not declared in pubspec.yaml, pub installs the default version via dart install pub_validation@^0.1.0-dev and executes the binary from Dart's global install directory.
  3. Structured Diagnostics:
    • pub_validation executes with --json on the package directory, and pub parses reported errors, warnings, and hints to present to the user.

Configuration & CLI Options

  • --validation-package=<package[@descriptor]>: Specifies the validation package to install and run (defaults to pub_validation@^0.1.0-dev).
  • --validation-hosted-url=<url>: Specifies the package server from which to install the validation package (defaults to https://pub.dev).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant