Skip to content

Split schema into multiple files for better development #37

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

Open
wants to merge 82 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
4064e28
splitting and merging complete.next: github action
Halkenhaeusser Mar 9, 2023
abcc88c
added separated files
Halkenhaeusser Mar 9, 2023
51b501d
trying github action
Halkenhaeusser Mar 9, 2023
7904f1c
insert missing tab.
Halkenhaeusser Mar 9, 2023
c2d5d96
retry github action
Halkenhaeusser Mar 9, 2023
954f511
file location
Halkenhaeusser Mar 9, 2023
e70316f
debugging
Halkenhaeusser Mar 9, 2023
e551b8d
change location
Halkenhaeusser Mar 9, 2023
969aad8
debug
Halkenhaeusser Mar 9, 2023
9288889
more debug
Halkenhaeusser Mar 9, 2023
422d8ae
db
Halkenhaeusser Mar 9, 2023
e7c0301
one more try
Halkenhaeusser Mar 9, 2023
1abe4db
adding committing
Halkenhaeusser Mar 9, 2023
57b1e59
combined the file
invalid-email-address Mar 9, 2023
615a8a5
Delete newfilefortesting.json
Halkenhaeusser Mar 9, 2023
113655a
combined the file
invalid-email-address Mar 9, 2023
f205cb2
Delete 06_properties.json
Halkenhaeusser Mar 9, 2023
c2f799f
combined the file
invalid-email-address Mar 9, 2023
b80a5ee
Create 14_test.json
Halkenhaeusser Mar 9, 2023
0bcdeee
combined the file
invalid-email-address Mar 9, 2023
5601448
remove the test file and rm properties
Halkenhaeusser Mar 9, 2023
569b44b
combined the file
invalid-email-address Mar 9, 2023
9b773c3
test worked.
Halkenhaeusser Mar 9, 2023
40286ea
combined the file
invalid-email-address Mar 9, 2023
a54d085
Delete newfilefortesting.json
Halkenhaeusser Mar 9, 2023
dddc784
allow empty commits
Halkenhaeusser Mar 9, 2023
f65d9f8
combined the file
invalid-email-address Mar 9, 2023
741a632
switch order
Halkenhaeusser Mar 15, 2023
e11afef
fix indent
Halkenhaeusser Mar 15, 2023
100ed6f
combined the file
invalid-email-address Mar 15, 2023
cb61a94
files checking
Halkenhaeusser Mar 15, 2023
9606402
combined the file
invalid-email-address Mar 15, 2023
6f83933
next test
Halkenhaeusser Mar 15, 2023
44f0139
combined the file
invalid-email-address Mar 15, 2023
711c9f8
slightly modified syntax
Halkenhaeusser Mar 15, 2023
1d29dfd
combined the file
invalid-email-address Mar 15, 2023
011827c
trying just with one file
Halkenhaeusser Mar 15, 2023
cabef49
Prettified Code!
Halkenhaeusser Mar 15, 2023
d68eda0
adding pull and sequential order
Halkenhaeusser Mar 15, 2023
0d7a9e0
combined the file
invalid-email-address Mar 15, 2023
c63bde5
add second prettier option.
Halkenhaeusser Mar 15, 2023
350f7e7
debug
Halkenhaeusser Mar 15, 2023
1008dc9
combined the file
invalid-email-address Mar 15, 2023
f15e5fd
test as list
Halkenhaeusser Mar 15, 2023
e88a373
next try
Halkenhaeusser Mar 15, 2023
cf9d9ce
combined the file
invalid-email-address Mar 15, 2023
fa39d88
typo
Halkenhaeusser Mar 15, 2023
ebd6a71
combined the file
invalid-email-address Mar 15, 2023
4476b43
debug checkout
Halkenhaeusser Mar 15, 2023
43a7dac
combined the file
invalid-email-address Mar 15, 2023
c895867
try next suggestion
Halkenhaeusser Mar 15, 2023
b0c2af3
combined the file
invalid-email-address Mar 15, 2023
3884b66
adding git pull before
Halkenhaeusser Mar 15, 2023
1ad1d78
combined the file
invalid-email-address Mar 15, 2023
6fd0bf8
Prettified Code!
Halkenhaeusser Mar 15, 2023
983a96f
squash commits
Halkenhaeusser Mar 9, 2023
0276f20
Merge branch '15-github-action-ci-pipeline-for-merging-the-specificat…
Halkenhaeusser Mar 15, 2023
e3a5d9d
combined the file
invalid-email-address Mar 15, 2023
0442991
Prettified Code!
Halkenhaeusser Mar 15, 2023
ab3f8f1
small updates. build example generator (not fully working)
Halkenhaeusser Mar 22, 2023
304471d
small naming fix in yaml
Halkenhaeusser Mar 22, 2023
c9e1d4b
combined the file
invalid-email-address Mar 22, 2023
f32bb2b
Prettified Code!
Halkenhaeusser Mar 22, 2023
3dd4981
example-generator add missing line
Halkenhaeusser Mar 22, 2023
3a4e901
combined the file
invalid-email-address Mar 22, 2023
12371f8
Prettified Code!
Halkenhaeusser Mar 22, 2023
d1bd717
change output file name
louisloechel May 9, 2023
111d669
combined the file
invalid-email-address May 9, 2023
6dd7629
Prettified Code!
louisloechel May 9, 2023
3ef2b86
Delete combined.json
louisloechel May 9, 2023
83ac0db
combined the file
invalid-email-address May 9, 2023
ce49813
New split / recompile scripts
tomijange May 11, 2023
40b32c7
Merge branch 'v2' into 15-github-action-ci-pipeline-for-merging-the-s…
tomijange May 11, 2023
e58c28e
Fix typo
tomijange May 11, 2023
b68b824
combined the file
invalid-email-address May 11, 2023
33b7835
remove example-generator
tomijange May 11, 2023
78a1403
Overwritten by Github Actions
tomijange May 11, 2023
94e6399
test gh action
tomijange May 11, 2023
79ea6d0
Overwritten by Github Actions (Prettify tilt-schema.json)
tomijange May 11, 2023
a5d9a62
Overwritten by Github Actions
tomijange May 11, 2023
d0cd8ba
Update main.yaml
tomijange May 11, 2023
2a54277
Overwritten by Github Actions
tomijange May 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,33 @@ on:
branches:
- v2 # !! Update this once we merge to master !!

