Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Florian-Rowehy opened this issue Jan 17, 2025 · 0 comments
Open

Comments

@Florian-Rowehy
Copy link

Florian-Rowehy commented Jan 17, 2025

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": {}
}
@Florian-Rowehy Florian-Rowehy changed the title Error with 200 status code and dump api-platform/laravel 4.0: Error with 200 status code and dump Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant