Skip to content

Conversation

@Goodmain
Copy link
Contributor

@Goodmain Goodmain commented Apr 19, 2024

Description

We have an issue when the response contains a field with the name type. Here is an example of response structure:

{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "type": {
      "type": "string"
    },
    "comment": {
      "type": "string",
      "nullable": true
    },
    "color_code": {
      "nullable": true,
      "type": "string"
    }
  }
}

When we are trying to get the definition of the field the following error occurs:

TypeError: Cannot access offset of type string on string in /app/vendor/ronasit/laravel-swagger/src/Services/SwaggerService.php:325

The reason is that the Arr::get takes the first occurrence on the type in the array, not the correct one.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@Goodmain Goodmain requested a review from DenTray April 19, 2024 05:19
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@DenTray DenTray merged commit 37ed94f into master Apr 22, 2024
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

Successfully merging this pull request may close these issues.

3 participants