Skip to content

Reusable PropertyValidationAttributes interface to improve typing in models - #24623

Open
devtobi wants to merge 10 commits into
OpenAPITools:masterfrom
it-at-m:feat(typescript-fetch)/improve-typing-validationattributes
Open

Reusable PropertyValidationAttributes interface to improve typing in models#24623
devtobi wants to merge 10 commits into
OpenAPITools:masterfrom
it-at-m:feat(typescript-fetch)/improve-typing-validationattributes

Conversation

@devtobi

@devtobi devtobi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This PR adds a central PropertyValidationAttributes to the runtime.ts and uses it via satisfies inside the generated *PropertyValidationAttributesMap objects. Prior loose typing information of those objects was removed.
This enables proper autocompletion for the *PropertyValidationAttributesMap objects.
The exported PropertyValidationAttributes interface can additionally be used by downstream applications (e.g. for implementing validation logic in frontend code)

Changes

  • Added exported PropertyValidationAttributes to runtime mustache template
  • Updated *PropertyValidationAttributeMap generation to check for satisfies using new PropertyValidationAttributes instead of defining loose type
  • Updated modelGenericInterfaces.mustache to import PropertyValidationAttributes on top of the generated files
  • Updated test case to check for satisfies instead of [property: string]:

Solves #24620

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@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) @KannaKim (2026/07)

@devtobi
devtobi marked this pull request as ready for review August 5, 2026 12:45
@devtobi

devtobi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Looks like node0 in CI failed due to a timeout, but this seems to be not my fault.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 31 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant