Closed niklassaers closed 3 months ago
Hi @niklassaers,
in your OpenAPI document, the operation Reports_GetAgentSalesReport
(aka GET /reports/sales
) declares the 200 response with the following:
responses:
'200':
description: Success
content:
application/json:
schema:
type: string
format: binary
Notice the application/json
and format: binary
- that's not a compatible combination.
Either, if the content is a JSON string, just remove the format: binary
item, or if the content is a raw binary string, change the content type to application/octet-stream
.
Do you have an example response you could share? That'd allow me to confirm which one you're likely looking for.
Thank you soo much @czechboy0 , that was indeed the issue. The OpenAPI document contains many other endpoints that are indeed binary, so I expect this was a copy/paste error. I'll double-check with the author when he's back from summer vacation, but by removing the 'format: binary' from the application/json responses, it works well. Again thank you soo much :-)
Question
Hi, using the current commit of branch main (#99859083e53912612b56b4b8713a971c20dab3ef) I use the attached openapi.yaml and openapi-generator-config.yaml to generate the attached Types.swift and Client.swift.
When I compile these files, I get this error on line 6375 and 6478 of Client.swift:
Instance method 'getResponseBodyAsJSON(_:from:transforming:)' requires that 'HTTPBody' conform to 'Decodable'
Can you explain to me why and what I should do to fix this?
To try to make sure everything is in sync, I use the main branch of swift-openapi-runtime and swift-openapi-urlsession too.
(the files, needed to add .txt to be allowed to upload them)
Client.swift.txt openapi-generator-config.yaml.txt openapi.yaml.txt Types.swift.txt