Skip to content

Usage question about Api Platforms json-response #65

@ocramleznem

Description

@ocramleznem

I'm playing with this bundle on Api Platform 3. I've setup some examples and my responses for a GET-Request on http://localhost/test_entities/91656d77-1db8-4294-a841-004dc365fbb6 look like

{
  "@context": "/contexts/TestEntity",
  "@type": "TestEntity",
  "id": "91656d77-1db8-4294-a841-004dc365fbb6",
  "name": "deutscher name",
  "description": "deutsche beschreibung",
  "products": [],
  "translations": {
    "de": {
      "@type": "TestEntityTranslation",
      "@id": "/.well-known/genid/6b50a3758975475ca57e",
      "id": "192620a2-c8a1-45bd-8809-785e1a27f4cb",
      "name": "deutscher name",
      "description": "deutsche beschreibung",
      "locale": "de"
    },
    "en": {
      "@type": "TestEntityTranslation",
      "@id": "/.well-known/genid/dc4fadb73b87e7475f3f",
      "id": "e0d4ef95-f21c-4318-b182-9b00ed627de8",
      "name": "english name",
      "description": "english description",
      "locale": "en"
    }
  },
  "translation": {
    "@type": "TestEntityTranslation",
    "@id": "/.well-known/genid/6b50a3758975475ca57e",
    "id": "192620a2-c8a1-45bd-8809-785e1a27f4cb",
    "name": "deutscher name",
    "description": "deutsche beschreibung",
    "locale": "de"
  },
  "translationLocales": [
    "de",
    "en"
  ]
}

I'm not sure about if I missed something or it's just the way it works :). My expectation was to get something like the shown json but without these doubles. Additionally on extending the request with ?locale=de I still get the whole response shown up here. Any hints for me so far without extracting the whole codebase here?

I am using API-Platform 3.1.17 and with Doctrine ORM 2.16.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions