JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

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

Offen
#1,040 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Type: Enhancement
Vorherrschende Sprache
Ruby
Sterne
2.3k
Forks
546
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die POST-Anfrage aus dem Issue und verfolge, wie die Elemente der obersten Ebene des Ressourcenobjekts validiert werden. Bestätige, dass die Verarbeitung von JSON:API-Ressourcenobjekten meta ablehnt, füge dann eine Abdeckung für diese Payload hinzu und überprüfe, dass eine gültige Ressource mit meta akzeptiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ruby
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.