Skip to content

Commit 1d37ad6

Browse files
committed
fix(ci): preserve manual py contracts init, track generated client schemas
1 parent f43e639 commit 1d37ad6

5 files changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* eslint-disable */
2+
/**
3+
* This file was automatically generated by json-schema-to-typescript.
4+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5+
* and run json-schema-to-typescript to regenerate this file.
6+
*/
7+
8+
export interface QuanuXError {
9+
code: string;
10+
message: string;
11+
correlation_id: string;
12+
details?: {
13+
[k: string]: unknown;
14+
} | null;
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* eslint-disable */
2+
/**
3+
* This file was automatically generated by json-schema-to-typescript.
4+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5+
* and run json-schema-to-typescript to regenerate this file.
6+
*/
7+
8+
export interface EventEnvelope {
9+
event_type: string;
10+
sequence: number;
11+
correlation_id: string;
12+
source: string;
13+
timestamp: string;
14+
payload: {
15+
[k: string]: unknown;
16+
};
17+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* eslint-disable */
2+
/**
3+
* This file was automatically generated by json-schema-to-typescript.
4+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5+
* and run json-schema-to-typescript to regenerate this file.
6+
*/
7+
8+
export interface OrderRequest {
9+
symbol: string;
10+
exchange?: string | null;
11+
side: 'BUY' | 'SELL';
12+
type: 'MARKET' | 'LIMIT' | 'STOP' | 'STOP_LIMIT';
13+
price?: number | null;
14+
stop_price?: number | null;
15+
time_in_force: 'DAY' | 'GTC' | 'IOC' | 'FOK';
16+
quantity: number;
17+
client_order_id: string;
18+
/**
19+
* vendor-specific flags (adapter-local)
20+
*/
21+
flags?: {
22+
[k: string]: unknown;
23+
};
24+
idempotency_key?: string;
25+
timestamp?: string;
26+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-disable */
2+
/**
3+
* This file was automatically generated by json-schema-to-typescript.
4+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5+
* and run json-schema-to-typescript to regenerate this file.
6+
*/
7+
8+
export interface InstrumentPrecision {
9+
symbol: string;
10+
price_tick: number;
11+
quantity_step: number;
12+
multiplier?: number | null;
13+
decimals?: number | null;
14+
}

tools/generate_models.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ def generate_python_models():
4646
# Output: server/app/domain/contracts
4747
# We want to treat the directory recursively.
4848

49+
# Preserve __init__.py if it exists (manual exports)
50+
init_file = SERVER_OUT_DIR / "__init__.py"
51+
init_content = None
52+
if init_file.exists():
53+
print(f"ℹ️ Preserving manual {init_file.name}...")
54+
init_content = init_file.read_text()
55+
4956
cmd = [
5057
sys.executable, "-m", "datamodel_code_generator",
5158
"--input", str(SCHEMAS_DIR),
@@ -62,6 +69,12 @@ def generate_python_models():
6269
# Let's try directory mode first.
6370

6471
result = subprocess.run(cmd, capture_output=True, text=True)
72+
73+
# Restore __init__.py
74+
if init_content:
75+
init_file.write_text(init_content)
76+
print(f"✅ Restored manual {init_file.name}")
77+
6578
if result.returncode == 0:
6679
print(f"✅ Python models generated at: {SERVER_OUT_DIR / 'models.py'}")
6780
else:

0 commit comments

Comments
 (0)