fix(typescript-fetch): generate validationAttributes when withoutRuntimeChecks=true#23107
Conversation
...les/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts
Show resolved
Hide resolved
…imeChecks=true Previously, setting `validationAttributes=true` had no effect when `withoutRuntimeChecks=true` was set. This commit fixes that by adding the validation attributes to the `modelGenericInterfaces.mustache` template (that is used when withoutRuntimeChecks is enabled) - Moves validationAttributes logic to a partial template and includes it in the modelGenericInterfaces.mustache template - modelGeneric.mustache includes the modelGenericInterfaces.mustache partial and should work as before
07b1502 to
0bf54dd
Compare
| } | ||
| {{#validationAttributes}} | ||
|
|
||
| export const {{classname}}PropertyValidationAttributesMap: { |
There was a problem hiding this comment.
is this change backwards compatible? maybe people imported this map from this file?
There was a problem hiding this comment.
It should be backwards compatible, this template includes the modelGenericInterfaces.mustache (which renders this map) as a partial, so this map will still be rendered in this file.
| @@ -0,0 +1,65 @@ | |||
| {{#validationAttributes}} | |||
There was a problem hiding this comment.
does this change require any import changes in any of the mustache files?
There was a problem hiding this comment.
no it should be ok, since the map is included in the modelGeneric.mustache, anything that previously imported from this file still works as before. And for this partial itself it only uses primitive types so no additional imports are needed in the generated output when this is used
…imeChecks=true (OpenAPITools#23107) * fix(typescript-fetch): generate validationAttributes when withoutRuntimeChecks=true Previously, setting `validationAttributes=true` had no effect when `withoutRuntimeChecks=true` was set. This commit fixes that by adding the validation attributes to the `modelGenericInterfaces.mustache` template (that is used when withoutRuntimeChecks is enabled) - Moves validationAttributes logic to a partial template and includes it in the modelGenericInterfaces.mustache template - modelGeneric.mustache includes the modelGenericInterfaces.mustache partial and should work as before * update samples
Previously, setting
validationAttributes=truehad no effect whenwithoutRuntimeChecks=truewas set. This commit fixes that by adding the validation attributes to themodelGenericInterfaces.mustachetemplate (that is used when withoutRuntimeChecks is enabled)in the modelGenericInterfaces.mustache template
partial and should work as before
cc: @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) @dennisameling (2026/02)
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)Summary by cubic
Generate validationAttributes for typescript-fetch models when withoutRuntimeChecks=true. Restores validation metadata in interface-only builds while keeping default builds unchanged.
Written for commit 0bf54dd. Summary will update on new commits.