Convert yaml.ts to handle multiple models per method#2904
Merged
Conversation
This changes YAML parsing/creating functions for the model editor to handle multiple models per method. The changes in the actual YAML handling are fairly small because the format itself already supports multiple models per method. I've introduced a few helper functions to convert between the old and new types. This should only be necessary while we're in the middle of the transition to the new types and can be removed later. For now, we'll just take the first model in the array when converting from the new to the old type. This is a change in the behavior since currently we always take the last model in the array but this behavior is undocumented and unsupported, so it should be fine to change it.
robertbrignull
approved these changes
Oct 4, 2023
Contributor
There was a problem hiding this comment.
LGTM
So the behaviour when creating YAML files is now that all modelings for a method are treated as a unit. So if a method already has modelings [A, B] but then we try to write the new modeling [C], it'll remove A and B and just write C, instead of writing [A, B, C]. I think that's correct and the tests do cover this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes YAML parsing/creating functions for the model editor to handle multiple models per method. The changes in the actual YAML handling are fairly small because the format itself already supports multiple models per method.
I've introduced a few helper functions to convert between the old and new types. This should only be necessary while we're in the middle of the transition to the new types and can be removed later. For now, we'll just take the first model in the array when converting from the new to the old type. This is a change in the behavior since currently we always take the last model in the array but this behavior is undocumented and unsupported, so it should be fine to change it.
Checklist
ready-for-doc-reviewlabel there.