Skip to content

Commit

Permalink
Merge pull request #137 from TripSit/schema-validation
Browse files Browse the repository at this point in the history
Schema validation
  • Loading branch information
utaninja authored Apr 22, 2024
2 parents 28fbe43 + cb04c61 commit 18a0335
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 207 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ combo_definitions.json @utaninja @zelixir25
/translations @LunaUrsa
/types/ @LunaUrsa
.gitignore @LunaUrsa
package-lock.json @LunaUrsa
package.json @LunaUrsa
README.md @LunaUrsa
tsconfig.json @LunaUrsa
14 changes: 11 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Validate changes

on:
pull_request:
branches:
- main
- development
types:
- opened
- synchronize
Expand All @@ -29,3 +26,14 @@ jobs:
run: npx ts-node ./scripts/combosToDrugs.ts --github-check
env:
CI: true

- name: Assign Pull Request
uses: actions/github-script@v5
with:
script: |
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: ['LunaUrsa']
})
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@
"tsbuildinfo",
"Tyramine",
"uneccessary",
"utaninja",
"Valproic",
"Vapaatalo",
"vapourised",
Expand All @@ -666,6 +667,7 @@
"Xanax",
"xaxis",
"yage",
"zelixir",
"zyban",
"αphp",
"αpvp"
Expand Down
2 changes: 1 addition & 1 deletion drugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -32049,7 +32049,7 @@
],
"dose": "Intravenously Light: 10-30mg Common: 30-60mg Strong: 60-100mg | Note: Do not take this as gospel. Please read ~experiences if you use this substance outside of a hospital setting.",
"duration": "Intravenous: 10-20 minutes.",
"experiences": "https://www.reddit.com/r/Drugs/comments/56n5vq/michael_jackson_the_addict/d8l0qe7 (PM Sleep/Hypnos if you'd like more information)",
"experiences": "https://www.reddit.com/r/Drugs/comments/56n5vq/michael_jackson_the_addict/d8l0qe7",
"onset": "Intravenous: 0-2 minutes.",
"summary": "A very short acting sedative that is usually given at the start of general anesthesia, and for maintenance of the prior. It should never be used outside of a medical setting. With that in mind, if you do plan to use this drug recreational, please have a very experienced friend with you that has the skills to insert a cannula, and monitor you very closely."
}
Expand Down
69 changes: 69 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tripsit_drug_db",
"version": "1.0.2",
"description": "TripSit's Drug Database",
"main": "index.ts",
"main": "./scripts/index.ts",
"scripts": {
"compare": "ts-node ./scripts/combosToDrugs.ts"
},
Expand All @@ -28,6 +28,8 @@
"homepage": "https://github.com/TripSit/drugs#readme",
"types": "types/drugs.d.ts",
"devDependencies": {
"ajv": "^8.12.0",
"ajv-formats": "^3.0.1",
"@types/node": "^20.11.10",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion schemas/combo_definitions-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/ComboDefinition"
Expand Down
2 changes: 1 addition & 1 deletion schemas/combos-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Combos",
"definitions": {
"Combos": {
Expand Down
107 changes: 15 additions & 92 deletions schemas/drugs-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Drug"
Expand Down Expand Up @@ -55,10 +55,7 @@
"type": "object",
"additionalProperties": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
"format": "uri"
}
},
"dose_note": {
Expand Down Expand Up @@ -305,33 +302,15 @@
"properties": {
"experiences": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
],
"qt-uri-extensions": [
".shtml"
]
"format": "uri"
},
"pihkal": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
],
"qt-uri-extensions": [
".shtml"
]
"format": "uri"
},
"tihkal": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
],
"qt-uri-extensions": [
".shtml"
]
"format": "uri"
}
},
"required": [
Expand Down Expand Up @@ -381,14 +360,7 @@
},
"experiences": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
],
"qt-uri-extensions": [
".php",
".shtml"
]
"format": "uri"
},
"warning": {
"type": "string"
Expand All @@ -413,10 +385,7 @@
},
"wiki": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http"
]
"format": "uri"
},
"mdma": {
"type": "string"
Expand Down Expand Up @@ -462,34 +431,18 @@
},
"molecule": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http"
],
"qt-uri-extensions": [
".jpg",
".png"
]
"format": "uri"
},
"vaporization": {
"type": "string"
},
"calculator": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http"
]
"format": "uri"
},
"chart": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http"
],
"qt-uri-extensions": [
".png"
]
"format": "uri"
},
"Oral": {
"type": "string"
Expand Down Expand Up @@ -569,65 +522,35 @@
"_general": {
"type": "array",
"items": {
"type": "string",
"qt-uri-protocols": [
"http",
"https"
]
"type": "string"
}
},
"dose": {
"type": "array",
"items": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http"
],
"qt-uri-extensions": [
".full"
]
"format": "uri"
}
},
"duration": {
"type": "array",
"items": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http"
],
"qt-uri-extensions": [
".full"
]
"format": "uri"
}
},
"bioavailability": {
"type": "array",
"items": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
"format": "uri"
}
},
"legality": {
"type": "array",
"items": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"http",
"https"
],
"qt-uri-extensions": [
".asp",
".aspx",
".cfm",
".html",
".pdf"
]
"format": "uri"
}
},
"onset": {
Expand Down
Loading

0 comments on commit 18a0335

Please sign in to comment.