Skip to content

Switch ModeledMethod to union of types#3031

Merged
koesie10 merged 7 commits intomainfrom
koesie10/modeled-method-union
Nov 2, 2023
Merged

Switch ModeledMethod to union of types#3031
koesie10 merged 7 commits intomainfrom
koesie10/modeled-method-union

Conversation

@koesie10
Copy link
Copy Markdown
Member

This switches the ModeledMethod type from 1 type containing all fields to a union of multiple types where each type accurately represents which fields are present for a specific model. This allows more disjointed models to be represented more accurately, such as type models. For type models, having input, output, etc. doesn't make sense. It instead has fields like type1, type2 and path. I don't think adding these properties to every modeled method makes sense, so this is a solution which allows us to represent both models.

This is a very large changeset, but I don't think splitting it up would be helpful (I don't really see how). A lot of the changes are changes to method names or removing unnecessary properties.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This allows more disjointed models to be represented more accurately,
such as type models.
@koesie10 koesie10 marked this pull request as ready for review October 30, 2023 13:59
@koesie10 koesie10 requested review from a team as code owners October 30, 2023 13:59
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks really good! I like splitting the ModeledMethod type up so that each sub-type only contains the fields it needs.

I have a few small comments asking for clarification or small improvements, but the overall idea and changes look great.

Comment thread extensions/ql-vscode/src/model-editor/languages/languages.ts Outdated
Comment thread extensions/ql-vscode/src/model-editor/yaml.ts
Comment thread extensions/ql-vscode/src/view/model-editor/MethodRow.tsx Outdated
Comment thread extensions/ql-vscode/src/view/model-editor/MethodRow.tsx Outdated
Comment thread extensions/ql-vscode/src/view/model-editor/ModelKindDropdown.tsx Outdated
Comment thread extensions/ql-vscode/src/model-editor/modeled-method.ts Outdated
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

(Has some conflicts in imports, but they didn't seem hard to fix)

@koesie10 koesie10 enabled auto-merge November 2, 2023 08:31
@koesie10 koesie10 merged commit eaf3a1c into main Nov 2, 2023
@koesie10 koesie10 deleted the koesie10/modeled-method-union branch November 2, 2023 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants