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

front: fix typing in i18n-api-errors script #9782

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

emersion
Copy link
Member

See individual commits.

Prerequisite for switching to NPM.

scripts/i18n-api-errors.ts directly uses this package, but it was
missing from package.json. We were getting it by chance as a
transitive dependency.

Signed-off-by: Simon Ser <[email protected]>
@emersion emersion requested review from Yohh and SharglutDev November 19, 2024 14:08
@emersion emersion requested a review from a team as a code owner November 19, 2024 14:08
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Nov 19, 2024
@emersion emersion force-pushed the emr/fix-i18n-api-errors-typing branch from c6ce0d5 to f3dd0c2 Compare November 19, 2024 14:10
The openapi-types package is a peerDependency of
@apidevtools/swagger-parser. yarn doesn't install peerDependencies
by default. This is an issue because when openapi-types is missing,
TypeScript doesn't have any typing information about the values
returned by SwaggerParser.validate(), and assumes `any`. This results
in type checking getting completely disabled for code manipulating
the return value.

Indeed, after installing openapi-types, `yarn build` indicates
TypeScript errors in i18n-api-errors.ts.

Fix these errors by checking that the returned schema is OpenAPI
(as opposed to Swagger), and that `EditoastError` is a schema
object.

Signed-off-by: Simon Ser <[email protected]>
@emersion emersion force-pushed the emr/fix-i18n-api-errors-typing branch from f3dd0c2 to 6ebee0f Compare November 19, 2024 14:59
@emersion emersion added this pull request to the merge queue Nov 19, 2024
Merged via the queue into dev with commit b4a69f6 Nov 19, 2024
27 checks passed
@emersion emersion deleted the emr/fix-i18n-api-errors-typing branch November 19, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants