Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add tests for current TS output of DTOs with "optional" and required fields. #68

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

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

heymb
Copy link
Contributor

@heymb heymb commented Aug 2, 2024

Add tests for current TS output of DTOs with "optional" or required fields (see "Required Fields" section, can't hyperlink).

Context: This issue mentions wanting support for required fields as a minimum. Recently, others mentioned wanting this behavior.

Follow up - Implementation: A follow up PR implements minimum support for required fields. It seemed better to break out adding tests for existing behavior into this PR that can be merged first and adding support can be merged after as a follow up PR.

@heymb heymb changed the title Add tests for current behavior of data properties (optional and required). Add tests for current TS output of DTOs with "optional" and required fields. Aug 2, 2024
@heymb heymb requested a review from ejball August 2, 2024 20:04
@heymb heymb merged commit 6cf4974 into FacilityApi:master Aug 5, 2024
3 checks passed
heymb added a commit that referenced this pull request Aug 5, 2024
…n TS. (#69)

BREAKING CHANGE: Generate DTO required fields as NOT optional properties on interface in TS. Previously, all DTO fields (including required ones) were optional properties on an interface in TS.

- Implement minimum support for #34. Does not add other validation.
- Update test added in #68 since made change.
- Run codegen since FSD file has required fields.
- Update version and release notes. 

Learn more:
- FSD docs on "Required Fields": https://facilityapi.github.io/define/fsd#fields
- FSD docs on DTOs: https://facilityapi.github.io/define/fsd#data-transfer-objects
- TS docs on optional properties: https://www.typescriptlang.org/docs/handbook/2/objects.html#optional-properties

---------

Co-authored-by: Michael Baldwin <[email protected]>
@heymb heymb deleted the addTestsForDataProperties branch August 6, 2024 01:09
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.

2 participants