-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
884: Strict Mode for JSONObject #903
884: Strict Mode for JSONObject #903
Conversation
Currently in unit-test phase. If you wish to help me by providing test cases, I would appreciate it. Ideally, examples where strictMode should fail but doesn't, or vice-versa (shouldn't fail but fails). I will continue to add different test-cases and submit this PR for review on the 11th of August so it can be reviewed next week. Currently TestingStrict Mode: TRUE
Additionally this would be a good time to give a superficial review, just to help me understand if I'm going in the right direction. Thank you, cc @stleary |
@rikkarth Sure, here is some feedback to help you get started.
Let's not worry about unit tests until we have an acceptable working implementation.
You may find that after implementing the above, there are still regressions and/or outstanding issues. If so, let's address them one at a time until everything is resolved. |
@rikkarth Hope all is going well. We need to make some progress on resolving the remaining issues. If you are stuck, please reach out, post your questions, and I will help. Or if you just need a few more days, let me know. |
Basically I have a working version with smallCharMemory. Removing it is the final piece, but I haven't been able to create an alternative solution (yet) for what smallCharMemory solves. I will take another look at it, and come back with more feedback - today. |
I would ask someone that can help me to run the current unit tests with this implementation and see if there is a use case not covered. If all is good, I or someone that can support me on this task can help me remove the smallCharMemory part and adjust the implementation. Unfortunately I haven't had the time to complete this part as every time I tried to solve this I got stuck on trying to come up with a new implementation. |
Can you commit your latest code to this PR? I can take a look. |
private Object getValidNumberBooleanOrNullFromObject(Object value) {
if (value instanceof Number || value instanceof Boolean || value.equals(JSONObject.NULL)) {
return value;
}
throw this.syntaxError(String.format("Value '%s' is not surrounded by quotes", value));
} I moved it inside So now This Now it's more modular, you can either make it apart of nextString (which should be renamed to nextObject if it ends that way), or you can just do an if else statement and leave it outside of nextString, eitherways I believe the end result is sort of the same - at least for now. |
At the moment this is how I see my TODO list.
I would really appreciate some help with this last part, unless there are other modifications on the previous points you'd like me to do. Thank you for your patience so far. |
@rikkarth Thanks for letting me know. Sounds like you have taken this feature most of the way, I will look into completing the last item. |
Closed due to reverting incomplete strict mode so that other commits can be released. |
Issue description #884:
Analysis and Implementation
Fixed.