jobs:
prettier:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:

reconstruct:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}

- name: Prettify code
uses: creyD/prettier_action@v4.3
with:
# This part is also where you can pass other options, for example:
prettier_options: --write **/tilt-schema.json
- name: Checkout code
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Run Python script
run: |
python scripts/recompile.py
python scripts/extract-example.py

- name: Commit & Push
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Overwritten by Github Actions (Prettify tilt-schema.json)

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -975,4 +975,4 @@
<span class=w> </span><span class=s2>&quot;urlOfNewVersion&quot;</span><span class=o>:</span><span class=w> </span><span class=s2>&quot;https://greencomp.de/privacypolicy/2&quot;</span>
<span class=w> </span><span class=p>}</span>
<span class=p>]</span>
</pre></div> </div> </div> </div> </div> </div> <footer> <p class=generated-by-footer>Generated using <a href=https://github.com/coveooss/json-schema-for-humans>json-schema-for-humans</a> on 2023-05-09 at 15:40:24 +0000</p> </footer></body> </html>
</pre></div> </div> </div> </div> </div> </div> <footer> <p class=generated-by-footer>Generated using <a href=https://github.com/coveooss/json-schema-for-humans>json-schema-for-humans</a> on 2023-05-11 at 15:42:23 +0000</p> </footer></body> </html>
15 changes: 15 additions & 0 deletions scripts/extract-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import json
from pathlib import Path

base_path = Path( __file__ ).parent.parent
tilt_schema_path = base_path / Path("tilt_schema")
tilt_schema_path.mkdir(exist_ok=True)

indent = 2

root_schema = None
with open(tilt_schema_path / Path("root_schema.json"), "r") as f:
root_schema = json.load(f)

with open(base_path / Path("tilt.json"), "w") as f:
json.dump(root_schema["examples"][0], f, indent=indent)
30 changes: 30 additions & 0 deletions scripts/recompile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import json
from pathlib import Path
import re

base_path = Path( __file__ ).parent.parent
tilt_schema_path = base_path / Path("tilt_schema")
tilt_schema_path.mkdir(exist_ok=True)

indent = 2

root_schema = None
with open(tilt_schema_path / Path("root_schema.json"), "r") as f:
root_schema = json.load(f)

properties = root_schema["properties"]

pattern = re.compile("[0-9]{2}_(\w+).json")
properties_path = tilt_schema_path / Path("properties")
for path in sorted(properties_path.glob("*.json")):
match = pattern.match(path.name)
key = match.group(1)
print(path.name)
if match:
with open(path, 'r') as f:
properties[key] = json.load(f)



with open(base_path / Path("tilt-schema.json"), "w") as f:
json.dump(root_schema, f, indent=indent)
23 changes: 23 additions & 0 deletions scripts/split.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import json
from pathlib import Path

base_path = Path( __file__ ).parent.parent
tilt_schema_path = base_path / Path("tilt_schema")
tilt_schema_path.mkdir(exist_ok=True)

indent = 2

with open(base_path / Path("tilt-schema.json"),'r') as f:
tilt_schema = json.load(f)

with open(tilt_schema_path / Path("root_schema.json"), "w") as f:
copy_tilt_schema = tilt_schema.copy()
copy_tilt_schema["properties"] = {}
json.dump(copy_tilt_schema, f, indent=indent)


for i, (key, value) in enumerate(tilt_schema["properties"].items()):
path = tilt_schema_path / Path(f"properties/{i:02d}_{key}.json")
path.parent.mkdir(exist_ok=True, parents=True)
with open(path, 'w') as f:
json.dump(value, f, indent=indent)
Loading