-
Notifications
You must be signed in to change notification settings - Fork 37
Set up type safe client server communication #201
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
tjementum
merged 8 commits into
main
from
raix/setup-typesafe-client-server-communication
Nov 11, 2023
Merged
Set up type safe client server communication #201
tjementum
merged 8 commits into
main
from
raix/setup-typesafe-client-server-communication
Nov 11, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
raix
commented
Nov 9, 2023
3e8a950
to
90f6e56
Compare
90f6e56
to
b3e9ce0
Compare
b3e9ce0
to
c86644d
Compare
tjementum
previously approved these changes
Nov 11, 2023
ab274f0
to
de641f7
Compare
…ntil swagger.json is generated
… dotnet-tool.json, replace custom GitHub actions
de641f7
to
6d25b18
Compare
Kudos, SonarCloud Quality Gate passed!
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary & Motivation
We want the front-end development environment to use modern React APIs, adding the accessibility and styling ergonomics while keeping type safety when calling the API.
Accessibility can be difficult to add if it's an afterthought. The React Aria Components are based on solid ground and years of hard work and effort to create the best in class components.
Forms in React have always been hard, often involving a ton of libraries - we decided to go for the latest React APIs
useFormState
as it brings simplicity and readability. The code should feel familiar to developers using the latest React APIs in NextJS.Zod is one of the best schema validation libraries out there, providing common validations and the ability to validate and parse complex and even nested structures. Infer allows developers to infer the TypeScript type from a Zod Schema.
OpenAPI-fetch is an ultra-slim and performant wrapper for fetch, enabling type-safe usage of API endpoints. Use Swashbuckle CLI to generate a swagger.json when building the WebApi, and use openapi-typescript CLI to generate a TypeScript definition file that can be used for the fetch API.
WebApp.esproj
file enabling web development in Rider and Visual Studio..esproj
is the new project config and will be replacing.njsproj
filesApi
typings, creating a generated typings file to be used by the API clientopenapi-fetch
to call theApi
useFormState
APIs. This API is part of NextJS v14server actions
and an official to be React API for handling form datauseFormState
andzod
Finally, update the GitHub workflow to install Bun and node modules, and ensure that the WebApi can generate the TypeScript type definition in the GitHub runner.
Checklist