Default bool value on UI hidden

I just noticed on /UI if a bool value is false the property is removed from the json entirely but on the raw response from the endpoint the property is there. Caused a bit of confusion, not sure if it’s a bug or not.

Are you referring to a bool on the request from the UI or something else? Is a bit hard to follow what you might be referring to.

The build in /ui API Explorer uses its own JS config settings to ensure consistency with generated UIs, so defaults like null or default values not being shown might be specific or different from your API. Any more details you can highlight, I might be able to better understand the issue.

OK that makes sense, if the api explorer has it’s own fixed config then it explains the discrepancies. I would argue to mimick that default from project though as if you are using api explorer to document an api it becomes inaccurate if it doesn’t match. Not a big deal, just a minor quibble.

Is there anyway to get /ui requests to include default properties? It’s causing a bit of confusion as I am using it as API playground and people expect to see 0/null values. When property isn’t there it’s a bit confusing.

It’s hard to know exactly what you’re referring to without an example or screenshot, but I’ve added the ability to configure the JsConfig API Explorer uses in its Auto Form with:

appHost.AddToAppMetadata(meta => meta.Ui.Explorer.JsConfig = "eccn,inv");

By default it uses eccn,edv which expands to returning EmitCamelCaseNames and ExcludeDefaultValues, removing edv and adding inv will remove the ExcludeDefaultValues default option and add IncludeNullValues.

See the Customize JSON Responses docs for different jsconfig configuration options.

This change is available in the latest v8.8.1+ that’s now available in the pre-release packages.

1 Like

Perfect! Tested and working. Thank you for the amazing service, that helps a lot.

1 Like