JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

JR isn't letting me send `meta` as a record property, despite it allows in jsonapi.org

Aperta
#1,040 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Type: Enhancement
Lingua principale
Ruby
Stelle
2.3k
Fork
546
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Data:

> POST /v1/ayments HTTP/1.1
> Host: commerce.laurelandwolf.local
> Accept-Encoding: deflate, gzip
> Content-Type: application/vnd.api+json
> Accept: application/vnd.api+json
> Content-Length: 364
| {
| 	"data": {
| 		"type": "payments",
| 		"attributes": {
| 			"token": "tok_visa"
| 		},
| 		"relationships": {
| 			"chargeable": {
| 				"data": {
| 					"id": "1",
| 					"type": "requests"
| 				}
| 			}
| 		},
| 		"meta": {
| 			"request": {
| 				"shipping-cents": 10000,
| 				"shipping-currency": "USD"
| 			}
| 		}
| 	}
| }

Response:

{
	"errors": [
		{
			"title": "Param not allowed",
			"detail": "meta is not allowed.",
			"code": "105",
			"status": "400"
		}
	]
}

jsonapi.org specification:

Creating Resources

A resource can be created by sending a POST request to a URL that represents a collection of resources. The request MUST include a single resource object as primary data. The resource object MUST contain at least a type member.

Resource Objects

"Resource objects" appear in a JSON API document to represent resources.

A resource object MUST contain at least the following top-level members:

  • id
  • type

Exception: The id member is not required when the resource object originates at
the client and represents a new resource to be created on the server.

In addition, a resource object MAY contain any of these top-level members:

  • attributes: an [attributes object][attributes] representing some of the resource's data.
  • relationships: a [relationships object][relationships] describing relationships between
    the resource and other JSON API resources.
  • links: a [links object][links] containing links related to the resource.
  • meta: a [meta object][meta] containing non-standard meta-information about a
    resource that can not be represented as an attribute or relationship.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Direzione di ricerca

Riproduci la richiesta POST dell’issue e traccia il modo in cui vengono validati i membri di primo livello dell’oggetto risorsa. Conferma che la gestione degli oggetti risorsa JSON:API rifiuta meta, quindi aggiungi la copertura per questo payload e verifica che una risorsa valida con meta venga accettata.

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

Valutazione

Stack tecnologico
ruby
Ambito
api, backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.