Should we remove the requirement on properties with default values ?
@IsakNaslundBh y travaille déjà.
Depuis le 3/9/2025.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
In the BHoM_UI, users are only required to provide properties that don't have a default value. Considering that the JSON schemas are meant to be used with external partners that don't necessarily have the exact same set of properties as the BHoM, it would be great to do something similar. That way, they can provide only the properties that are relevant within their own environment without having to handle the potential extra richness/complexity that the BHoM might offer.
Here's an example of what I mean. Here's our current schema for a Line:
{
"$id" : "https://raw.githubusercontent.com/BHoM/BHoM_JSONSchema/develop/Geometry_oM/Line.json",
"title" : "Line",
"type" : ["object", "null"],
"description" : "Line: A straight segment in space defining the shortest distance between two points in three-dimensional Euclidean geometry.\nThe Vector from Start to End defines the Line direction, which can be important for some applications.",
"properties" : {
"Start" : {
"$ref" : "https://raw.githubusercontent.com/BHoM/BHoM_JSONSchema/develop/Geometry_oM/Point.json"
},
"End" : {
"$ref" : "https://raw.githubusercontent.com/BHoM/BHoM_JSONSchema/develop/Geometry_oM/Point.json"
},
"Infinite" : {
"type" : "boolean",
"description" : "Defines the Line as a ray of infinite extents in both directions"
},
"_t" : {
"type" : ["string", "null"],
"description" : "Optional type disciminator.",
"const" : "BH.oM.Geometry.Line"
},
"_bhomVersion" : {
"type" : ["string", "null"],
"description" : "Optional version of BHoM used as part of automatic versioning and schema upgrades."
}
},
"required" : ["Start", "End", "Infinite"]
}
This means that this would fail the validation as it doesn't contain the Infinite property:
{
"_t": "BH.oM.Geometry.Line",
"Start": {
"_t": "BH.oM.Geometry.Point",
"X": 1,
"Y": 2,
"Z": 3
},
"End": {
"_t": "BH.oM.Geometry.Point",
"X": 1,
"Y": 2,
"Z": 3
},
"_bhomVersion": "8.1"
}
My issue here is that the BHoM Line would actually be created successfully from the above. So we are enforcing additional constrains that are not a reflection of that would actually work in practice.
I understand that we want to protect the user from incorrectly naming properties. But would it be possible to have warnings instead of errors on properties from the json that are not found on the BHoM object itself? This is what we do in the BHoM_UI and it works quite well that way, providing the best of both worlds.
- Langage dominant
- C#
- Étoiles
- 0
- Forks
- 0
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de BHoM/JSONSchema_Toolkit
-
type:feature
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
Toutes les issues de BHoM/JSONSchema_Toolkit
Issues similaires
-
area-signalr
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
dotnet/aspnetcore#69842 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
Les mainteneurs répondent en général sous 2 jours
-
bug needs-triage
Difficulté 2/5 Moins d'une heure Accessibilité débutants 78/100
microsoft/microsoft-ui-reactor#1373 ·
Les mainteneurs répondent en général sous 1 jour
-
Client customer-reported KeyVault needs-team-attention question Service Attention
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Azure/azure-sdk-for-net#63861 · 3 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour