Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Modify Plugs.DataToAttributes to follow JSON API sideposting draft

Ouverte
#1,303 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
elixir
Domaine
api, backend

Piste de recherche

Commencez par le code DataToAttributes référencé dans l’issue et examinez la façon dont JaSerializer.Params.to_attributes gère les relations belongs-to. Consultez le JSON API sideposting draft et issue #1301 avant de modifier le comportement. C’est terminé lorsque les relations de tableau utilisent des identifiants temp-id pour sélectionner les enregistrements inclus correspondants, tandis que les relations de map restent gérées par JaSerializer.Params.to_attributes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

blocked

Problem

From https://github.com/json-api/json-api/pull/1197/files?short_path=571f6ce#diff-571f6cee9a492e0e177801c21a4b2b2a

Our current approach with included records is to simply assume they are related to the main record.

Based on the draft

  • included record payloads should have temp-id properties if they are to be created.
  • the main record payload should have a relationship where the identifier is %{data: [%{"temp-id" => "foo", "type" => "bar"}
  • the plug should get those identifiers, then replace the identifier payloads with the associated full payloads matched in included

Subtasks

  • instead of just taking any included records and assuming they're relationships in the resulting params map, DataToAttributes should parse the relationships map first
    • the relationship where data is a map is a belongs to and should be left alone. it's already handled by JaSerializer.Params.to_attributes
    • the relationship where data is an array should be checked for identifiers with temp-id keys
      • each temp-id should be found in the included section and added under the pluralized relationship key in the resulting map

An advantage of this is that we now are able to conclude it's definitely a has_many, so we do not need to explicitly specify this anymore.

References

The code this needs to modify is part of #1301 so this is blocked until that is merged.

Langage dominant
Elixir
Étoiles
234
Forks
82
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de code-corps/code-corps-api

Toutes les issues de code-corps/code-corps-api

Issues similaires

Plus d'issues Elixir

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.