Description
So maybe I do not understand the documentation or this is either missing from the documentation or it is indeed a missing feature.
I have some custom types defined in the api schema. For example i might have the location endpoint defined as follows:
...
/api/location:
get:
tags:
- locations-controller
operationId: allLocations
parameters:
- name: operatorId
in: query
required: false
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MyLocation'
components:
schemas:
MyLocation:
required:
- country
- state
- street
type: object
properties:
lat:
type: number
format: float
lon:
type: number
format: float
country:
type: string
state:
type: string
street:
type: string
city:
type: string
zipCode:
type: string
Now I would like to write type safe code in my application. Normally when using openapi code generators I would have access to the model types. So is this supported by openfetch? Is it just undocumented or really a missing feature?
I mean I read about the type helpers in the documentation, but this is not really what i want. What i would like would be a generated type definition similar to
interface MyLocation {
lat: number | undefined,
lon: number | undefined,
country: string,
state: string,
street: string,
city: string | undefined,
zipCode: string | undefined,
}
So it can be used throughout the code.
Is there any possibility to add support for defining models in the spec? Or can this be achieved with other libraries? For complex models defining everything manually again on the frontend kind of defeats the purpose of openapi.
Additional information
- Would you be willing to help implement this feature?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.