Closed johnbeech closed 1 year ago
Update, I fixed the error locally by modifying typegen.js
ignoring any operation that was missing operation.operationId
- by filtering those records from the output.
Result samples:
mport type {
OpenAPIClient,
Parameters,
UnknownParamsObject,
OperationResponse,
AxiosRequestConfig,
} from 'openapi-client-axios';
declare namespace Components {
namespace Schemas {
/**
* App Version
*/
export interface AppVersionModel {
/**
* The display name used by the App Store for descriptive purposes, e.g. "Dummy App"
*/
name: string; // ^.{4,64}$
/**
* The appId used by the App Store to store multiple versions of the same app, e.g. "dummy-app"
*/
id: string; // ^[a-z][a-z\d-]+$
/**
* Type of release version; one of dev, prerelease, or release
*/
type: "dev" | "prerelease" | "release";
/**
* Semver version string specifying used to index and install this version
*/
version: string; // ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
/**
* Relative path to find more information
*/
uri: string;
/**
* Timestamp specifying when the version was published: e.g. 2023-03-01T00:00:00Z
*/
timestamp: string; // ^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})Z$
}
...
And:
export interface OperationMethods {
/**
* getConfigSchema
*/
'getConfigSchema'(
parameters?: Parameters<Paths.GetConfigSchema.PathParameters> | null,
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.GetConfigSchema.Responses.$200>
/**
* putConfigSchema
*/
'putConfigSchema'(
parameters?: Parameters<Paths.PutConfigSchema.PathParameters> | null,
data?: Paths.PutConfigSchema.RequestBody,
config?: AxiosRequestConfig
): OperationResponse<Paths.PutConfigSchema.Responses.$200>
/**
* getStatus
*/
'getStatus'(
parameters?: Parameters<UnknownParamsObject> | null,
data?: any,
config?: AxiosRequestConfig
): OperationResponse<Paths.GetStatus.Responses.$200>
...
etc.
Hi @johnbeech! Would you care submitting a PR with your changes? 🙏
Created https://github.com/anttiviljami/openapi-client-axios/pull/152 for review! 🌻
Merged and released part of openapi-client-axios-typegen@7.2.0
Uncaught error for missing operation.
Run command:
Direct error for my input:
Context: trying to generate a typescript definition for a generated Amazon API Gateway Open API doc instance (using GetExport).
Stepping up, methodName / operation are empty:
Stepping up again, logged out operations:
It appears the one it fails on is the CORS
options
requestput
, andget
blocks processed fine:Partial JSON to help reproduce the issue:
I think I can fix the error locally by ignoring operations that don't have the necessary fields.