ghostbuster91 / sttp-openapi-generator

Generate sttp client from openapi specification with ease!
Apache License 2.0
32 stars 11 forks source link

Support text/plain content type #220

Open slivkamiro opened 1 year ago

slivkamiro commented 1 year ago

Hi, would it be possible to add support for text/plain content type?

I have endpoints such as this:

/readiness:
    get:
      operationId: getReadiness
      responses:
        '200':
          description: ''
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: ''

but the generated client is trying to parse the response into json.

def getReadiness(): Request[Either[ResponseException[String, CirceError], Unit], Any] = basicRequest.get(uri"$baseUrl/readiness").response(fromMetadata(asJson[Unit]))

This is problematic if the returned string is empty which is not a valid json.

Thank you!

ghostbuster91 commented 1 year ago

Hi, I think so, but unfortunately I won't have time to work on it probably till the end of the year. However, PRs are welcome :)