Skip to content
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

Can we check for bogus (unhandled) query parameters? #8

Open
samreid opened this issue Sep 12, 2016 · 4 comments
Open

Can we check for bogus (unhandled) query parameters? #8

samreid opened this issue Sep 12, 2016 · 4 comments

Comments

@samreid
Copy link
Member

samreid commented Sep 12, 2016

@andrewadare and I mistyped ?phet-io.log=lines as ?phetio.log=lines and it took us a few minutes to see our error. Can our query string support help us with this? If we have one large query string schema (handling everything), it could check for unused/unmatched query strings.

@samreid
Copy link
Member Author

samreid commented Sep 13, 2016

QueryStringMachine can keep track of all the schema keys it has seen, then after all schemas have been evaluated it could be triggered to see if there are any keys it has not seen.

@samreid
Copy link
Member Author

samreid commented Sep 22, 2016

@jonathanolson pointed out that 3rd parties may need to augment query string, so this testing should be during development only (say in an assertion), and published versions should be able to accept any query strings.

@samreid
Copy link
Member Author

samreid commented Nov 19, 2016

Based on @jonathanolson's remarks, this feature would have to be off by default. So it would have to be enabled with some sort of ?validateQueryString trigger. However, I'm imagining that nobody would ever use that during development unless it was on by default, and I fail to see the value of having it on by default if we are moving to a paradigm in phetmarks where the query parameters are supplied by the UI and have less chance of being error-prone.

@samreid samreid closed this as completed Nov 19, 2016
@chrisklus
Copy link
Contributor

chrisklus commented Dec 23, 2019

This issue is relevant again since we are adding public query parameters to sims in phetsims/joist#593, and we'd like to provide warnings or errors to users if their query parameter are incorrect. We support this for incorrect values, but don't yet support bad keys. @samreid and I are wondering if keys should be validated as well.

For example, in Natural Selection, if the query parameter allelesVisible is misspelled like &allelesVisibl=false, it's ignored by the sim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants