Skip to content

[feat] Plugin names should be able to include underscore '_' #11262

Description

@rkofman

Describe the problem

When creating my first (internal) plugin, I called it sqlite_proxy. Then I spent literally hours chasing down the build issue because the message is not very clear:

  thread 'main' panicked at build.rs:11:6:
  failed to run tauri-build: failed to parse JSON: identifiers can only include lowercase ASCII, hyphens which are not leading or trailing, and a single colon if using a prefix at line 16 column 23

It does not identify the .json file that needs fixing; nor specify that identifiers here refers to plugin names. Being new to the plugin ecosystem, I assumed that I simply failed to create some sort of capability file / permission setup. This was not the case. The above error message is a result of #9952, which improved the state of the world, but punted on documentation changes and the underlying issue.

Describe the solution you'd like

I believe there are 3 different levels of fixing this, listed in order of difficulty:

  • Update the documentation around plugins to be very explicit about allowed names.
  • Update the error message to:
    1. mention the file it's failing on
    2. mention that the problem is the plugin name.
    3. Optionally add validation elsewhere that fails quickly on disallowed plugin names (e.g. plugin init)
  • The ultimate fix would be to simply remove this constraint.
    Note: this was already considered in [feat] Better errors when deserializing capabilities #9951: writing our own deserializer without serde_untagged. I do not know the specific limitations of serde/serde_untagged regarding this. Sharing context on the reasons it's so painful to change might be useful.

Alternatives considered

No response

Additional context

I personally wouldn't consider the issue fully solved until the restriction is removed; however the interim steps would help mitigate some of the harm.

Metadata

Metadata

Assignees

No one assigned

    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