Skip to content

Dependency version field limited to 100 chars even when specifying a package URL #5459

@mirinae3145

Description

@mirinae3145

What kind of issue is this?

  • PlatformIO Core

Configuration

PlatformIO Version: 6.1.19

Description of problem

When a dependency entry in library.json specifies an URL instead of a SemVer, the version value is validated with the max=100 length constraint used for normal SemVer strings:

# platformio/package/manifest/schema.py
class DependencySchema(StrictSchema):
    owner = fields.Str(validate=validate.Length(min=1, max=100))
    name = fields.Str(required=True, validate=validate.Length(min=1, max=100))
    version = fields.Str(validate=validate.Length(min=1, max=100))

This is fine for actual version strings, but an URL can sometimes exceed 100 characters.

Steps to Reproduce

  1. Create a library.json with a dependency that has no owner, and a version that is a long URL (>100 chars):
{
  "name": "ExampleLib",
  "version": "1.0.0",
  "dependencies": [
    {
      "name": "external-dep",
      "version": "https://github.com/some-org/some-repository/releases/download/some-long-prelease-version/some-long-binary-name.zip"
    }
  ]
}
  1. Run pio pkg pack.

Actual Results

ManifestValidationError: Invalid manifest fields: {'dependencies': {0: {'version': ['Length must be between 1 and 100.']}}}. 
Please check specification -> https://docs.platformio.org/page/librarymanager/config.html

So does with an actual URL.

Expected Results

This should be valid because version field maybe adheres to Remote TAR or ZIP archive spec when it is indicating a package specification, and other URL-compatible fields are mostly validated with max=255 such as:

# Class ManifestSchema
    downloadUrl = fields.Url(validate=validate.Length(min=1, max=255))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions