nasa / fprime-gds

F´ Python Ground Data System (GDS).
https://github.com/nasa/fprime
Apache License 2.0
18 stars 37 forks source link

Fix scalar input forms #141

Closed SMorettini closed 1 year ago

SMorettini commented 1 year ago
Originating Project/Creator
Affected Component fprime_gds/flask

Change Description

Original change: Added the modifier number to the scalar argument. This will cast the value to a number and not return a string.((https://v2.vuejs.org/v2/guide/forms.html#number)) --> This change was breaking the usage of hex, bin and octal because there is not such representation in Javascript.

The new change consists of updating the squash function so any number is actually converted to a number.

Rationale

This fix is required to have commands containing argument arrays of numbers. Without the Fix, Vue will send to the GDS server an array like '["1", "2",...]'. The parsing of the array will fail in Python with the error "Failed to validate all arguments".

After the fix, the array will be sent to the GDS backend as '[1, 2,...]' and the parsing of the array will work fine.

thomas-bc commented 1 year ago

Glancing over this, am I understanding correctly that this resolves https://github.com/nasa/fprime/issues/2273 ? Or is that a separate case?

SMorettini commented 1 year ago

I didn't see that issue but yes, this pull request resolved exactly that problem.

Tetragramm commented 1 year ago

This PR resolves an issue I'm seeing with multi-element parameters. Not a case noted in either this PR or the linked issue nasa/fprime#2273. Ex:

struct MultiParams {
  param_a: F32,
  param_b: F32
}
SMorettini commented 1 year ago

For testing my change you could: clone my branch https://github.com/SMorettini/fprime-gds/tree/Fix-scalar-input-forms in your laptop, and then install the customize gds with: pip install path/to/my/local/gds. Then if you run fprime-gds you should have the one with the fix.

SMorettini commented 1 year ago

The previous solution was working but created a new bug, I implemented a new solution that solve the original problem without impacting unsigned integer input.

LeStarch commented 1 year ago

@SMorettini I went ahead and edited this to use full type names to ensure that the code does not inadvertently read types starting with letters. Care to review my one commit?

@thomas-bc care to review?

LeStarch commented 1 year ago

Since I did not see booleans addressed in these if trees, which caused errors, I also fixed: https://github.com/nasa/fprime/issues/2320