Replacing specific array item
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 38/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- json, powershell
- Domaine
- tooling
Piste de recherche
Commence par la page wiki Replace et reproduis Sample transform 1 avec le JSON fourni, puis compare-le avec la root-level transform fonctionnelle. Suis la façon dont un @jdt.path relatif à un array est analysé et appliqué ; c'est terminé lorsque le Value de l'élément Foo change sans dépendre de sa position ordinale.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I am having trouble replacing specific array items using the @jdt.path syntax as described on the "Replace" wiki page. The @jdt verbs and attributes don't parse or transform when placed under the array object itself. I was able to get this working by moving the @jdt.replace to the top of the object and then drilling down. Is this a bug?
Sample JSON:
{
"MyStuff": [
{
"Name": "Foo",
"Value": 123
},
{
"Name": "Bar",
"Value": 456
}
]
}
The goal is to change the value of the "Foo" item without knowing the ordinal position or how many objects are in the MyStuff array.
Sample transform 1:
{
"MyStuff": {
"@jdt.replace": {
"@jdt.path": "@[?(@.Name == 'Foo')].Value",
"@jdt.value": 456
}
}
}
This should work according to the documentation but all I get is the MyStuff node literally replaced with the transform syntax.
Sample transform 2:
{
"@jdt.replace": {
"@jdt.path": "$.MyStuff[?(@.Name == 'Foo')].Value",
"@jdt.value": 456
}
}
Alternately, if we place the @jdt.replace at the root and change @jdt.path to start from the root and navigate into MyStuff, it works as expected.
I'm using Visual Studio 2022 + SlowCheetah 4.0.50 in a .NET Framework 4.7.2 project.
- Langage dominant
- PowerShell
- Étoiles
- 115
- Forks
- 39
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
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 microsoft/json-document-transforms
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
-
Easier way to replace an array?Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 52/100
-
SlowCheetah failing quietly.Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
-
Release requestOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 25/100
microsoft/json-document-transforms#27 · 1 réaction ·
Toutes les issues de microsoft/json-document-transforms
Issues similaires
-
area/config comp/cli comp/plugins duplicate P3 sweeper:risk-compatibility type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
NousResearch/hermes-agent#127405 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
area:*of bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
oapi-codegen/oapi-codegen#2593 ·
Les mainteneurs répondent en général sous 1 jour
-
[aw] Upgrade availableOuverteagentic-workflows
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
githubnext/rig#535 ·
-
agent-in-progress agent-research-recommend enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
codymikol/multiverse.nvim#337 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100
WLAN-Pi/wlanpi-profiler#307 ·
Les mainteneurs répondent en général sous 1 jour