-
Notifications
You must be signed in to change notification settings - Fork 32
Add id
attribute to products
list frontmatter
#1238
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the frontmatter structure for products by introducing an id attribute instead of a simple string value.
- Updated test cases in the YAML frontmatter tests to reflect the new mapping structure with an id key.
- Modified the YAML deserializer in Products.cs to read and validate the new id property.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/Elastic.Markdown.Tests/FrontMatter/YamlFrontMatterTests.cs | Updated YAML test data to include an id attribute instead of a plain string. |
src/Elastic.Markdown/Myst/FrontMatter/Products.cs | Updated YAML parsing logic to extract the id mapping for products. |
Depends on the outcome of elastic/docs-content#1336 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we support reading both strings
and the map
?
That way we can minimize the syntax until the need arrises to expand product with more properties.
I don't really see any use case now, do you have any in mind?
I also don't see an immediate reason for extending it. Generally, I made it a habit to use properties like that in YAML because it makes it so much easier to add properties in the future, without the need to modify existing logic. Which follows the Open/Closed principle. Also, I think it semantically makes it clearer for the user that you need to enter an ID in the list. Which removes some cognitive load. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool cool, I also came at it more from an authoring point of view where adding a list of keywords is easier then arrays of objects (bcuz yaml 😸)
061de89
to
32e9283
Compare
Add
id
attributeso instead of
use
This makes the model more flexible and gives us the ability to add properties in the future if requirements are added. Just in case.