Skip to content

Conversation

@daball
Copy link

@daball daball commented Nov 19, 2025

Description

NSwag generates double types when number is provided. Seerr service returns 400 Bad Request when decimal numbers are sent from HttpClient. This fix changes most number types to integer types in seerr-api.yml, which can be used to generate NSwag API clients which after the change generate int types versus double types in C#.

Screenshot (if UI-related)

N/A: Not UI related.

To-Dos

  • I mostly used the find and replace tool in VS Code, some of it was edited by hand, some of it was generated in VS Code using AI auto-completion after it noticed what I was doing. I did review each line carefully before committing to my branch.
  • Successfully built using pnpm build via Podman Compose on Windows 11. I was able to run, compile the pages, configure the Seerr service, connect to Jellyfin service, sync libraries, and perform all normal tasks following this commit.
  • N/A: Translation keys pnpm i18n:extract
  • N/A: Database migration (if required)

Issues Fixed or Closed

N/A: I didn't see any open issues.

@daball daball requested a review from a team as a code owner November 19, 2025 18:39
@0xSysR3ll
Copy link
Contributor

0xSysR3ll commented Nov 19, 2025

Would be preferable to make another separate PR for the schemas declarations - will be easier to review :)

@daball
Copy link
Author

daball commented Nov 20, 2025

bug: paths: /settings/cache: get: responses: '200': dnsCache: properties: stats: properties: hitRate should be 'number' and not 'integer', rates such as hitRate are fractional

@daball daball force-pushed the fix-openapi-spec branch 2 times, most recently from d00a53a to 28df2e3 Compare November 21, 2025 06:23
@daball daball changed the title fix: most number types should be integer types in seerr-api.yml fix: most number types should be integer types in seerr-api.yml, and 46 additional commits; 47 commits to seerr-api.yml Nov 21, 2025
@daball
Copy link
Author

daball commented Nov 21, 2025

NSwag is no longer generating Anonymous#, Response#, and Data# classes. There were many opportunities to consolidate the number of classes by reusing similar classes and to destructure complex object schemas into flatter schemas. And many good candidates for integer types have been converted from number types (and in one case changed back).

I fixed a few unidentified bugs, particularly in commits:

  • 839d658 fix: most number types should be integer types in seerr-api.yml
  • 5b46f1d fix: fix semantic error at paths./settings/cache.get.responses.200.content.application/json.schema.properties.dnsCache.properties.entries, schemas with 'type: array', require a sibling 'items: ' field, resolved with refactor, introduced items: field and changed additionalProperties to properties
  • 5b46f1d fix: hitRate is a number, not an integer (fixing my own mistake, the one I changed back to number)
  • b43241f fix: change paths: /settings/network: get: responses: '200': content: application/json: schema: $ref: should be '#/components/schemas/NetworkSettings' instead of '#/components/schemas/MainSettings'
  • 5df773c fix: WatchProviders named schema should be WatchProvider and should not be an array based on the usage from MovieDetails and the TvDetails named schemas, which are already declaring the array in each schema
  • c39c8da fix: /user/{userId}/pushSubscriptions endpoint returns an array of PushSubscription
  • 9c643dc fix: added missing mediaType field to Watchlist
  • 1d9f50d fix: added missing pageSize to PageInfo named schema
  • fc90017 fix: /tv/{tvId}/ratings endpoint missing audienceRating and audienceScore returned by service

I edited documentation in two places, particularly in commits:

  • a018caf docs: add example /auth/jellyfin to seerr-api.yml description
  • 1d9f50d docs: added descriptions to fields in PageInfo named schema

And everything else is refactoring unnamed schemas to named schemas with no change in function.

Perhaps at some point I will look at adding description fields to everything, but that's another branch and PR for another time. This one is ready for review.

@daball daball changed the title fix: most number types should be integer types in seerr-api.yml, and 46 additional commits; 47 commits to seerr-api.yml fix: most number types should be integer types in seerr-api.yml, and 47 additional commits; 48 commits to seerr-api.yml Nov 21, 2025
@daball
Copy link
Author

daball commented Nov 21, 2025

I had to make two more small changes. Collection was conflicting with .NET's Collection in generated source code from OpenApi Generator. I've now tested that the generated source code from both NSwag and OpenApi Generator source code builds. There was one line of generated source code that I had to fix pertaining to the example near:

paths:
  /settings/jobs/{jobId}/schedule:
...
                schedule:
                  type: string
                  example: '0 */5 * * * *'

This seems to confuse the OpenApi Generator logic and causes it to emit /* 0 */5 * * * * */ instead of /// 0 */5 * * * *, which I had to manually fix at each iteration. I consider this to be a problem with OpenApi Generator in this case.

@daball daball changed the title fix: most number types should be integer types in seerr-api.yml, and 47 additional commits; 48 commits to seerr-api.yml fix: most number types should be integer types in seerr-api.yml, and 48 additional commits; 49 commits to seerr-api.yml Nov 21, 2025
…s JellyfinSyncRequest (POST input) and JellyfinSyncStatus (GET/POST response)
…ings/jellyfin/library, and /settings/plex/library endpoints to use consolidated MediaLibrary, MediaLibrarySyncRequest, and MediaLibrarySyncStatus named schemas
…as MetadataTestRequest and MetadataTestResponse
…oints to use consolidated schemas ServarrTestRequest and ServarrTestResponse
…esponse, ImageCache, ImageCacheStats, DnsCache, DnsCacheStats, DnsCacheEntry, DnsCacheEntryAddresses, ApiCache, and ApiCacheStats

fix: hitRate is a number, not an integer
fix: fix semantic error at paths./settings/cache.get.responses.200.content.application/json.schema.properties.dnsCache.properties.entries, schemas with 'type: array', require a sibling 'items: ' field, resolved with refactor, introduced items: field and changed additionalProperties to properties
… application/json: schema: $ref: should be '#/components/schemas/NetworkSettings' instead of '#/components/schemas/MainSettings'
…ot be an array based on the usage from MovieDetails and the TvDetails named schemas, which are already declaring the array in each schema
…esetPasswordRequest and ResetPasswordResponse
…hemas ResetPasswordByGuidRequest and ResetPasswordResponse (same response as /auth/reset-password)
…sersResponse, CreateUserRequest, UpdateUsersRequest, in addition to User and PageInfo named schemas which were already present
…/pushSubscription/{endpoint} to use named schema PushSubscription

fix: /user/{userId}/pushSubscriptions endpoint returns an array of PushSubscription
…RequestsResponse and

changed /user/{userId}/quota to use named schema UserQuota and Quota
…ged /blacklist to use GetBlacklistResponse and PostBlacklistRequest (renamed from Blacklist)
refactor: changed /user/{userId}/watchlist to use WatchlistResponse and WatchlistItem named schema
…eInfo and UpdatePasswordRequest named schemas
…onSettings and UpdatePermissionSettingsRequest named schemas
…, updated /search/keyword to use KeywordSearchResponse named schema, updated /search/company to use CompanySearchResponse named schema
…related response named schemas to use PaginatedResponse named base schema for consistency, particularly, PaginatedSearchResponse (renamed from SearchResponse), PaginatedKeywordSearchResponse (renamed from KeywordSearchResponse), PaginatedCompanySearchResponse (renamed from CompanySearchResponse), PaginatedMoviesResponse (new), PaginatedDiscoverMoviesByGenreResponse (new), PaginatedDiscoverMoviesByLanguageResponse (new), PaginatedDiscoverMoviesByStudioResponse (new), PaginatedTvResponse (new), PaginatedDiscoverTvByGenreResponse (new), PaginatedDiscoverTvByLanguageResponse (new), PaginatedDiscoverTvByNetworkResponse (new), PaginatedDiscoverTrendingResponse (new), and PaginatedWatchlistResponse (renamed from WatchlistResponse); and, updated related endpoints to use relevant named schemas, particularly, /user/{userId}/watchlist, /search, /search/keyword, /search/company, /discover/movies, /discover/movies/genre/{genreId}, /discover/movies/language/{language}, /discover/movies/studio/{studioId}, /discover/movies/upcoming, /discover/tv, /discover/tv/language/{language}, /discover/tv/genre/{genreId}, /discover/tv/network/{networkId}, /discover/tv/upcoming, /discover/trending, /discover/keyword/{keywordId}/movies, /discover/watchlist, /movie/{movieId}/recommendations, /movie/{movieId}/similar, /tv/{tvId}/recommendations, and /tv/{tvId}/similar
docs: added descriptions to fields in PageInfo named schema
…updated /user/{userId}/requests and /request endpoints to use GetRequestsResponse; removed one newline above /issue/count, added one newline above security
…core returned by service

refactor: changed /movie/{movieId}/ratings to use Ratings named schema, /movie/{movieId}/ratingscombined to use CombinedMovieRatings, which uses Ratings and IMDbRatings name schemas, and /tv/{tvId}/ratings to use Ratings named schema
…suffix Page -> renamed GetUsersResponse to UsersPage, renamed GetBlacklistResponse to BlacklistPage, renamed GetRequestsResponse to MediaRequestsPage, updated /user to use UsersPage named schema, updated /user/{userId}/requests to use MediaRequestsPage named schema, updated /blacklist to use BlacklistPage named schema, and updated /request to use MediaRequestsPage named schema
…tchCombinedData named schema, which uses MediaWatchData named schema
…ng used in .NET Framework, avoids naming collision in generated clients
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