Skip to content

Commit 3c1bac4

Browse files
guydavenportGuy DavenportGuy Davenport
authored
649 merge generator changes into v2 2 fix the misplacement of a nullable tag and remove the out directory (#650)
* update CI * deleted out directory * fixed nullable * removed nullable for refs * removed nullable in wrong place * fixed indentation * improved logging * take into account nullable * take into account array in ref * correct as per https://stackoverflow.com/questions/40920441/how-to-specify-a-property-can-be-null-or-a-reference-with-swagger * Apply automatic changes * fixed ObservationTreatment link * Apply automatic changes --------- Co-authored-by: Guy Davenport <guy.davenport@partners.basf.com> Co-authored-by: Guy Davenport <daveneti@gmail.com> Co-authored-by: guydavenport <6523224+guydavenport@users.noreply.github.com>
1 parent 0cd758e commit 3c1bac4

File tree

74 files changed

+51187
-39147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+51187
-39147
lines changed

.github/workflows/generate-schema.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,37 @@ on:
44
push:
55
workflow_dispatch:
66
jobs:
7+
check:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
skip_job: ${{ steps.skip.outputs.skip_job }}
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
- name: Check last commit message
15+
id: commit-message
16+
run: |
17+
echo "COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')" >> "$GITHUB_ENV"
18+
echo "skip_job=false" >> "$GITHUB_OUTPUT"
19+
- id: skip
20+
name: Skip if automated push
21+
if: contains(env.COMMIT_MESSAGE, 'Apply automatic changes')
22+
run: |
23+
echo "Automated commit detected - skipping job"
24+
echo "skip_job=true" >> "$GITHUB_OUTPUT"
25+
726
generate:
827
runs-on: ubuntu-latest
28+
needs: check
29+
if: needs.check.outputs.skip_job != 'true'
930
steps:
10-
- uses: actions/checkout@v4
31+
- name: debug
32+
run: echo ${{ needs.check.outputs.skip_job }}
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
ssh-key: ${{ secrets.DEPLOY_KEY }}
1138
- name: Set up Docker Compose
1239
uses: docker/setup-compose-action@v1
1340
- name: Build and run the Docker image

Scripts/buildDocs.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,61 @@ mkdir -p ./build/results
1111
echo
1212
echo
1313
echo "Spell Check Run"
14+
echo "Spell checking BrAPI-Core"
1415
echo "BrAPI-Core" >> ./build/results/spellingResults.txt
1516
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Core/" >> ./build/results/spellingResults.txt
17+
echo "Spell checking BrAPI-Germplasm"
1618
echo "BrAPI-Germplasm" >> ./build/results/spellingResults.txt
1719
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Germplasm/" >> ./build/results/spellingResults.txt
20+
echo "Spell checking BrAPI-Phenotyping"
1821
echo "BrAPI-Phenotyping" >> ./build/results/spellingResults.txt
1922
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Phenotyping/" >> ./build/results/spellingResults.txt
23+
echo "Spell checking BrAPI-Genotyping"
2024
echo "BrAPI-Genotyping" >> ./build/results/spellingResults.txt
2125
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Genotyping/" >> ./build/results/spellingResults.txt
26+
echo "Spell checking Components"
2227
echo "Components" >> ./build/results/spellingResults.txt
2328
python3 ./Scripts/checkSpelling.py "./Specification/Components/" >> ./build/results/spellingResults.txt
2429

2530

2631
echo
2732
echo
2833
echo "Build OpenAPI YAML files per domain: ./brapi_openapi.yaml"
29-
echo "Building BrAPI-Core"
34+
echo "Building BrAPI-Core"
3035
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Core/" "./Specification/Components/" "./Specification/BrAPI-Germplasm/" >> ./build/results/buildOpenAPIBrAPI-CoreResults.txt
31-
echo "Building BrAPI-Germplasm"
36+
echo "Building BrAPI-Germplasm"
3237
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Germplasm/" "./Specification/Components/" >> ./build/results/buildOpenAPIBrAPI-GermplasmResults.txt
33-
echo "Building BrAPI-Phenotyping"
38+
echo "Building BrAPI-Phenotyping"
3439
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Phenotyping/" "./Specification/Components/" >> ./build/results/buildOpenAPIBrAPI-PhenotypingResults.txt
35-
echo "Building BrAPI-Genotyping"
40+
echo "Building BrAPI-Genotyping"
3641
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Genotyping/" "./Specification/Components/" "./Specification/BrAPI-Germplasm/" >> ./build/results/buildOpenAPIBrAPI-GenotypingResults.txt
3742

3843
echo
3944
echo
40-
echo "Build README files for Bitbucket"
45+
echo "Build README files"
46+
echo "Building BrAPI-Core README files"
4147
echo "BrAPI-Core" >> ./build/results/buildREADMEBrAPI-CoreResults.txt
4248
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Core/" >> ./build/results/buildREADMEBrAPI-CoreResults.txt
49+
echo "Building BrAPI-Germplasm README files"
4350
echo "BrAPI-Germplasm" >> ./build/results/buildREADMEBrAPI-GermplasmResults.txt
4451
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Germplasm/" >> ./build/results/buildREADMEBrAPI-GermplasmResults.txt
52+
echo "Building BrAPI-Phenotyping README files"
4553
echo "BrAPI-Phenotyping" >> ./build/results/buildREADMEBrAPI-PhenotypingResults.txt
4654
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Phenotyping/" >> ./build/results/buildREADMEBrAPI-PhenotypingResults.txt
55+
echo "Building BrAPI-Genotyping README files"
4756
echo "BrAPI-Genotyping" >> ./build/results/buildREADMEBrAPI-GenotypingResults.txt
4857
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Genotyping/" >> ./build/results/buildREADMEBrAPI-GenotypingResults.txt
4958

5059
echo
5160
echo
5261
echo "Build BluePrint MD file: ./brapi_blueprint.apib ./brapi_blueprint.apib.json"
62+
echo "Build BluePrint MD for BrAPI-Core"
5363
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Core/" -header "./Specification/BrAPI-Core/swaggerMetaData.yaml" -source "./Specification/BrAPI-Core/" >> ./build/results/buildBlueprintResults.txt
64+
echo "Build BluePrint MD for BrAPI-Germplasm"
5465
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Germplasm/" -header "./Specification/BrAPI-Germplasm/swaggerMetaData.yaml" -source "./Specification/BrAPI-Germplasm/" >> ./build/results/buildBlueprintResults.txt
66+
echo "Build BluePrint MD for BrAPI-Phenotyping"
5567
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Phenotyping/" -header "./Specification/BrAPI-Phenotyping/swaggerMetaData.yaml" -source "./Specification/BrAPI-Phenotyping/" >> ./build/results/buildBlueprintResults.txt
68+
echo "Build BluePrint MD for BrAPI-Genotyping"
5669
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Genotyping/" -header "./Specification/BrAPI-Genotyping/swaggerMetaData.yaml" -source "./Specification/BrAPI-Genotyping/" >> ./build/results/buildBlueprintResults.txt
5770

5871
echo

Scripts/dereferenceAll.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ def dereferenceAll(obj, parent):
2626
refObj = dereferenceAll(findRef(obj[fieldStr], parent), parent)
2727
#refObj['title'] = refPath[-1]
2828
obj = {**obj, **refObj}
29+
2930
elif(fieldStr == 'allOf'):
3031
comboObj = {'properties': {}, 'type': 'object', 'required': []}
3132
for item in obj[fieldStr]:
3233
itemObj = dereferenceAll(item, parent)
33-
comboObj['properties'] = {**(comboObj['properties']), **(itemObj['properties'])}
34+
if 'properties' in itemObj:
35+
comboObj['properties'] = {**(comboObj['properties']), **(itemObj['properties'])}
3436
if 'required' in itemObj:
3537
comboObj['required'] = list(set(comboObj['required'] + itemObj['required']))
3638
if 'title' in itemObj:
@@ -41,9 +43,10 @@ def dereferenceAll(obj, parent):
4143
comboObj['example'] = itemObj['example']
4244
if 'x-brapi-metadata' in itemObj:
4345
comboObj['x-brapi-metadata'] = itemObj['x-brapi-metadata']
44-
46+
if 'nullable' in itemObj:
47+
comboObj['nullable'] = itemObj['nullable']
4548
obj = comboObj
46-
else:
49+
elif(fieldStr != 'nullable'):
4750
obj[fieldStr] = dereferenceAll(obj[fieldStr], parent)
4851
if '$ref' in obj:
4952
obj.pop('$ref')

0 commit comments

Comments
 (0)