Skip to content
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

Generate resource types through open api schema #213

Open
jbpenrath opened this issue Feb 14, 2023 · 1 comment
Open

Generate resource types through open api schema #213

jbpenrath opened this issue Feb 14, 2023 · 1 comment
Assignees
Labels

Comments

@jbpenrath
Copy link
Member

jbpenrath commented Feb 14, 2023

Feature Request

Is your feature request related to a problem or unsupported use case? Please describe.
On Richie, we currently maintain typescript types for each Joanie resource consumed.
Each time, a resource serializer changes, we have to update types manually that is weird. In best case, it is just a time consuming chore, in the worst case, frontend developers works with wrong types...

Describe the solution you'd like
It exists package able to fetch an open api graph then generates typescript through it. It could be relevant to generate resource type and api endpoint types in this way.

Something interesting could be a cli in charge of retrieve the open api graph from a Joanie endpoint, generate all needed typescript types then store the output in a file to a location passed as argument.

Discovery, Documentation, Adoption, Migration Strategy

@rlecellier
Copy link
Collaborator

rlecellier commented Feb 15, 2023

Todo:

  • finalize useJoanieAddress and it's dependencies (ResourceRead, Write and List)
  • Test auto generated schema with JWT auth and token refresh
  • Improve backend schema generation by adding dedicated serializer for request / response.
  • Move TS client generation script in Joanie (ex: src/apiClientTs/package.json)
  • Create one hook for each autogénérated services in Richie.
  • Replace old hooks by new ones in Richie.

Nice to have:

Improve CI:

  • generate a static openapi schema using django management cmd in Joanie
  • add a CI job to check that openapi haven't changed

Improve CLI:

  • Move TS client generation in docker
  • Add CLI option in order to use others openapi cli options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants