From b4bcbb5bb70d20424cb24b50ba47cd22a567698a Mon Sep 17 00:00:00 2001 From: Michal Date: Wed, 12 Aug 2026 19:13:45 +0200 Subject: [PATCH] fix: specify smart list filter ranges types for proper Kotlin generation and parsing --- .../request/smartListFiltersSchema.ts | 21 ++++++++++--------- .../response/listMetadataResponseSchema.ts | 2 +- .../response/favoritedMoviesResponseSchema.ts | 2 +- .../response/favoritedShowsResponseSchema.ts | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts b/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts index 82c9533..9a64ebc 100644 --- a/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts +++ b/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts @@ -1,7 +1,8 @@ -import { z } from '../z.ts'; +import { float, z } from '../z.ts'; const list = z.array(z.string()); -const range = z.array(z.number()).max(2); +const intRange = z.array(z.number().int()).max(2); +const floatRange = z.array(float(z.number())).min(2); // Applies to the include arm only: 'and' requires every value, 'or' (default) // any of them. Exclusion is always "carries none of". @@ -20,14 +21,14 @@ export const smartListFiltersSchema = z.object({ keywords: list.optional(), keywords_operator: operator.optional(), watchnow: list.optional(), - years: range.optional(), - ratings: range.optional(), - runtimes: range.optional(), - imdb_ratings: range.optional(), - rt_meters: range.optional(), - rt_user_meters: range.optional(), - letterboxd_ratings: range.optional(), - mal_ratings: range.optional(), + years: intRange.optional(), + ratings: intRange.optional(), + runtimes: intRange.optional(), + imdb_ratings: floatRange.optional(), + rt_meters: intRange.optional(), + rt_user_meters: intRange.optional(), + letterboxd_ratings: floatRange.optional(), + mal_ratings: floatRange.optional(), ignore_watched: z.boolean().optional(), ignore_watchlisted: z.boolean().optional(), ignore_watching: z.boolean().optional(), diff --git a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts index 48a17df..b78cdad 100644 --- a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts @@ -5,5 +5,5 @@ export const listMetadataResponseSchema = z.object({ rank: z.number().int(), id: z.number().int(), listed_at: z.string().datetime(), - notes: z.string().nullish(), + notes: z.string().nullish() }); diff --git a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts index d7d343d..895eb21 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts @@ -6,5 +6,5 @@ export const favoritedMoviesResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), - rank: z.number().int(), + rank: z.number().int() }).merge(typedMovieResponseSchema); diff --git a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts index e9728ef..b9eea7b 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts @@ -6,5 +6,5 @@ export const favoritedShowsResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), - rank: z.number().int(), + rank: z.number().int() }).merge(typedShowResponseSchema);