Commit 46921b7
authored
Maintain field order when rendering class in Python (#1931)
Fix #1477
Converting Python objects to Rust objects in the FFI code used a
`HashMap` which messes up ordering when rendering the Rust objects in
the prompt.
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Replaces `HashMap` with `IndexMap` to maintain field order in FFI
conversions and adds a test to verify this behavior.
>
> - **Behavior**:
> - Replaces `HashMap` with `IndexMap` in `parse_py_type.rs` to maintain
field order when converting Python objects to Rust objects.
> - Adds a new test `test_maintain_field_order` in
`prompt_renderer.test.ts` to verify field order is preserved.
> - **Code Removal**:
> - Removes `IntoIterator` implementation for `MinijinjaBamlClass` in
`baml_value_to_jinja_value.rs`.
> - **Misc**:
> - Adds `MaintainFieldOrder` class to `type_builder.ts` to support new
functionality.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for 33923ee. You can
[customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->1 parent 6a38672 commit 46921b7
58 files changed
Lines changed: 1566 additions & 46 deletions
File tree
- engine
- baml-lib/jinja-runtime/src
- language_client_python/src
- integ-tests
- baml_src/test-files/prompt
- go/baml_client
- stream_types
- types
- openapi/baml_client
- python
- baml_client
- tests
- react/baml_client
- react
- ruby/baml_client
- typescript-esm/baml_client
- typescript
- baml_client
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
199 | 198 | | |
200 | 199 | | |
201 | 200 | | |
202 | | - | |
| 201 | + | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
| |||
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | 210 | | |
224 | 211 | | |
225 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | | - | |
| 55 | + | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
249 | | - | |
250 | | - | |
| 250 | + | |
| 251 | + | |
251 | 252 | | |
252 | 253 | | |
253 | | - | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments