-
-
Notifications
You must be signed in to change notification settings - Fork 547
Open
Description
openapi: 3.0.2
openapi-typescript-codegen: 0.23.0
How do I get my generated client to offer arguments for the 'accept' media type?
My spec looks like this:
paths:
/{region_id}/policies_v2/revenue/full:
get:
tags:
- PoliciesV2
summary: Get Policy Revenue Full
operationId: get_policy_revenue_full
parameters:
- description: Region identifier
required: true
schema:
title: Region Id
type: string
description: Region identifier
name: region_id
in: path
- required: true
schema:
title: Start Date
type: string
format: date-time
name: start_date
in: query
- required: true
schema:
title: End Date
type: string
format: date-time
name: end_date
in: query
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ReportsRevenueItem'
text/csv: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- APIKeyHeader: []
- APIKeyQuery: []
produces:
- text/csv
- application/json
The generated client shows this:
public getPolicyRevenueFull({
regionId,
startDate,
endDate,
}: {
regionId: string
startDate: string
endDate: string
}): CancelablePromise<Array<ReportsRevenueItem>> {
return this.httpRequest.request({
method: 'GET',
url: '/{region_id}/policies_v2/revenue/full',
path: {
region_id: regionId,
},
query: {
start_date: startDate,
end_date: endDate,
},
errors: {
422: `Validation Error`,
},
})
}It does not show any arguments for 'produces', 'mediaType', or optional headers. How can the client user specify they want a 'text/csv' response?
In Swagger UI it does provide a dropdown with these values and will optionally fetch each specified type correctly. This makes me think clients should be able to expose this. For example here is a curl it produces:
curl -X 'GET' \
'http://127.0.0.1:8000/internal/north/policies_v2/revenue/full?start_date=2022-01-02&end_date=2022-05-05' \
-H 'accept: text/csv' \Here is a screen shot of the UI showing the drop down.
Thanks.
vdawg-git and eugenk
Metadata
Metadata
Assignees
Labels
No labels
