[Question/Wishlist] Using JSON for the protocol instead of XML

Aperta
#408 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
18/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
json, xml
Ambito
api, backend

Direzione di ricerca

Inizia esaminando i percorsi di comunicazione tra server e client che implementano il protocollo XML esistente. L’issue indica esempi di mapping in Rust in plugin-2021/src/game/game_state.rs e client-base/src/protocol/room.rs; determina l’ambito completo della migrazione e definisci i criteri di accettazione per una comunicazione JSON equivalente tra client e server.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

This is more of a general question rather than a specific issue. Has using JSON instead of XML for the protocol ever been considered, apart from legacy reasons?

While such a change would have quite a big impact on the way the different clients and the server handle communication, I think there are strong reasons for at least considering such a change e.g. for the next year:

  • JSON is ubiquitous, simple and easy to parse/serialize in almost every mainstream language (even hand-rolling a parser isn't too hard)
  • JSON maps very naturally to data structures in almost every mainstream language (in contrast to XML, where especially serialization can be very ambiguous, with regard to whether e.g. something should be serialized as text, an element, an attribute, etc.)
  • JSON is human-readable, debuggable and quite a bit less verbose than XML

A particular pain point with XML that I've encountered myself is e.g. the lack of good library support for Rust, leaving us essentially with either the option of hand-writing the XML mappings (which is tedious and error-prone) or using pretty limited tools for defining automatic mappings between structs and XML, which still require careful manual review of certain edge cases.

While these problems might not apply (as much) to other languages, JSON would solve pretty much all of these issues and at the same time simplify the protocol in general.

Lingua principale
HTML
Stelle
13
Fork
14
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di software-challenge/backend

Tutte le issue di software-challenge/backend

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.