Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support default values on interface properties #1165

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

msujew
Copy link
Member

@msujew msujew commented Aug 23, 2023

Closes #1154
Closes #1206

Touches multiple parts of the framework to make this work:

  • Support default values on the TypeAttribute grammar element
  • Support setting default values in the parser (based on the existing mandatory-properties architecture)
  • Adds validation so that default values always match the types defined on the property

@msujew msujew added the ast AST structure related issue label Aug 23, 2023
@msujew msujew added this to the v2.1.0 milestone Sep 26, 2023
@msujew msujew requested a review from spoenemann September 26, 2023 13:35
@msujew msujew force-pushed the msujew/interface-default-values branch from da1257f to d0331e5 Compare September 26, 2023 13:57
packages/langium/src/parser/langium-parser.ts Outdated Show resolved Hide resolved
packages/langium/src/syntax-tree.ts Outdated Show resolved Hide resolved
@msujew msujew modified the milestones: v2.1.0, v3.0.0 Oct 24, 2023
@msujew msujew force-pushed the msujew/interface-default-values branch from d0331e5 to 1f59957 Compare December 7, 2023 10:18
@msujew msujew force-pushed the msujew/interface-default-values branch from 1f59957 to 7919d02 Compare December 7, 2023 10:18
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

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

👍 This is much cleaner than the previous approach, which was focused on properties with certain types.

@msujew msujew merged commit d5d7d12 into main Dec 11, 2023
5 checks passed
@msujew msujew deleted the msujew/interface-default-values branch December 11, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast AST structure related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

provide optional key with reflection Default values for declared properties
3 participants