-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Optional Response Parameters #42
Comments
League API responses seem to not have optional member fields (there is no Static API anymore). It might be worth considering a pull request. |
MingweiSamuel/riotapi-schema#7 Will revert the typings as it is unsafe and I don't want to go through every response to determine what fields are missing in which situation until I have a lot of free time. Body param DTOs will gain their optional params, which is nice (requires casting though), while response DTOs will still use optional fields. |
One huge TypeScript problem (though it's ignorable) is that the response body properties are all optional.
Problem
sw2dts
generates optional types by default unless the user sets therequired
tag in the property of a component.=>
Without the
required
tags, we end up withThe auto-generated JSON that we read from (http://www.mingweisamuel.com/riotapi-schema/openapi-3.0.0.yml) does not have the
required
property. However, I do not believe that is the problem of the JSON we read from.required
(based on what I know) is based on parameters (path & query) for an endpoint, and not for the response classes themselves.Manual Workaround
Workaround 1
Workaround 2
Manual file-editing, which is not fun.
If I forget about this and you're having issues due to bad code and run-time errors hit me up
The text was updated successfully, but these errors were encountered: