Skip to content

api-platform/laravel 4.0: Error with 200 status code and dump #391

Open
@Florian-Rowehy

Description

@Florian-Rowehy

API Platform version(s) affected: api-platform/laravel 4.0.14

Description
I keep on getting this error while trying to create vuetify resources:

{
  api: Api { entrypoint: 'http://php/api/docs.jsonopenapi', resources: [] },
  error: {
    response: Response {
      status: 200,
      statusText: 'OK',
      headers: Headers {
        'access-control-allow-origin': '*',
        'cache-control': 'no-cache, private',
        'content-type': 'application/vnd.openapi+json; charset=utf-8',
        date: 'Fri, 17 Jan 2025 09:28:25 GMT',
        link: '<http://php/api/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"',
        server: 'Caddy',
        vary: 'Accept',
        'x-content-type-options': 'nosniff',
        'x-frame-options': 'deny',
        'transfer-encoding': 'chunked'
      },
      body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
      bodyUsed: false,
      ok: true,
      redirected: false,
      type: 'basic',
      url: 'http://php/api/docs.jsonopenapi'
    }
  },
  response: Response {
    status: 200,
    statusText: 'OK',
    headers: Headers {
      'access-control-allow-origin': '*',
      'cache-control': 'no-cache, private',
      'content-type': 'application/vnd.openapi+json; charset=utf-8',
      date: 'Fri, 17 Jan 2025 09:28:25 GMT',
      link: '<http://php/api/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"',
      server: 'Caddy',
      vary: 'Accept',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'transfer-encoding': 'chunked'
    },
    body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
    bodyUsed: false,
    ok: true,
    redirected: false,
    type: 'basic',
    url: 'http://php/api/docs.jsonopenapi'
  },
  status: 200
}

How to reproduce
I use the following command: npm init @api-platform/client http://php/api/docs.jsonopenapi src/ -- --generator vuetify

Additional Context
The api documentation accessible at /api/docs.jsonopenapi:

