Skip to content

Add npm SemVer schema#4233

Closed
danielbayley wants to merge 2 commits intoSchemaStore:masterfrom
danielbayley:npm-semver
Closed

Add npm SemVer schema#4233
danielbayley wants to merge 2 commits intoSchemaStore:masterfrom
danielbayley:npm-semver

Conversation

@danielbayley
Copy link
Copy Markdown
Contributor

@danielbayley danielbayley commented Nov 23, 2024

For use as $reference, for example:

"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/schemas/npm-semver",
"properties": {
  "dependencies": {
    "type": "object",
    "additionalProperties": {
      "$ref": "https://json.schemastore.org/npm-semver.json"
    }
  }
}
"$schema": "/schemas/npm-semver",
"dependencies": {
  "caret": "^1.0.0",
  "tilde": "~1.0.0",
  "range": "1.x",
  "more": ">=1.0.0",
  "less": "<=2.0.0",
  "wildcard": "*",
  "tag": "latest"
}

Note

For reference, better linting, and composability, I have built my own collection of schemas here: https://github.com/danielbayley/schemas

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for the PR!

This section of the codebase is owned by @madskristensen and @hyperupcall - if they write a comment saying "LGTM" then it will be merged.

@hyperupcall
Copy link
Copy Markdown
Member

hyperupcall commented Nov 23, 2024

Thanks for your pull request! Unfortunately, in this case I believe that this schema doesn't follow the guidelines of overconstraint as mentioned in the CONTRIBUTING. For example, if a user violates this npm semver constraint, the schema error message will be long and show a complex regular expression (that is rather difficult to parse), which reduces the developer experience, I believe

The schema file is also a bit too small, to have it's own entry

@danielbayley
Copy link
Copy Markdown
Contributor Author

if a user violates this npm semver constraint, the schema error message will be long and show a complex regular expression

@hyperupcall Is the problem not then, with the error message? Could/should it not just show the description, with a link to further information from the accompanying $comment URL?

@hyperupcall
Copy link
Copy Markdown
Member

@danielbayley If the problem does lie with the error message, it would be moot since there is generally no way to customize the error message. Things could be added to the description, like more notes and links to notes, but I don't think that's the best solution

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.

2 participants