Repository navigation
Conversation
| term = voc.getTerm(declarationName, propertyName, identifier); | ||
| } | ||
| if (term) { | ||
| if (term !== null && term !== undefined) { |
There was a problem hiding this comment.
| if (term !== null && term !== undefined) { | |
| if (!!term) { |
| term = voc.getElementTerms(declarationName, propertyName); | ||
| } | ||
| if (term) { | ||
| if (term !== null && term !== undefined) { |
There was a problem hiding this comment.
| if (term !== null && term !== undefined) { | |
| if (!!term) { |
| } | ||
| else { | ||
| const property = decl.properties ? decl.properties.find(d => d[propertyName]) : null; | ||
| const property = decl.properties ? decl.properties.find(d => propertyName in d) : null; |
There was a problem hiding this comment.
Why change this behaviour? This can have an adverse effect on other consumers of this.
…value handling in tests - Updated property existence checks in `getTerm` and `getElementTerms` methods to use `propertyName in d` for better accuracy. - Enhanced falsy value handling in `VocabularyManager` and added comprehensive tests for various scenarios including empty strings, null values, and non-existent properties. - Added new test cases to ensure correct behavior for properties with falsy values in both `getTerm` and `getTerms` methods. Signed-off-by: mon7792 <monish7792@gmail.com>
51d7acc to
197ad83
Compare
|
This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
|
This PR is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed. |
|
Thanks for the work on the vocabulary property checks and the falsy-value handling. This draft has been open since April with no activity since, and it has picked up a rebase-sized diff against main. Could you either mark it ready for review with the changes brought up to date, or let us know if you are no longer working on it? If we hear nothing, a maintainer may close it to keep the queue accurate. It can always be reopened or reworked later. |
Closes #1183
Fix vocabulary term lookup failing when term value is falsy (empty string,
0,false,null)Changes
propertyName in dinstead ofd[propertyName]invocabulary.jsto correctly detect property existence regardless of valueterm !== null && term !== undefinedinstead ofif (term)invocabularymanager.jsto avoid skipping valid falsy termsvocabulary.jsandvocabularymanager.jstest suites covering falsy vocabulary term valuesFlags
if (term)pattern inVocabularyManagercaused fallback to a parent/default vocabulary even when the term was explicitly set to an empty string or other falsy value — this is asilent correctness bug, not a crash
Screenshots or Video
N/A
Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:branchnameTwo things you need to fill in manually:
To check if your commit has a sign-off:
git log -1 --format="%B"
If it's missing Signed-off-by:, let me know and I'll help you add it.