improve the exception message when saving an array into a config string

Created on 15 January 2024, over 1 year ago

Problem/Motivation

If you try to save an array of data into a config property, and you stupidly defined it in the schema as 'string' instead of 'sequence', you get a REALLY confusing exception that says something like:

> Property my_property.0 does not exist.

It would be much more helpful if this said something like 'Tried to save an array into a string property'.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
Configuration 

Last updated 10 days ago

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joachim
  • First commit to issue fork.
  • 🇮🇳India ajinkya45 Pune

    ajinkya45 changed the visibility of the branch 3414703-improve-the-exception to hidden.

  • Pipeline finished with Success
    2 months ago
    Total: 1393s
    #543734
  • 🇮🇳India ajinkya45 Pune

    Proposed a fix by adding a type check in TypedConfigManager::buildDataDefinition(). Now throws a clear error if an array is saved into a string-typed config property.

  • 🇺🇸United States smustgrave

    Seems to be doing more then updating a message, seems like a new check that should have test coverage.

  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    I don't agree with the route taken in the current MR as well. It seems like this is very small scope, instead of hard checking against the string type can we check that it's not a type that's iterable, such as map or sequence?

  • 🇮🇳India ajinkya45 Pune

    Thanks for the suggestion! I will update the check to validate against iterables like map or sequence instead of strictly arrays and include a test to cover the behavior.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 211s
    #561318
  • Pipeline finished with Failed
    about 2 months ago
    Total: 150s
    #561331
  • Pipeline finished with Failed
    about 2 months ago
    Total: 628s
    #561340
  • Pipeline finished with Failed
    about 2 months ago
    Total: 506s
    #561401
Production build 0.71.5 2024