teunmooij / payload-tools

Collection of payload plugins and tools: payload-openapi, payload-swagger, create-payload-api-docs, payload-rbac
https://github.com/teunmooij/payload-tools/#readme
MIT License
101 stars 12 forks source link

Add missing properties for error response object #87

Closed Givemeurcookies closed 2 months ago

Givemeurcookies commented 3 months ago

The error response from Payload does not reflect the error response in the OpenAPI due to missing properties. This means that if anyone wants to use i.e openapi-fetch, they won't be able to use those properties or they will have to override the types.

I have added the missing properties and set them to optional to make sure it's backwards compatible.

I tested the old schema vs. the new schema with different error objects.

Givemeurcookies commented 2 months ago

There's a typo in my commit. So I will close the PR.

I deployed my own fork to get it working as I needed them myself. I also fixed the broken tests which exist in the pull request https://github.com/teunmooij/payload-tools/pull/80

https://github.com/Bitkraken/payload-tools

Here's the packages at NPM: https://www.npmjs.com/package/@bitkraken/payload-swagger https://www.npmjs.com/package/@bitkraken/payload-openapi

I don't plan to maintain this deployment separately, so @teunmooij just give me a ping/reopen the PR and I'll create a new pull request with the fixes.