openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

default-non-nullable does not seem to work for query parameters.

Open glumb opened this issue 4 years ago • 4 comments

image

I'm using the cli tool like this

npx openapi-typescript --default-non-nullable openapi.yml --prettier-config .prettierrc --output typeApi.ts

But still the query parameters with a default value are optional type properties.

glumb avatar Nov 19 '21 20:11 glumb

Yes I believe --default-non-nullable should probably enforce the behavior you’re describing, unless it conflicts with another test. Would love for someone to open a PR if they’re able to!

drwpow avatar Dec 14 '21 20:12 drwpow

Are there any updates on this issue?

MarcErdmann avatar Sep 26 '22 12:09 MarcErdmann

I'm not sure this change makes sense in line with what REST and swagger are actually communicating. From swagger: "The default value is the one that the server uses if the client does not supply the parameter value in the request". If this change is implemented, the default value would never be used because typescript would require the client to always define it.

npbenjohnson avatar Dec 05 '22 18:12 npbenjohnson

@npbenjohnson We use the types at the server actually.

MarcErdmann avatar May 08 '23 14:05 MarcErdmann

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Aug 06 '24 12:08 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

github-actions[bot] avatar Aug 15 '24 02:08 github-actions[bot]