-
Notifications
You must be signed in to change notification settings - Fork 91
👽️(frontend) Generate typescript api client - winter 2023 #2142
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
base: master
Are you sure you want to change the base?
Conversation
29a7c08 to
bb4c252
Compare
rlecellier
left a comment
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.
Quick comment on missing element of Addresses endoints
bb4c252 to
450cef9
Compare
450cef9 to
7c6fe4a
Compare
|
|
||
| import type { Address } from './Address'; | ||
|
|
||
| export type PaginatedAddressList = { |
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.
doc: https://drf-spectacular.readthedocs.io/en/latest/faq.html#how-do-i-wrap-my-responses-my-endpoints-are-wrapped-in-a-generic-envelope
todo: try to use spectacular envelope in order to create a PaginatedSerialier
todo: try to use envelope into a custom pagination class https://www.django-rest-framework.org/api-guide/pagination/#custom-pagination-styles
7c6fe4a to
eecbfe5
Compare
| page?: number, | ||
| pageSize?: number, | ||
| productId?: string, | ||
| signatureState?: 'half_signed' | 'signed' | 'unsigned', |
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.
It would be nice to have :
enum SignatureStateEnum {
half_signed,
signed,
unsigned
}
// ...
signatureState?: SignatureStateEnum
a46fe84 to
1a38c6f
Compare
We'll implement a api client generated from joanie's openApi schema. The current client needs to change place.
We'll implement a api client generated from joanie's openApi schema. The current client's type factories needs to change place.
Add [email protected] to the projet this lib handle typescript api client generation from openapi schema
fcd2806 to
2d3a4c2
Compare
Generate typescript api client according to joanie openapi schema
on CoursesService and OrganizationService, a function get the id param twice.
Generated api client need's to handle joanie authentification
use generated Address type instead of legacy one
7125685 to
4781687
Compare
now that we've generated types and api client, we need to use them into our api hooks
9efc67a to
abefe25
Compare
Joanie's api client shouldn't be loaded on test that don't use it.
abefe25 to
3da710e
Compare
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.
Pull Request Overview
This PR updates the TypeScript API client generation and migrates all test and API references from the “joanie” naming to the “joanieLegacy” version, ensuring consistency with the current OpenAPI schema. Key changes include introducing a new local script for API client generation, updating package.json with a new generate script and dependency, and refactoring numerous test and component imports to use the legacy factories and API endpoints.
Reviewed Changes
Copilot reviewed 224 out of 225 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| generate_api_client_local.sh | New bash script to generate the API client from the OpenAPI schema |
| package.json | Added generate:api:client:local script and devDependency update |
| Multiple test and component files across the codebase | Updated import paths from factories/joanie and types/Joanie to joanieLegacy and api/joanie/gen for legacy support |
Comments suppressed due to low confidence (2)
src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx:47
- Confirm that replacing checkStatus with checkStatusLegacy conforms to the new API client behavior and that all downstream code consuming this behavior has been updated accordingly.
fetch('http://api.endpoint/orders/').then(checkStatusLegacy),
src/frontend/js/utils/test/factories/joanieLegacy.ts:163
- Verify that updating the AddressFactory to use AddressGenFactory is intentional and that all address-related data now correctly originates from the new API client.
address: AddressGenFactory().one(),
Purpose
Here the generated typescript client with the current joanie's openapi schema
TODO: