Skip to content

Commit d4f8142

Browse files
committed
Enhance JSON structure in multiflexi applications: Update 'produces' field to include description and format for invoices and orders
1 parent f60ffed commit d4f8142

4 files changed

Lines changed: 74 additions & 2 deletions

File tree

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ When create new class or update existing class, always create or update its phpu
4545

4646
All files in the multiflexi/*.app.json directory must conform to the schema available at: https://raw.githubusercontent.com/VitexSoftware/php-vitexsoftware-multiflexi-core/refs/heads/main/multiflexi.app.schema.json
4747

48+
When modifying or creating multiflexi/*.app.json files, always validate them against the schema before making changes. Use tools to check JSON schema compliance.
49+
4850
All produced reports must conform to the schema available at: https://raw.githubusercontent.com/VitexSoftware/php-vitexsoftware-multiflexi-core/refs/heads/main/multiflexi.report.schema.json
4951

52+
When modifying JSON files or creating new multiflexi applications, always verify the JSON syntax and schema compliance as part of the development process.
53+
5054
When writing code that interacts with the IPEX API, always refer to the official documentation at https://restapi.ipex.cz/swagger.json for guidance on endpoints, parameters, and best practices.
5155

5256

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: MultiFlexi JSON Validation
2+
3+
on:
4+
push:
5+
paths:
6+
- 'multiflexi/*.json'
7+
pull_request:
8+
paths:
9+
- 'multiflexi/*.json'
10+
11+
jobs:
12+
validate-multiflexi-json:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install jsonschema
25+
run: pip install jsonschema requests
26+
27+
- name: Validate JSON syntax
28+
run: |
29+
for file in multiflexi/*.json; do
30+
if [ -f "$file" ]; then
31+
echo "Validating syntax: $file"
32+
python3 -m json.tool "$file" > /dev/null
33+
fi
34+
done
35+
36+
- name: Validate against MultiFlexi schema
37+
run: |
38+
python3 << 'EOF'
39+
import json
40+
import requests
41+
import jsonschema
42+
import os
43+
import glob
44+
45+
# Download the schema
46+
schema_url = "https://raw.githubusercontent.com/VitexSoftware/php-vitexsoftware-multiflexi-core/refs/heads/main/multiflexi.app.schema.json"
47+
response = requests.get(schema_url)
48+
schema = response.json()
49+
50+
# Validate all JSON files
51+
for file_path in glob.glob("multiflexi/*.json"):
52+
print(f"Validating schema: {file_path}")
53+
with open(file_path, 'r') as f:
54+
data = json.load(f)
55+
56+
try:
57+
jsonschema.validate(data, schema)
58+
print(f"✅ {file_path} is valid")
59+
except jsonschema.ValidationError as e:
60+
print(f"❌ {file_path} validation failed: {e.message}")
61+
exit(1)
62+
EOF

multiflexi/abraflexi-ipex-postpaid-invoices.multiflexi.app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"topics": ["AbraFlexi", "Ipex", "Invoice"],
1212
"uuid": "262dabf1-d7b1-42c8-91a1-fe991631547c",
1313
"produces": {
14-
"invoices": "AbraFlexi invoices created from orders"
14+
"invoices": {
15+
"description": "AbraFlexi invoices created from orders",
16+
"format": "json"
17+
}
1518
},
1619
"environment": {
1720
"APP_DEBUG": {

multiflexi/abraflexi-ipex-postpaid-orders.multiflexi.app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"topics": ["AbraFlexi", "Ipex", "Invoice"],
1212
"uuid": "51b247aa-fd48-44d7-8494-8c86b05e5a66",
1313
"produces": {
14-
"orders": "AbraFlexi orders created from IPEX calls"
14+
"orders": {
15+
"description": "AbraFlexi orders created from IPEX calls",
16+
"format": "json"
17+
}
1518
},
1619
"environment": {
1720
"APP_DEBUG": {

0 commit comments

Comments
 (0)