Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Issue with API-Fetched Components Containing Unnecessary Empty Properties #352

Open
JumpLink opened this issue Jan 26, 2024 · 0 comments
Open

Comments

@JumpLink
Copy link
Contributor

I've encountered an issue when fetching components via the API. These components often include numerous empty properties, which ideally should not be defined at all (i.e., should be undefined) if they have no value assigned.
Example:

When fetching a component, I receive a JSON response with many properties that are either empty strings or default false values. Here's an example of such a response:

{
  "id": "e7zrcm",
  ...
  "validate": {
    "json": "",
    "custom": "",
    ...
    "maxWords": "",
    ...
  },
  ...
}

Specific Concern:

A key concern is with properties like validate.maxWords. In this example, it's an empty string (""), but its type should be number. Since no value is specified for maxWords, it should not be defined as a property or, at the very least, should be null. The presence of these empty or unnecessary properties complicates data handling and parsing on the client side.

Expected Behavior:

Ideally, if a property like maxWords in the validate object, or similar properties, are not set or have no value, they should either be:

  • Completely omitted from the response, or
  • Set to null instead of being an empty string or a default false value.

This would streamline the data structure and make it more predictable and easier to work with.

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

No branches or pull requests

1 participant