Fix 500 on WoT delete of undefined features - #2545
Open
sankalpsthakur wants to merge 1 commit into
Open
Conversation
validateFeatureScopedDeletion assumed the feature existed in the Thing model. Deleting an extra feature then ran required-property checks on an empty path and threw NoSuchElementException (HTTP 500). Skip validation when the feature is not in the model so those deletes succeed. Fixes eclipse-ditto#2146 Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With strict WoT validation enabled, deleting a feature that is not in the Thing model threw
NoSuchElementExceptioninvalidateFeatureScopedDeletion()and returned HTTP 500.The method now returns success when the feature is not defined in the model, so extra-feature deletes succeed instead of failing as an ISE.
PATCH of extra features to null still 400 under
forbidNonModeledFeatures(strict WoT). That half of #2146 is not in this PR.Validation
validateFeatureDeletionSucceedsForUndefinedFeaturecompleted exceptionally withNoSuchElementExceptionbefore the guard.mvn -pl wot/validation -am test -Dtest=WotThingModelValidationFeatureLevelTest— 76 tests, 0 failures (Java 25)Related to #2146
AI/LLM disclosure