Description
Hi! First of all, love this package. It's so much lighter and simpler than the alternatives.
I have an OpenAPI document with a complex query (nested objects and arrays and whatnot), so it uses content inside of a parameter definition instead of schema (irrelevant details removed):
This is allowed by the specification. Currently, openapi-typescript generates the following:
export interface paths {
"/people": {
get: {
parameters: {
query?: {
my_complex_query?: string; // this should be my complex object from above
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
};
};
}
This is technically correct, but we lose the nice type-safety, one of the main features of this library.
Proposal
I don't know if this would open a can of worms, but it would be awesome if this paths interface could use the JSON schema from the OpenAPI document. Then, if using openapi-ts/openapi-fetch, the resulting client could just serialize the parameter using JSON.stringify.
I'm sure this would take a lot of work to get a feature-rich implementation, but I'd be happy to take a stab at a minimal one. I'm pretty bad at TypeScript so it'd take me awhile, but this would be a good way to learn.
Thanks!
Extra
Description
Hi! First of all, love this package. It's so much lighter and simpler than the alternatives.
I have an OpenAPI document with a complex query (nested objects and arrays and whatnot), so it uses
contentinside of a parameter definition instead ofschema(irrelevant details removed):{ "in": "query", "name": "my_complex_query", "content": { "application/json": { "schema": { "type": "object", "properties": { // Some complex object schema here } } } } }This is allowed by the specification. Currently,
openapi-typescriptgenerates the following:This is technically correct, but we lose the nice type-safety, one of the main features of this library.
Proposal
I don't know if this would open a can of worms, but it would be awesome if this
pathsinterface could use the JSON schema from the OpenAPI document. Then, if usingopenapi-ts/openapi-fetch, the resulting client could just serialize the parameter usingJSON.stringify.I'm sure this would take a lot of work to get a feature-rich implementation, but I'd be happy to take a stab at a minimal one. I'm pretty bad at TypeScript so it'd take me awhile, but this would be a good way to learn.
Thanks!
Extra