Skip to content

Create vers-type-definition.schema-0.1.json - #78

Open
mjherzog wants to merge 5 commits into
mainfrom
draft-vers-type-definition-schema-v0.1
Open

Create vers-type-definition.schema-0.1.json#78
mjherzog wants to merge 5 commits into
mainfrom
draft-vers-type-definition-schema-v0.1

Conversation

@mjherzog

Copy link
Copy Markdown
Member

First draft of a VERS type definition schema

  • Adapted from PURL type definition schema and VERS test schema
  • Using JSON schema 2020-12 as requested by tschmidtb51
  • Encountered error from https://www.jsonschemavalidator.net/ on line 113: After parsing a value an unexpected character was encountered: : (double-quote)

First draft of a VERS type definition schema
- Based on PURL type definition schema
- Using JSON schema 2020-12 as requested by tschmidtb51
- Encountered error from https://www.jsonschemavalidator.net/ on line 113:  After parsing a value an unexpected character was encountered: :.

Signed-off-by: Michael Herzog <mjherzog@aboutcode.org>
@mjherzog
mjherzog requested a review from pombredanne July 22, 2026 23:14
@mjherzog mjherzog added the Ecma standard Related to the planned Ecma standard for VERS label Jul 22, 2026
@mjherzog mjherzog linked an issue Jul 22, 2026 that may be closed by this pull request
mjherzog added 2 commits July 29, 2026 14:58
Updates to pass schema validation
Used prefixItems which is new with JSON Schema Draft 2020-12
Still getting an error on last line:
"
Additional text encountered after finished reading JSON content: }."
but I cannot figure this one out.
@mjherzog

Copy link
Copy Markdown
Member Author

@pombredanne
I made some updates including use of prefixItems which is new with JSON Schema Draft 2020-12
Still getting an error on last line:
"Additional text encountered after finished reading JSON content: }."

I expect that this has something to do with pairing braces, but I cannot figure it out.
I also need your review of the schema content.

@johnmhoran

Copy link
Copy Markdown
Member

@mjherzog I think there's an extra closing brace } at the bottom of the file.

@mjherzog

Copy link
Copy Markdown
Member Author

@johnmhoran I expect that it is a problem with the braces, but when I remove the last closing brace I get different errors

@johnmhoran

Copy link
Copy Markdown
Member

@mjherzog Can you paste the error text here?

@mjherzog

Copy link
Copy Markdown
Member Author

I appreciate your help. The best way to reproduce is to open a browser tab for: https://www.jsonschemavalidator.net/
Use View file for https://github.com/package-url/vers-spec/pull/78/changes#diff-d967d379320cccad968a26d8cac921fd79af0a3c0c423b4329069cca6407d66a to get the text and paste it into the validator.
This way you can see the error in real-time and experiment with fixes.

@johnmhoran

Copy link
Copy Markdown
Member

@mjherzog We've been using "$schema": "http://json-schema.org/draft-07/schema#", but your example uses "$schema": "http://json-schema.org/2020-12/schema#". Have we decided to move to 2020-12?

@mjherzog

Copy link
Copy Markdown
Member Author

We had a specific request for this from the CSAF team so we should use the current version for a new standard imho. I used a 2020-12 feature for prefixItems.
I am proposing that we also upgrade for PURL but that is a separate question.

@johnmhoran

johnmhoran commented Jul 30, 2026

Copy link
Copy Markdown
Member

@mjherzog Sticking with 2020-12, I saw that the error pointed to the "examples" object (line 116), that "examples" is one of the items listed under "required" (lines 28-35), and that each of the items under "required" -- except "examples" -- is listed (starting at line 36) under "properties". I moved "examples" to the "properties" object immediately following "description" (line 69), joining the other items listed under "required", and the modified JSON passed the 2020-12 validation.

@mjherzog

mjherzog commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

@johnmhoran Hallelujah. Please update the PR to make that change if you can.

If we move the "examples" object 

- from its current location 
- to the "properties" object at the top of the file (immediately after the "description" object, just as they are listed above there in the "required" object)

the updated .json passes the 2020-12 validator check.
@johnmhoran

Copy link
Copy Markdown
Member

@mjherzog I had thought I could not update someone else's PR, based on looking into the question a year or two back, but I do see an "edit" button and will click it and see what I can do. . . . Excellent -- I was able to replace with an updated and reformatted file and it still passes the 2020-12 check.

@mjherzog

mjherzog commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Outstanding - thank you!

@mjherzog

Copy link
Copy Markdown
Member Author

@pombredanne Please review the schema for accuracy.

Changed $schema to https instead of http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ecma standard Related to the planned Ecma standard for VERS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create JSON Schema for VERS types

2 participants