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

Skip to content

Support generating required fields as not optional in TS. #1

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

Closed
wants to merge 51 commits into from

Conversation

heymb
Copy link
Owner

@heymb heymb commented Aug 2, 2024

Implements minimum support for FacilityApi#34

Does not add other validation.

Builds upon this other PR which adds tests for existing behavior: FacilityApi#68

heymb and others added 30 commits September 18, 2023 14:08
Generates error sets in TypeScript.

---------

Co-authored-by: Michael Baldwin <[email protected]>
Preparing to add fastify server impl.
And generate conformance plugin.
- all but three conformance tests are passing (mirrorBytes, mirrorText, and bodyTypes) which will require a bit of work to configurare the fastify server, as well as potential changes to the generated client, which assumes that fetch requests come back with JSON.
- This allows the plugin to live anywhere without needing to know where the client type file is. I debated creating a new type file instead of inlining them in the plugin, but didn't really see a point since it is just for the server to use. Perhaps I'm missing something though...
No longer needed!
- This allows the plugin to live wherever the user wants it to live.
- Ideally I would think the express server should be generated the same way
but that would be a breaking change, so maybe not needed?
As well, we are now running all conformance tests together, testing all client and server code.
https://fastify.dev/docs/latest/Reference/Validation-and-Serialization/#serialization

I opted to only handle response schemas since (from my understanding) that is where most of the performance gain is at using `fast-json-stringify`. The request schemas are mostly for validation, which Facility can already take care of for us.
instead of digging into the type name directly.
Instead we just set it to a suggestion in `.editorconfig`
Add JsonSchema support to fastify plugin.
@@ -88,7 +88,7 @@ export interface ICreateWidgetResponse {
/** Request for GetWidget. */
export interface IGetWidgetRequest {
/** The widget ID. */
id?: number;
id: number;
Copy link
Owner Author

Choose a reason for hiding this comment

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

The changed properties in this file are now not optional since they are required in the FSD (search for "required" and compare).

@@ -905,7 +905,7 @@ export interface ICreateWidgetResponse {
/** Request for GetWidget. */
export interface IGetWidgetRequest {
/** The widget ID. */
id?: number;
id: number;
Copy link
Owner Author

Choose a reason for hiding this comment

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

Same as this comment if based on same FSD file which it seems to be.

@heymb heymb force-pushed the supportRequiredFields branch from ae8dc35 to ff4f6ea Compare August 5, 2024 14:28
@heymb heymb changed the base branch from addTestsForDataProperties to master August 5, 2024 14:29
…enerating required fields as not optional is a breaking change
@heymb
Copy link
Owner Author

heymb commented Aug 5, 2024

Closing since opened a new PR targeting origin instead of my fork: FacilityApi#69

@heymb heymb closed this Aug 5, 2024
@heymb heymb deleted the supportRequiredFields branch August 5, 2024 20:50
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.

5 participants