-
Notifications
You must be signed in to change notification settings - Fork 38
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
Added openapi-typescript and openapi-typescript-fetch #28
Added openapi-typescript and openapi-typescript-fetch #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good. Just one suggestion to put typings.ts in a folder dedicated for interfaces.
packages/frontend/package.json
Outdated
@@ -26,7 +28,8 @@ | |||
"start": "react-scripts start", | |||
"build": "react-scripts build", | |||
"test": "react-scripts test", | |||
"eject": "react-scripts eject" | |||
"eject": "react-scripts eject", | |||
"generate": "npx openapi-typescript http://localhost:4200/api-json --output ./src/typing.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GlockTian should we put typing.ts inside a folder that is dedicated for interfaces. i.e ./src/types/typing.ts Just in case if we have more interfaces later in the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also we should probably name it something a bit more descriptive. Maybe api-schema.ts
?
I would also like to change the command from generate
to something more descriptive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe generate-api-types
. bit wordy though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate:api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about generate-types:api
I feel like just generate isn't descriptive enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes it sound as if the api is generated from here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate:api-types
Idea being if we ever add other generators then the script can just be called with something like run-p generate:*
to run all scripts in the glob
Looks good, I've got changes to the useApi hook that will use some typescript magic to use this stuff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GlockTian you ticked that you have added documentation but I don't see any?
oh true, mistakes. will add them to the wiki |
and readme please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Nice, should I do a squash & merge? |
Yes |
Description
Allowing a file containing all type definitions for our API to be generated through
yarn run generate
.Dependency added:
Fixes/resolves #22
Screenshots
Please include any screenshots or media that illustrates the changes made
Type of change
Please delete options that are not relevant.
Checklist:
Leave blank if not applicable