-
Notifications
You must be signed in to change notification settings - Fork 32
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
[LiquidDoc] Parser support for optional parameters #733
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
04f5d07
to
9b8824b
Compare
c0e6ed0
to
720b222
Compare
6414426
to
9560ce1
Compare
720b222
to
31d1bd9
Compare
9560ce1
to
6f1ddbb
Compare
9560ce1
to
f28e72d
Compare
31d1bd9
to
a62068b
Compare
a62068b
to
5426ddb
Compare
5426ddb
to
dcb46c0
Compare
e91db5d
to
374d89f
Compare
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.
Did not get a 🎩 in yet but since this is just parser changes maybe the tests are all we need here!
Closing in favour of #753 |
ada22c8
to
26abb91
Compare
26abb91
to
c1106c6
Compare
a963b38
to
c67d319
Compare
c67d319
to
2e69f9d
Compare
paramDescription: ConcreteTextNode | null; | ||
paramType: ConcreteTextNode | null; | ||
} | ||
|
||
export interface ConcreteLiquidDocParamNameNode |
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.
It may look kind of weird to have required
live in this node, however this is consistent with how the parsing logic works, and allows us to use the mappings
in stage-1
.
We do this because it aligns with the parsing grammar, and allows us to leverage the Mappings
mechanism. We map this to a more sensible location in stage-2
here (node.paramName.required -> node.required
)
---- - Added a parameter `required` to the LiquidDocParamNode - Parameters with `[]` around the name will return `required: true` - Parameters with incomplete delimiters `e.g. ([missingTail)` will map to a `TextNode`
2e69f9d
to
8c9f5bc
Compare
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.
Looks great! Can't wait for prettier PR!
What are you adding in this PR?
Part of https://github.com/Shopify/develop-advanced-edits/issues/525
Adds
LiquidDoc
parsing support to allow users to define optional parameters.Optional Parameters - @param [optional_param]
[]
around the namee.g. ([missingTail)
will map to aTextNode
Adds parser support for
[
and]
delimiters around thestringName
, which indicate that a param is optionalWithin the code, I'm storing this as 'required' rather than 'optional'. The default will be
required: true
@param [paramName]
What's next? Any followup issues?
[]
#735@param
delimiters[]
#734Before you deploy
changeset