You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RELEASE.md
+2-16Lines changed: 2 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,25 +55,11 @@ The generator partitions types into two categories:
55
55
56
56
Type aliases (`typeAlias`) are now resolved to their underlying Python types at generation time. Where multiple aliases would otherwise produce the same Python type name, unique disambiguating names are generated to avoid conflicts.
57
57
58
-
Note: `typeAlias`entries that carry a `condition`block have the condition silently discarded — see [RUNE_LANGUAGE_GAPS.md](docs/RUNE_LANGUAGE_GAPS.md) for details. This feature is not currently used in CDM.
58
+
Note: Basic type constraints on a `typeAlias`(pattern, min/max length, numeric ranges) are propagated to the generated Python field. However, named `condition`blocks on a `typeAlias` are silently discarded — see [RUNE_LANGUAGE_GAPS.md](docs/RUNE_LANGUAGE_GAPS.md) for details. In CDM, the only `typeAlias` carrying a named condition is `FpMLCodingScheme`, which is used exclusively for FpML codelist domain validation and delegates to the native function `ValidateFpMLCodingSchemeDomain`.
59
59
60
60
---
61
61
62
-
### 6. CLI Improvements
63
-
64
-
Three new flags added to the existing CLI. (Issue [#142](https://github.com/finos/rune-python-generator/issues/142))
65
-
66
-
| Option | Long form | Description |
67
-
| :--- | :--- | :--- |
68
-
|`-e`|`--allow-errors`| Continue generating even when validation errors are present |
69
-
|`-w`|`--fail-on-warnings`| Treat validation warnings as errors |
70
-
|`-n <name>`|`--project-name`| Override the `pyproject.toml` project name (e.g. `finos-cdm`) |
71
-
72
-
The `--allow-errors` flag is useful when generating from sources that contain unresolvable cross-namespace references. Models with errors are skipped; all valid models are still generated.
73
-
74
-
---
75
-
76
-
### 7. Refactored Object, Attribute, and Expression Generation
62
+
### 6. Refactored Object, Attribute, and Expression Generation
77
63
78
64
Internal generator refactoring to simplify code and support reuse:
Copy file name to clipboardExpand all lines: docs/PR.md
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,12 +26,7 @@ This PR delivers comprehensive function and expression generation support
26
26
27
27
5.**Completion of support for Type Aliases** — type aliases are resolved with flattened naming conventions and collision handling.
28
28
29
-
6.**CLI improvements**
30
-
-`--project-name` flag enables CDM builds with a custom package prefix (e.g. `finos-cdm`)
31
-
- Added flags to control the response to Rune parsing errors (`--allow-errors`) and warnings (`--fail-on-warnings`)
32
-
- Execution emits exit codes (`0`/`1`)
33
-
34
-
7.**Refactored object, attribute, and expression generation** — introduced `PythonExpressionScope` and companion blocks to simplify code and support reuse across the generator.
29
+
6.**Refactored object, attribute, and expression generation** — introduced `PythonExpressionScope` and companion blocks to simplify code and support reuse across the generator.
|**`typeAlias`** (basic) |**N**| ⚠️ | Extensive | Extensive | The alias is expanded to its underlying base type at generation time (e.g., `typeAlias ISIN: string` → field typed as `str`). The domain name is not preserved in the output. See [ARCHITECTURE.md](ARCHITECTURE.md#6-design-decision-typealias-generation) for the rationale and the planned Rune Path approach. |
46
-
|**`typeAlias`** (with `condition`) |**Y**|❌|Unknown | Unknown|When a `typeAlias` carries a `condition` block, the alias is stripped to its base type and the condition is silently discarded. No validation is generated. See Known Validation and Runtime Gaps below. |
46
+
|**`typeAlias`** (with `condition`) |**Y**|⚠️|1 (`FpMLCodingScheme`) | 0|Basic type constraints (pattern, min/max length, numeric ranges) on a `typeAlias`**are** propagated — the alias is stripped to its underlying base type and `processProperties` extracts those constraints. However, named `condition` blocks are silently discarded. In CDM, the only `typeAlias` with a named condition is `FpMLCodingScheme`, used exclusively for FpML codelist domain validation (calls native `ValidateFpMLCodingSchemeDomain`). See Known Validation and Runtime Gaps below. |
47
47
|**`extends`** (Functions) |**Y**| ❌ | 0 | 0 | Inherits shortcuts, logic, and structure from a base function. Defined in Rune grammar (`func ... extends ...`). Not currently used in CDM or DRR, but must be handled when encountered. |
48
48
|**`super`** (Calls) |**Y**| ❌ | 0 | 0 | Invokes logic from a parent function within the current scope (`RosettaSuperCall` in Rune grammar). Not currently used in CDM or DRR. |
49
49
@@ -84,20 +84,28 @@ The following section tracks implementation status and requirements for regulato
84
84
85
85
The following are known gaps in validation and runtime behaviour that require work in both the generator and the [rune-python-runtime](https://github.com/finos/rune-python-runtime).
86
86
87
-
### `typeAlias`Conditions on Basic Types
87
+
### `typeAlias`Named Condition Blocks
88
88
89
-
Rune allows conditions to be attached directly to basic type aliases:
89
+
Rune allows two kinds of constraints on a `typeAlias`:
90
+
91
+
1.**Basic type constraints** — pattern, min/max length, numeric ranges — declared on the underlying primitive (e.g., `RStringType`, `RNumberType`). These **are** supported: the generator strips the alias to its base type via `stripFromTypeAliases` and `processProperties` extracts the constraints into the generated Pydantic field.
92
+
93
+
2.**Named `condition` blocks** — explicit business-logic conditions attached to the alias body:
90
94
91
95
```rosetta
92
-
typeAlias Currency:
96
+
typeAlias FpMLCodingScheme(domain string):
93
97
string
94
-
condition C:
95
-
item count = 3
98
+
99
+
condition IsValidCodingScheme:
100
+
if item exists
101
+
then ValidateFpMLCodingSchemeDomain(item, domain)
96
102
```
97
103
98
-
The generator expands every `typeAlias` to its underlying base type at generation time (the Java Path — see [ARCHITECTURE.md](ARCHITECTURE.md#6-design-decision-typealias-generation)). Because the alias definition is discarded at the generation step, any `condition` block attached to it is never reached. A field typed as `Currency` is emitted as a plain `str` field with no validation.
104
+
Named condition blocks are silently discarded. The alias is stripped to its base type and no validation is generated for the condition.
105
+
106
+
**CDM usage**: The only `typeAlias` in CDM that carries a named condition is `FpMLCodingScheme`, a parameterized alias used exclusively for FpML codelist domain validation. All leaf aliases (`BusinessCenter`, `FloatingRateIndex`, etc.) are simple instantiations of `FpMLCodingScheme` with a specific domain string and do not carry their own conditions. The condition delegates to the native function `ValidateFpMLCodingSchemeDomain`, so addressing this gap is blocked on native function support as well as the broader Codelist / External Scheme Validation gap described below.
99
107
100
-
**Impact**: Any `typeAlias`that adds a condition to a primitive type silently skips that validation in generated Python. Addressing this requires either generating a constrained wrapper type (analogous to Pydantic's `Annotated[str, ...]` with a custom validator) or implementing the Rune Path so that the alias and its conditions are preserved in the output.
108
+
**Impact**: Any `typeAlias`with a named condition silently skips that validation in the generated Python. Addressing this requires either generating a constrained wrapper type (analogous to Pydantic's `Annotated[str, ...]` with a custom validator) or implementing the Rune Path so that the alias and its conditions are preserved in the output.
0 commit comments