Unleash / unleash-edge

MIT License
48 stars 8 forks source link

fix: handle incoming requests on the api level #443

Closed thomasheartman closed 6 months ago

thomasheartman commented 6 months ago

Update all endpoints of the frontend_api to accept top-level properties.

This is primarily just changing the type we expect and then, on the lower level functions, converting the incoming context into a regular context.

Most of the functions are pretty straight-forward. get_all_features appears to be the only one that doesn't share an implementation with any other functions.

The tests check:

Are there any more endpoints to update? Any other input?

thomasheartman commented 6 months ago

Ah, there is one edge case that I can think of, actually: Deserializing empty string properties.

I noticed that the base Context type is defined with a custom deserializer:

        deserialize_with = "remove_null_properties",

With the new extra_properties, these can be empty strings. Should they be stripped out in any way when deserializing?

(Also: added a test for the invalid properties value giving 400 as mentioned in the previous PR)