JustArchiNET / ASF-ui

The official web interface for ASF
Apache License 2.0
259 stars 37 forks source link

Only show valid config properties as options #1445

Open Botan626 opened 3 years ago

Botan626 commented 3 years ago

What UI shows: image

This setting on ASF wiki: https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Configuration#completetypestosend

MrBurrBurr commented 3 years ago

Related: https://discord.com/channels/267292556709068800/332735075315744768/855995278385348629

Not sure if this issue is out of scope. I really do not want to parse wiki in order find out what are valid values for each property and I cant come up with a better approach right now.

I wonder what @Aareksio would do in such a situation.

MrBurrBurr commented 3 years ago

Maybe @JustArchi or @Abrynos have a suggestion on how to handle this situation?

JustArchi commented 3 years ago

You don't, if swagger doesn't provide a way to further validate something, you shouldn't do anything extra.

Either you classify it as super important and we come to conclusion that we need to enhance our swagger schema to allow you to achieve that (as we did with flags enum), or it's irrelevant. In this case I believe it's irrelevant, ASF accepts all the options for that property, just because other do not make sense doesn't mean user can't select them.

MrBurrBurr commented 3 years ago

ASF accepts all the options for that property, just because other do not make sense doesn't mean user can't select them.

I get a 400 in response with this message: "Configured CompleteTypesToSend property is invalid: Sticker".

JustArchi commented 3 years ago

I get a 400 in response with this message: "Configured CompleteTypesToSend property is invalid: Sticker".

Show the message to the user and do nothing else. You're writing frontend, not backend.

MrBurrBurr commented 3 years ago

Show the message to the user and do nothing else. You're writing frontend, not backend.

Yeah thats what we are doing currently.

JustArchi commented 3 years ago

Apparently swagger supports min and max for various properties: https://swagger.io/docs/specification/data-models/data-types/

I might be able to make use of it to better define what values are valid for each prop, I'll mention you in appropriate commit if I do that @MrBurrBurr

JustArchi commented 3 years ago

@MrBurrBurr https://github.com/JustArchiNET/ArchiSteamFarm/commit/874eb4d3a6db4b102b8b2a6bab9b5fcf57b2e385

JustArchi commented 3 years ago

https://ptb.discord.com/channels/267292556709068800/332735075315744768/859854787634004049