You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is a composition of multiple models, the generated typescript code does not add the required parameters of the extended type in the generated FromJSON function.
Not sure - any suggestions on how to tackle this would be appreciated and I can add it to PR #1545
Looking at the debugModels export for the provided yaml definition, it seems that parentVars is an empty list for model Combined which could have been used to add additional required params to the function. Alternatively, the allVars template variable could be used over the vars variable in this block as it contains all potential params?
The text was updated successfully, but these errors were encountered:
I think this can also extend to the ToJSON generated function. All variables are not added to the returned JSON and no attention is given to readOnly variables. I think switching to the allVars template variable makes sense for both functions and adding functionality for readOnly parameters can be added in the process.
Description
When there is a composition of multiple models, the generated typescript code does not add the required parameters of the extended type in the generated
FromJSON
function.openapi-generator version
openapi-generator-cli-4.0.0-20181126.024631-44
OpenAPI declaration file content or url
Generated Code (excerpt):
Compiler throws an error since its missing the required
name
parameterCommand line used for generation
openapi-generator generate -i openapi.yaml -l typescript-fetch -c es6.json -o ./typescript-api/
Steps to reproduce
Related issues/PRs
PR #569
Suggest a fix/enhancement
Not sure - any suggestions on how to tackle this would be appreciated and I can add it to PR #1545
Looking at the debugModels export for the provided yaml definition, it seems that
parentVars
is an empty list for modelCombined
which could have been used to add additional required params to the function. Alternatively, theallVars
template variable could be used over thevars
variable in this block as it contains all potential params?The text was updated successfully, but these errors were encountered: