-
Notifications
You must be signed in to change notification settings - Fork 197
Refine Purl type schema #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
150 commits
Select commit
Hold shift + click to select a range
b65812b
Initial check-in of purl type definition support
stevespringett d5d170e
Added index and doc generation
stevespringett 4e5ae33
Removed description from index and added note to all docs
stevespringett 532f7d2
Updated Maven definition
stevespringett d13aefd
Simplified case normalization
stevespringett 950dc67
Added npm definition
stevespringett aa5fb80
Added auto-generated files - these will be overwritten once the GitHu…
stevespringett 59347ce
Added SWID definition
stevespringett e1833aa
Change README files case
pombredanne 305664c
Remove description from the index
pombredanne 254c0b3
Remove URL from index.
pombredanne 3ba7bf9
Improve JSON schema definition
pombredanne 5c1e926
Update schemas to separate tests
pombredanne 1e154c8
Improve schemas
pombredanne d305de2
Refine .ignore
pombredanne 4c3b4e6
Move doc script to etc/ directory
pombredanne 6a92f1c
Make license text usable as a code header
pombredanne f5f3ab4
Rename purl-type.schema.json
pombredanne d564f48
Rename index to plural
pombredanne 95ceb9e
Rename definition with a proper name suffix
pombredanne 3816f76
Refine schema organization
pombredanne 2f4f849
Add new Makefile and dev doc
pombredanne 74ba309
Update doc
pombredanne 8b36064
Update type docs
pombredanne 30e46cb
Rename generated definitions with better name
pombredanne ad7b048
Ensure check pass
pombredanne a963c48
Improve code formatting
pombredanne 5f7cbba
Refine description of schema elements
pombredanne d08e581
Format schema
pombredanne 9870507
Format JSON
pombredanne f42bd5f
Add extra tools as dependencies
pombredanne 311be40
Add script to format JSON
pombredanne 4a5afca
Improve code generation
pombredanne 77a7d1c
Improve formating and more
pombredanne 483f481
Move docs to the root of the repo as types-doc
pombredanne c326ed2
Add generated code for schemas
pombredanne 074f595
Rename PURL types index
pombredanne ae597d3
Improve PURL types index schema
pombredanne 29d3dd3
Is case senstive has a default
pombredanne 0767bd4
Add new type index
pombredanne 3e20728
Make doc generation work
pombredanne df4bb5f
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 8913ce1
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne b2d514f
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 74e6d92
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne c443a22
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne b8c73d7
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne dafabe7
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 5665c22
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 25c498e
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 2b27bcf
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne f46c433
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne d92ba8e
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 9945f62
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 525ce13
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 1f5dd84
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 23d2f98
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne b33c631
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 0368e13
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 0fc12ff
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne f9ac30a
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 0ef6523
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne aa01afa
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 12e9ea7
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne 6becb1d
* Copy test-suite-data.json to splits/gem-test.json splits/deb-test.j…
pombredanne d88ea14
Copy test-suite-data.json to splits/gem-test.json splits/deb-test.jso…
pombredanne 22db397
Use only type-specific tests.
pombredanne 4e41afd
Rename splits to tests
pombredanne a60f052
Move early JSON types tests to own subdirectory
pombredanne 6ae390b
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne b5661f5
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne add3402
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 9ce0a98
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne d59a6f3
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne e94a22f
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 6f025ca
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 64567c9
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 35d47e0
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 54bb868
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne dca3030
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 65f295d
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 0bf7e26
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne e932f0a
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 002e380
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 9d97a3c
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 829f026
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 6ff388e
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne d17fdf3
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne a256d0b
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne f1d91a5
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne dc386aa
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 736ce84
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 938bc86
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 23c377b
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 394e5c1
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 3f2e740
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 313b572
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 9549345
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 2f70e7a
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 3bb254a
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne afea29d
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 7a9b8bd
* Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definit…
pombredanne b494f98
* Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definit…
pombredanne 655459f
Copy PURL-TYPES.rst to types/alpm-definition.json types/apk-definitio…
pombredanne 1d6931e
Remove definitions not specific to a type
pombredanne 9d7251a
Add script to split files
pombredanne cfd4c01
Clarify that a repository url is for the default
pombredanne 5c9c5d5
Move repository 1st
pombredanne 46a7b7a
Add formatted type defs
pombredanne a8f542b
Remove double backticks
pombredanne aa1f697
Format JSON test files
pombredanne 3215796
Remove older test files
pombredanne 615e5a6
Use note and description consistently
pombredanne d8a1cf4
Focus checks and gen on subset of valid JSON types
pombredanne 4968f6a
Ignore dev cache
pombredanne e1ab37a
Complete type def conversion to JSON
pombredanne 8656191
Make all type def schema valid
pombredanne 39c34e5
Generate all docs
pombredanne c497de2
Rename is_case_sensitive to case_sensitive
pombredanne ed0d249
Convert tests to new format
pombredanne a5726ba
Do not checkjson when generating code
pombredanne 3f92e2b
Ignore pycache
pombredanne 7f1a975
Format JSON
pombredanne 955ab87
Add missing test Python code
pombredanne d818185
Add new feature to generate tests from examples
pombredanne 18b23c6
Extend tests for all types
pombredanne eb00742
Enable schema validation for test files
pombredanne 70b3f04
Check for duplicated tests
pombredanne a9ba953
Merge branch 'main' into purl_type_schema-refined
pombredanne 2821916
Refine tests
pombredanne 5551749
Move config file to scripts
pombredanne 82c0ab0
Move requirements to etc/scripts
pombredanne 0880e81
Improve ignore file
pombredanne 2cba852
Remove all backticks from type definitions
pombredanne cfa0205
Remove URL decoration
pombredanne 97d4ac4
Fix typo in npm type comment
pombredanne 9c6898a
Improve readbility for command example
pombredanne b1e8288
Update .github/workflows/generate-index-and-docs.yml
pombredanne 9c655f9
Update Makefile
pombredanne c5ed010
Move type tests to their own directory
pombredanne 7aa181f
Move spec tests to their own directory
pombredanne 1c45ea4
Rename None tests to spec tests
pombredanne 2e39451
Merge branch 'purl_type_schema-refined' of https://github.com/package…
pombredanne a9ef4e1
Checlk JSON in new directory structure
pombredanne ab53664
Regenerated types documentation
pombredanne 496e6ff
Move purl-types-index.json at the root
pombredanne fa559bc
Update purl-types-index.json path references
pombredanne de752b1
Merge branch 'main' into purl_type_schema-refined
pombredanne 8a699a9
Removing old test suite
pombredanne 526126f
Remove old type definitions
pombredanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Check and generate PURL Type Docs and Index | ||
|
||
on: | ||
push: | ||
paths: | ||
- "types/*.json" | ||
- "schemas/*.json" | ||
- "etc/" | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
# All permissions should be specified at the job level | ||
permissions: { } | ||
|
||
jobs: | ||
generate-index-and-docs: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
content: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: make conf | ||
|
||
- name: Validate code and data formats | ||
run: make check | ||
|
||
- name: Generate index and docs | ||
run: make gendocs | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add types/ types-doc/ | ||
git commit -s -m "Generate updated PURL type documentation" || echo "No changes to commit" | ||
git push | ||
pombredanne marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/tmp/ | ||
/venv/ | ||
/.python-version | ||
.ruff_cache/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# SPDX-License-Identifier: MIT | ||
# Copyright (c) the purl authors | ||
# Visit https://github.com/package-url/purl-spec and https://packageurl.org for support | ||
|
||
PYTHON_EXE?=python3 | ||
VENV_LOCATION=venv | ||
ACTIVATE?=. ${VENV_LOCATION}/bin/activate; | ||
|
||
CODEGEN?=datamodel-codegen \ | ||
--target-python-version 3.10 \ | ||
--use-double-quotes \ | ||
--use-exact-imports \ | ||
--use-standard-collections \ | ||
--wrap-string-literal \ | ||
--enum-field-as-literal all \ | ||
--formatters ruff-format \ | ||
--field-constraints \ | ||
--disable-timestamp \ | ||
--keep-model-order \ | ||
--custom-file-header-path LICENSE \ | ||
--input-file-type jsonschema \ | ||
--output-model-type pydantic_v2.BaseModel | ||
|
||
virtualenv: | ||
@echo "-> Bootstrap the virtualenv with PYTHON_EXE=${PYTHON_EXE}" | ||
${PYTHON_EXE} -m venv ${VENV_LOCATION} | ||
|
||
conf: virtualenv | ||
@echo "-> Install dependencies" | ||
@${ACTIVATE} pip install -r etc/scripts/requirements.txt | ||
|
||
formatcode: | ||
@echo "-> Run Ruff format" | ||
@${ACTIVATE} ruff check --select I --fix | ||
@${ACTIVATE} ruff format | ||
@echo "-> Run Ruff linter" | ||
@${ACTIVATE} ruff check --fix | ||
|
||
formatjson: | ||
@echo "-> Format JSON files" | ||
@${ACTIVATE} python etc/scripts/format_json.py schemas/ | ||
@${ACTIVATE} python etc/scripts/format_json.py types/ | ||
@${ACTIVATE} python etc/scripts/format_json.py tests/ | ||
|
||
format: formatcode formatjson | ||
@echo "-> Format all files" | ||
|
||
checkjson: | ||
@echo "-> Validate JSON schemas" | ||
@${ACTIVATE} check-jsonschema --check-metaschema --verbose schemas/*.json | ||
@echo "-> Validate JSON data files against the schemas" | ||
@${ACTIVATE} check-jsonschema --schemafile schemas/purl-types-index.schema.json --verbose purl-types-index.json | ||
@${ACTIVATE} check-jsonschema --schemafile schemas/purl-type-definition.schema.json --verbose types/*-definition.json | ||
@${ACTIVATE} check-jsonschema --schemafile schemas/purl-test.schema.json --verbose tests/*/*-test.json | ||
|
||
checkcode: | ||
@echo "-> Run Ruff linter validation (pycodestyle, bandit, isort, and more)" | ||
@${ACTIVATE} ruff --config etc/scripts/pyproject.toml check | ||
@echo "-> Run Ruff format validation" | ||
@${ACTIVATE} ruff --config etc/scripts/pyproject.toml format --check | ||
|
||
check: checkjson checkcode | ||
@echo "-> Run all checks" | ||
|
||
clean: | ||
@echo "-> Clean the Python env" | ||
rm -rf .venv/ | ||
find . -type f -name '*.py[co]' -delete | ||
|
||
gencode: | ||
@echo "-> Generate Python code from schemas" | ||
@${ACTIVATE} ${CODEGEN} \ | ||
--input schemas/purl-types-index.schema.json \ | ||
--output etc/scripts/purl_types_index.py | ||
@${ACTIVATE} ${CODEGEN} \ | ||
--input schemas/purl-type-definition.schema.json \ | ||
--output etc/scripts/purl_type_definition.py | ||
@${ACTIVATE} ${CODEGEN} \ | ||
--input schemas/purl-test.schema.json \ | ||
--output etc/scripts/purl_test.py | ||
@echo "-> Run Black format for generated code" | ||
@${ACTIVATE} black -l 100 --preview --enable-unstable-feature string_processing etc/scripts/*.py | ||
|
||
gendocs: | ||
@${ACTIVATE} python etc/scripts/generate_index_and_docs.py | ||
|
||
|
||
.PHONY: virtualenv conf formatcode formatjson format checkcode checkjson check clean gencode gendocs |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.