Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #12926
Closed
Open
Issue created Jul 19, 2022 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][PHP] Accept headers are discarding content types in favour of application/json

Created by: Pittiplatsch

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

What's the point of removing all Accept headers not matching sth. like application/json? ->see HeaderSelector::selectAcceptHeader()

By truncating all but the json content types the endpoint specified in the YAML below isn't reachable: The sunny case (aka HTTP 200) only delivers application/octet-stream -> if requested with Accept: application/json it fails with 406 Not acceptable according to RFC 2616.

I assume to understand the intention of HeaderSelector::selectAcceptHeader(): prioritize application/json as the PHP client only can interpret / deserialize JSON responses. However, there are services which may respond with non-JSON, especially with a plain file which the client can handle as well.

openapi-generator version
  • 4.3.1
  • 5.0.0
  • 6.0.1
OpenAPI declaration file content or url

https://gist.github.com/Pittiplatsch/d345dcdd40027e2ef31fc71213626373

Generation Details

No special configuration needed.

Steps to reproduce

Just generate PHP client according to documentation.

Related issues/PRs

#4684 #5163 (closed)

Suggest a fix

Maybe some kind of prioritizing via quality values might help? This of course requires the server to interpret them correctly.

Assignee
Assign to
Time tracking