hotmeteor / spectator

OpenAPI testing for PHP
MIT License
285 stars 53 forks source link

Support charset and placeholder media types #189

Closed bastien-phi closed 8 months ago

bastien-phi commented 8 months ago

The specification allows to define responses with placeholders :

paths:
  /info/logo:
    get:
      responses:
        '200':           # Response
          description: OK
          content:       # Response body
            image/*:     # Media type
             schema: 
               type: string
               format: binary

https://swagger.io/docs/specification/media-types/

which is currently not possible.

This PR adds the support of that.

It also fixes a bug where a response having a content type like application/json; charset=UTF-8 would not match the openapi

ErrorException: Response did not match any specified content type.

  Expected: application/json
  Actual: application/json; charset=utf-8
bastien-phi commented 8 months ago

@jarrodparkes Can you take a look at this ? Adam is on vacation this week and afk