feat: allow configurable default value for boolean template variables (#84) - #145
feat: allow configurable default value for boolean template variables (#84)#145Aaravanand00 wants to merge 3 commits into
Conversation
|
Hi @nishantwrp, I’ve refactored the implementation so that the In short:
All existing tests pass, and the new tests around boolean defaults are still green. Please let me know if you’d like any further adjustments I'm happy to work on it. |
nishantwrp
left a comment
There was a problem hiding this comment.
thanks, took a pass.
also a meta point, ptal at guidelines for ai-assisted contributions if applicable
| import { encode } from "html-entities"; | ||
|
|
||
| export class InvalidDefinitionError extends Error {} | ||
| export class InvalidDefinitionError extends Error { } |
There was a problem hiding this comment.
can you please remove these linting changes. makes it harder to review.
There was a problem hiding this comment.
make default part of the constructor
There was a problem hiding this comment.
maybe name it "rawDefault" so that each type can validate it internally
6ac7a68 to
6a5b68d
Compare
|
Hi @nishantwrp, I’ve addressed the requested changes:
I also updated the PR description to align with the AI-assisted contribution guidelines, including the required disclosure section. All tests are passing locally. One quick question — does Joplin have regular community meetings or an org Discord/Slack channel for contributors? If there’s a link available, I’d really appreciate it. I’d like to stay more involved and follow discussions more closely. |
|
@Aaravanand00 you can go through https://github.com/joplin/gsoc/?tab=readme-ov-file#google-summer-of-code-2025 for the communication channels to join |
…lt typing - Update CustomVariable constructor to accept rawDefault (string | boolean | null) - Extract and validate default value inside BooleanCustomVariable - Throw InvalidDefinitionError for invalid boolean defaults - Preserve backward compatibility by defaulting rawDefault to null - Ensure all existing tests pass without modifying other variable types
6a5b68d to
7563ff1
Compare
|
Hi @nishantwr Thanks for the detailed feedback — I’ve addressed all the suggested changes. changes:
|
nishantwrp
left a comment
There was a problem hiding this comment.
thanks, i think we're very close. added a few comments.
also, can you please update the documentation.
| import { encode } from "html-entities"; | ||
|
|
||
| export class InvalidDefinitionError extends Error {} | ||
| export class InvalidDefinitionError extends Error { } |
|
I've addressed the requested changes:
All tests are passing locally (41 tests). |
AI Assistance Disclosure
AI was used to explore refactoring approaches and validate edge cases around boolean default handling. The final implementation was manually reviewed, simplified, and adjusted based on maintainer feedback. I have verified the behavior through the test suite and fully understand the changes introduced.
Summary
Adds support for specifying a configurable default value for boolean template variables.
Example:
enable_feature:
type: boolean
default: no
The default value is interpreted case-insensitively.
If no default is provided, existing behavior is preserved.
Invalid values fall back to true, matching previous behavior.