zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

Openapi model id is always String

Open ivi3 opened this issue 2 years ago • 1 comments

Hello Yiming. I appreciate for this great project. I have been working on a project and generated Openapi from my .zmodel using zenstack/openapi generator, but I have a problem in Openapi which is Id fields in each components that considered always string and that is different of real response from server, I read your Openapi plugin and figure out this line, can you tell me what is the reason of it? https://github.com/zenstackhq/zenstack/blob/b5929d88a2da200d1dfed00b2148a150801cf371/packages/plugins/openapi/src/rest-generator.ts#L891C41-L891C47

ivi3 avatar Nov 21 '23 09:11 ivi3

Hi @ivi3 , good catch! I think the reason is JSON:API spec requires the id field always to be a string. But it's bad to be inconsistent with the server behavior. I think we should fix the spec generation and afford a bit of inconsistency with JSON:API.

Let me know if you'd be interested in submitting a PR, and I'll be happy to facilitate a fix if you want to 😄.

ymc9 avatar Nov 21 '23 23:11 ymc9