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

typescript: Replace scala-tsi with openapi-ts #628

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

jnatten
Copy link
Contributor

@jnatten jnatten commented Mar 19, 2025

Siden jeg føler vi har hatt så mye trøbbel med scalatsi så er dette et forslag på hvordan vi kan generere typer med openapi-ts ut i fra openapi spec'en vår istedenfor.

openapi-ts er ganske mye mer brukt enn scala-tsi så jeg har et lite håp om at vi skal støte på færre gotchas 😄

Lar denne stå som draft-pr frem til jeg har fikset alle typefeilene i frontend'ene siden det er potensielt ting som må endres her frem til det er i orden.

Jeg vet det ser ut som jeg har lagt til 19k linjer, men det er bare autogenerert openapi spec og typescript typer.
(openapi-ts tar med ganske mye mer data og automatisk genererer type for alle endepunktene våre).

Sånn i praksis så er det faktisk ~500 linjer færre med faktisk kode.

jnatten added 14 commits March 19, 2025 13:36
There was a bug with how the output type of `/audio-api/v1/audios/ids/`
were generated.

For some reason it is fixed when using an `Array` instead of a `List` as
the output.

Not sure of the reason, I assume it has to do with the recursive type of
`AudioMetaInformationDTO` + `SeriesDTO`, but couldn't get it to work in
a satisfying way, so lets just hack around it with `Array` for now.
Maybe we use enums for this maybe??
Since this package has remained unused, i assume it is not needed and we
don't want to maintain it if that is the case 😄
This patch replaces the automatic type generation that previously relied
on scala-tsi with openapi-ts (https://openapi-ts.dev/) based on
automatically generated openapi types from our apis.
Since we hopefully can rely on openapi-ts and our openapi spec instead
of scala-tsi, lets remove all the scala-tsi specific code.
@jnatten jnatten requested review from a team and removed request for a team March 19, 2025 12:46
Copy link
Member

Choose a reason for hiding this comment

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

Har ikkje tenkt på at vi ikkje har typer for denne!

@@ -0,0 +1,19 @@

Copy link
Member

Choose a reason for hiding this comment

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

Veldig pirk, men går det an å få vekk tom linje her?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Det burde være mulig!

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.

2 participants