{
  "openapi": "3.1.0",
  "info": {
    "title": "API Platform",
    "description": "My awesome API",
    "contact": {
      "name": "",
      "url": "",
      "email": ""
    },
    "license": {
      "name": "",
      "url": ""
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "/",
      "description": ""
    }
  ],
  "paths": {
    "/api/candidates": {
      "get": {
        "operationId": "api_apicandidates_get_collection",
        "tags": [
          "Candidate"
        ],
        "responses": {
          "200": {
            "description": "Candidate collection",
            "content": {
              "application/ld+json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "member": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Candidate.jsonld"
                      }
                    },
                    "totalItems": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "view": {
                      "type": "object",
                      "properties": {
                        "@id": {
                          "type": "string",
                          "format": "iri-reference"
                        },
                        "@type": {
                          "type": "string"
                        },
                        "first": {
                          "type": "string",
                          "format": "iri-reference"
                        },
                        "last": {
                          "type": "string",
                          "format": "iri-reference"
                        },
                        "previous": {
                          "type": "string",
                          "format": "iri-reference"
                        },
                        "next": {
                          "type": "string",
                          "format": "iri-reference"
                        }
                      },
                      "example": {
                        "@id": "string",
                        "type": "string",
                        "first": "string",
                        "last": "string",
                        "previous": "string",
                        "next": "string"
                      }
                    },
                    "search": {
                      "type": "object",
                      "properties": {
                        "@type": {
                          "type": "string"
                        },
                        "template": {
                          "type": "string"
                        },
                        "variableRepresentation": {
                          "type": "string"
                        },
                        "mapping": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "@type": {
                                "type": "string"
                              },
                              "variable": {
                                "type": "string"
                              },
                              "property": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "required": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "member"
                  ]
                }
              },
              "text/html": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Candidate"
                  }
                }
              }
            }
          }
        },
        "summary": "Retrieves the collection of Candidate resources.",
        "description": "Retrieves the collection of Candidate resources.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "The collection page number",
            "required": false,
            "deprecated": false,
            "allowEmptyValue": true,
            "schema": {
              "type": "integer",
              "default": 1
            },
            "style": "form",
            "explode": false,
            "allowReserved": false
          }
        ],
        "deprecated": false
      },
      "post": {
        "operationId": "api_apicandidates_post",
        "tags": [
          "Candidate"
        ],
        "responses": {
          "201": {
            "description": "Candidate resource created",
            "content": {
              "application/ld+json": {
                "schema": {
                  "$ref": "#/components/schemas/Candidate.jsonld"
                }
              },
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/Candidate"
                }
              }
            },
            "links": {}
          },
          "400": {
            "description": "Invalid input"
          },
          "422": {
            "description": "Unprocessable entity"
          }
        },
        "summary": "Creates a Candidate resource.",
        "description": "Creates a Candidate resource.",
        "parameters": [],
        "requestBody": {
          "description": "The new Candidate resource",
          "content": {
            "application/ld+json": {
              "schema": {
                "$ref": "#/components/schemas/Candidate.jsonld"
              }
            },
            "text/html": {
              "schema": {
                "$ref": "#/components/schemas/Candidate"
              }
            }
          },
          "required": true
        },
        "deprecated": false
      }
    },
    "/api/candidates/{id}": {
      "get": {
        "operationId": "api_apicandidates_id_get",
        "tags": [
          "Candidate"
        ],
        "responses": {
          "200": {
            "description": "Candidate resource",
            "content": {
              "application/ld+json": {
                "schema": {
                  "$ref": "#/components/schemas/Candidate.jsonld"
                }
              },
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/Candidate"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          }
        },
        "summary": "Retrieves a Candidate resource.",
        "description": "Retrieves a Candidate resource.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Candidate identifier",
            "required": true,
            "deprecated": false,
            "allowEmptyValue": false,
            "schema": {
              "type": "string"
            },
            "style": "simple",
            "explode": false,
            "allowReserved": false
          }
        ],
        "deprecated": false
      },
      "delete": {
        "operationId": "api_apicandidates_id_delete",
        "tags": [
          "Candidate"
        ],
        "responses": {
          "204": {
            "description": "Candidate resource deleted"
          },
          "404": {
            "description": "Resource not found"
          }
        },
        "summary": "Removes the Candidate resource.",
        "description": "Removes the Candidate resource.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Candidate identifier",
            "required": true,
            "deprecated": false,
            "allowEmptyValue": false,
            "schema": {
              "type": "string"
            },
            "style": "simple",
            "explode": false,
            "allowReserved": false
          }
        ],
        "deprecated": false
      },
      "patch": {
        "operationId": "api_apicandidates_id_patch",
        "tags": [
          "Candidate"
        ],
        "responses": {
          "200": {
            "description": "Candidate resource updated",
            "content": {
              "application/ld+json": {
                "schema": {
                  "$ref": "#/components/schemas/Candidate.jsonld"
                }
              },
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/Candidate"
                }
              }
            },
            "links": {}
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Unprocessable entity"
          }
        },
        "summary": "Updates the Candidate resource.",
        "description": "Updates the Candidate resource.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Candidate identifier",
            "required": true,
            "deprecated": false,
            "allowEmptyValue": false,
            "schema": {
              "type": "string"
            },
            "style": "simple",
            "explode": false,
            "allowReserved": false
          }
        ],
        "requestBody": {
          "description": "The updated Candidate resource",
          "content": {
            "application/merge-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/Candidate"
              }
            }
          },
          "required": true
        },
        "deprecated": false
      }
    }
  },
  "components": {
    "schemas": {
      "Candidate": {
        "type": "object",
        "description": "",
        "deprecated": false,
        "properties": {
          "id": {
            "readOnly": true,
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "firstname": {
            "type": "string"
          },
          "lastname": {
            "type": "string"
          },
          "linkedinUrl": {
            "type": "string"
          },
          "mobileNumber": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Candidate.jsonld": {
        "type": "object",
        "description": "",
        "deprecated": false,
        "properties": {
          "@context": {
            "readOnly": true,
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "@vocab": {
                    "type": "string"
                  },
                  "hydra": {
                    "type": "string",
                    "enum": [
                      "http://www.w3.org/ns/hydra/core#"
                    ]
                  }
                },
                "required": [
                  "@vocab",
                  "hydra"
                ],
                "additionalProperties": true
              }
            ]
          },
          "@id": {
            "readOnly": true,
            "type": "string"
          },
          "@type": {
            "readOnly": true,
            "type": "string"
          },
          "id": {
            "readOnly": true,
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "firstname": {
            "type": "string"
          },
          "lastname": {
            "type": "string"
          },
          "linkedinUrl": {
            "type": "string"
          },
          "mobileNumber": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      }
    },
    "responses": {},
    "parameters": {},
    "examples": {},
    "requestBodies": {},
    "headers": {},
    "securitySchemes": {}
  },
  "security": [],
  "tags": [],
  "webhooks": {}
}

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