Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
29 changes: 28 additions & 1 deletion .github/workflows/generate-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,37 @@ on:
push:
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
outputs:
skip_job: ${{ steps.skip.outputs.skip_job }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check last commit message
id: commit-message
run: |
echo "COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')" >> "$GITHUB_ENV"
echo "skip_job=false" >> "$GITHUB_OUTPUT"
- id: skip
name: Skip if automated push
if: contains(env.COMMIT_MESSAGE, 'Apply automatic changes')
run: |
echo "Automated commit detected - skipping job"
echo "skip_job=true" >> "$GITHUB_OUTPUT"

generate:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.skip_job != 'true'
steps:
- uses: actions/checkout@v4
- name: debug
run: echo ${{ needs.check.outputs.skip_job }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
- name: Build and run the Docker image
Expand Down
23 changes: 18 additions & 5 deletions Scripts/buildDocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,61 @@ mkdir -p ./build/results
echo
echo
echo "Spell Check Run"
echo "Spell checking BrAPI-Core"
echo "BrAPI-Core" >> ./build/results/spellingResults.txt
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Core/" >> ./build/results/spellingResults.txt
echo "Spell checking BrAPI-Germplasm"
echo "BrAPI-Germplasm" >> ./build/results/spellingResults.txt
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Germplasm/" >> ./build/results/spellingResults.txt
echo "Spell checking BrAPI-Phenotyping"
echo "BrAPI-Phenotyping" >> ./build/results/spellingResults.txt
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Phenotyping/" >> ./build/results/spellingResults.txt
echo "Spell checking BrAPI-Genotyping"
echo "BrAPI-Genotyping" >> ./build/results/spellingResults.txt
python3 ./Scripts/checkSpelling.py "./Specification/BrAPI-Genotyping/" >> ./build/results/spellingResults.txt
echo "Spell checking Components"
echo "Components" >> ./build/results/spellingResults.txt
python3 ./Scripts/checkSpelling.py "./Specification/Components/" >> ./build/results/spellingResults.txt


echo
echo
echo "Build OpenAPI YAML files per domain: ./brapi_openapi.yaml"
echo "Building BrAPI-Core"
echo "Building BrAPI-Core"
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Core/" "./Specification/Components/" "./Specification/BrAPI-Germplasm/" >> ./build/results/buildOpenAPIBrAPI-CoreResults.txt
echo "Building BrAPI-Germplasm"
echo "Building BrAPI-Germplasm"
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Germplasm/" "./Specification/Components/" >> ./build/results/buildOpenAPIBrAPI-GermplasmResults.txt
echo "Building BrAPI-Phenotyping"
echo "Building BrAPI-Phenotyping"
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Phenotyping/" "./Specification/Components/" >> ./build/results/buildOpenAPIBrAPI-PhenotypingResults.txt
echo "Building BrAPI-Genotyping"
echo "Building BrAPI-Genotyping"
python3 ./Scripts/buildOpenAPI.py "./Specification/BrAPI-Genotyping/" "./Specification/Components/" "./Specification/BrAPI-Germplasm/" >> ./build/results/buildOpenAPIBrAPI-GenotypingResults.txt

echo
echo
echo "Build README files for Bitbucket"
echo "Build README files"
echo "Building BrAPI-Core README files"
echo "BrAPI-Core" >> ./build/results/buildREADMEBrAPI-CoreResults.txt
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Core/" >> ./build/results/buildREADMEBrAPI-CoreResults.txt
echo "Building BrAPI-Germplasm README files"
echo "BrAPI-Germplasm" >> ./build/results/buildREADMEBrAPI-GermplasmResults.txt
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Germplasm/" >> ./build/results/buildREADMEBrAPI-GermplasmResults.txt
echo "Building BrAPI-Phenotyping README files"
echo "BrAPI-Phenotyping" >> ./build/results/buildREADMEBrAPI-PhenotypingResults.txt
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Phenotyping/" >> ./build/results/buildREADMEBrAPI-PhenotypingResults.txt
echo "Building BrAPI-Genotyping README files"
echo "BrAPI-Genotyping" >> ./build/results/buildREADMEBrAPI-GenotypingResults.txt
python3 ./Scripts/buildReadMes.py "./Specification/BrAPI-Genotyping/" >> ./build/results/buildREADMEBrAPI-GenotypingResults.txt

echo
echo
echo "Build BluePrint MD file: ./brapi_blueprint.apib ./brapi_blueprint.apib.json"
echo "Build BluePrint MD for BrAPI-Core"
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Core/" -header "./Specification/BrAPI-Core/swaggerMetaData.yaml" -source "./Specification/BrAPI-Core/" >> ./build/results/buildBlueprintResults.txt
echo "Build BluePrint MD for BrAPI-Germplasm"
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Germplasm/" -header "./Specification/BrAPI-Germplasm/swaggerMetaData.yaml" -source "./Specification/BrAPI-Germplasm/" >> ./build/results/buildBlueprintResults.txt
echo "Build BluePrint MD for BrAPI-Phenotyping"
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Phenotyping/" -header "./Specification/BrAPI-Phenotyping/swaggerMetaData.yaml" -source "./Specification/BrAPI-Phenotyping/" >> ./build/results/buildBlueprintResults.txt
echo "Build BluePrint MD for BrAPI-Genotyping"
python3 ./Scripts/buildBlueprint.py -out "./Specification/BrAPI-Genotyping/" -header "./Specification/BrAPI-Genotyping/swaggerMetaData.yaml" -source "./Specification/BrAPI-Genotyping/" >> ./build/results/buildBlueprintResults.txt

echo
Expand Down
9 changes: 6 additions & 3 deletions Scripts/dereferenceAll.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ def dereferenceAll(obj, parent):
refObj = dereferenceAll(findRef(obj[fieldStr], parent), parent)
#refObj['title'] = refPath[-1]
obj = {**obj, **refObj}

elif(fieldStr == 'allOf'):
comboObj = {'properties': {}, 'type': 'object', 'required': []}
for item in obj[fieldStr]:
itemObj = dereferenceAll(item, parent)
comboObj['properties'] = {**(comboObj['properties']), **(itemObj['properties'])}
if 'properties' in itemObj:
comboObj['properties'] = {**(comboObj['properties']), **(itemObj['properties'])}
if 'required' in itemObj:
comboObj['required'] = list(set(comboObj['required'] + itemObj['required']))
if 'title' in itemObj:
Expand All @@ -41,9 +43,10 @@ def dereferenceAll(obj, parent):
comboObj['example'] = itemObj['example']
if 'x-brapi-metadata' in itemObj:
comboObj['x-brapi-metadata'] = itemObj['x-brapi-metadata']

if 'nullable' in itemObj:
comboObj['nullable'] = itemObj['nullable']
obj = comboObj
else:
elif(fieldStr != 'nullable'):
obj[fieldStr] = dereferenceAll(obj[fieldStr], parent)
if '$ref' in obj:
obj.pop('$ref')
Expand Down
Loading