Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions codegen/sams/generate-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ createClient({
patch: {
schemas: {
// _embedded (team1/team2) is not in the upstream spec — injected here based on actual API responses.
// results: null when no match has been played; referees: null when none assigned.
// NOTE: hey-api no longer respects nullable:true on $ref fields — must use explicit anyOf with null instead.
// results: null when no match has been played; referees: null when none assigned;
// team1Mvp/team2Mvp: null when no MVP is assigned (typical for unplayed matches).
// NOTE: hey-api no longer respects nullable:true on $ref fields — must use explicit allOf+nullable instead.
// date.format corrected to "date" (upstream uses "date-time" which generates wrong Zod type).
CompetitionMatchDto: (schema) => {
if (schema.properties) {
Expand Down Expand Up @@ -74,9 +75,12 @@ createClient({
case "results":
case "referees":
case "location":
case "team1Mvp":
case "team2Mvp":
// hey-api silently drops nullable:true when paired with $ref — wrap in allOf
// so nullable:true is on a schema object (not a $ref), which the generator
// correctly converts to z.union([zType, z.null()]).
// team1Mvp/team2Mvp are null when no MVP is assigned (common for unplayed matches).
schema.properties[key] = { allOf: [property], nullable: true };
break;
default:
Expand Down Expand Up @@ -124,9 +128,12 @@ createClient({
case "results":
case "referees":
case "location":
case "team1Mvp":
case "team2Mvp":
// hey-api silently drops nullable:true when paired with $ref — wrap in allOf
// so nullable:true is on a schema object (not a $ref), which the generator
// correctly converts to z.union([zType, z.null()]).
// team1Mvp/team2Mvp are null when no MVP is assigned (common for unplayed matches).
schema.properties[key] = { allOf: [property], nullable: true };
break;
default:
Expand Down
32 changes: 24 additions & 8 deletions codegen/sams/generated/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -5863,11 +5863,19 @@
"nullable": true
},
"team1Mvp": {
"$ref": "#/components/schemas/MostValuablePlayerDto",
"allOf": [
{
"$ref": "#/components/schemas/MostValuablePlayerDto"
}
],
"nullable": true
},
"team2Mvp": {
"$ref": "#/components/schemas/MostValuablePlayerDto",
"allOf": [
{
"$ref": "#/components/schemas/MostValuablePlayerDto"
}
],
"nullable": true
},
"matchGroupUuid": {
Expand All @@ -5878,11 +5886,11 @@
"type": "string",
"nullable": true
},
"indefinitelyRescheduled": {
"delayPossible": {
"type": "boolean",
"nullable": true
},
"delayPossible": {
"indefinitelyRescheduled": {
"type": "boolean",
"nullable": true
}
Expand Down Expand Up @@ -6281,11 +6289,19 @@
"nullable": true
},
"team1Mvp": {
"$ref": "#/components/schemas/MostValuablePlayerDto",
"allOf": [
{
"$ref": "#/components/schemas/MostValuablePlayerDto"
}
],
"nullable": true
},
"team2Mvp": {
"$ref": "#/components/schemas/MostValuablePlayerDto",
"allOf": [
{
"$ref": "#/components/schemas/MostValuablePlayerDto"
}
],
"nullable": true
},
"matchDayUuid": {
Expand All @@ -6296,11 +6312,11 @@
"type": "string",
"nullable": true
},
"indefinitelyRescheduled": {
"delayPossible": {
"type": "boolean",
"nullable": true
},
"delayPossible": {
"indefinitelyRescheduled": {
"type": "boolean",
"nullable": true
}
Expand Down
12 changes: 6 additions & 6 deletions codegen/sams/generated/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,12 @@ export type CompetitionMatchDto = {
team1Description?: string | null;
team2Description?: string | null;
results?: VolleyballMatchResultsDto | null;
team1Mvp?: MostValuablePlayerDto;
team2Mvp?: MostValuablePlayerDto;
team1Mvp?: MostValuablePlayerDto | null;
team2Mvp?: MostValuablePlayerDto | null;
matchGroupUuid?: string | null;
competitionUuid?: string | null;
indefinitelyRescheduled?: boolean | null;
delayPossible?: boolean | null;
indefinitelyRescheduled?: boolean | null;
};

export type CompetitionMatchPage = {
Expand Down Expand Up @@ -746,12 +746,12 @@ export type LeagueMatchDto = {
team1Description?: string | null;
team2Description?: string | null;
results?: VolleyballMatchResultsDto | null;
team1Mvp?: MostValuablePlayerDto;
team2Mvp?: MostValuablePlayerDto;
team1Mvp?: MostValuablePlayerDto | null;
team2Mvp?: MostValuablePlayerDto | null;
matchDayUuid?: string | null;
leagueUuid?: string | null;
indefinitelyRescheduled?: boolean | null;
delayPossible?: boolean | null;
indefinitelyRescheduled?: boolean | null;
};

export type LeagueMatchPage = {
Expand Down
12 changes: 6 additions & 6 deletions codegen/sams/generated/zod.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,12 @@ export const zCompetitionMatchDto = z.object({
team1Description: z.string().nullish(),
team2Description: z.string().nullish(),
results: zVolleyballMatchResultsDto.nullish(),
team1Mvp: zMostValuablePlayerDto.optional(),
team2Mvp: zMostValuablePlayerDto.optional(),
team1Mvp: zMostValuablePlayerDto.nullish(),
team2Mvp: zMostValuablePlayerDto.nullish(),
matchGroupUuid: z.string().nullish(),
competitionUuid: z.string().nullish(),
indefinitelyRescheduled: z.boolean().nullish(),
delayPossible: z.boolean().nullish(),
indefinitelyRescheduled: z.boolean().nullish(),
});

export const zCompetitionMatchPage = z.object({
Expand Down Expand Up @@ -933,12 +933,12 @@ export const zLeagueMatchDto = z.object({
team1Description: z.string().nullish(),
team2Description: z.string().nullish(),
results: zVolleyballMatchResultsDto.nullish(),
team1Mvp: zMostValuablePlayerDto.optional(),
team2Mvp: zMostValuablePlayerDto.optional(),
team1Mvp: zMostValuablePlayerDto.nullish(),
team2Mvp: zMostValuablePlayerDto.nullish(),
matchDayUuid: z.string().nullish(),
leagueUuid: z.string().nullish(),
indefinitelyRescheduled: z.boolean().nullish(),
delayPossible: z.boolean().nullish(),
indefinitelyRescheduled: z.boolean().nullish(),
});

export const zLeagueMatchPage = z.object({
Expand Down
Loading