Closed dennywright closed 4 months ago
The object you’re passing seems to be an openapi definition object, but the types don’t seem to match.
You may want to run the document against some validator to see if your json contains errors.
The type error seems to suggest that something about your openapi document is invalid.
You can always just cast the object with as Document
if the document is mostly valid.
Hmm. I'm writing my openapi.yaml to openapi.json using openapicmd. Both validate using openapicmd. And I get the same error when I try to cast as Document
. It looks like OpenAPIClientAxios() converts the openapi definition to the Document with loadDocument(), but I can't quite grok how it works. Need to look at it in detail.
I was able to get it to compile the Typescript using the stripped version:
npx openapicmd read --strip openapi_client_axios --format json openapi.json > openapi-runtime.json
I was concerned that I wouldn't have the type info in the client but that is coming from openapi.d.ts. So I think this will work.
Thanks Denny
Good Day Viljami, Thank you very much for the openapi-stack. This is an amazing set of modules. I'm really impressed with how easy it is to get an API up an running.
That said, I need to bundle a standalone client. I'm using using NextJS (webpack). I'm using these instructions:
https://openapistack.co/docs/openapi-client-axios/bundling/
I'm getting the following typescript error:
OpenAPIClientAxios is expecting definition to be 'Document | string' not the openapi object. I've tried JSON.stringify on the object, but it's not working. The client isn't making requests. What am I doing wrong?