feat: add competition group export format#55
Conversation
Add export format for competition groups following the same pattern as the existing league group export. Includes TypeScript interfaces, JSON schema, and sample data. Key differences from league group export: - Group references a Competition (with association, date range, registration period, coordinators) instead of Season + League - Leader is optional (nullable) on competition groups - Competition includes registrationPermission enum and coordinators list https://claude.ai/code/session_016HF5vDCksu4GiumToeZCKE
📝 WalkthroughWalkthroughAdds a new competition group export: JSON Schema, TypeScript interfaces, and a sample JSON payload describing competition metadata, teams, clubs, gyms, players, and aggregate statistics. Changes
Sequence Diagram(s)(Skipped — changes are schema, types, and sample data without multi-component runtime control flow.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
competition-group.schema.json (1)
346-362: Consider using"integer"instead of"number"for count fields.The statistics fields (
totalTeams,totalPlayers,totalClubs,totalGyms) represent counts and should be whole numbers. Using"type": "integer"would be more precise and prevent fractional values. The same applies toCompetitionGroupDetail.numberat line 182.♻️ Proposed fix for statistics
"CompetitionGroupStatistics": { "type": "object", "required": ["totalTeams", "totalPlayers", "totalClubs", "totalGyms"], "properties": { "totalTeams": { - "type": "number" + "type": "integer" }, "totalPlayers": { - "type": "number" + "type": "integer" }, "totalClubs": { - "type": "number" + "type": "integer" }, "totalGyms": { - "type": "number" + "type": "integer" } } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@competition-group.schema.json` around lines 346 - 362, The numeric statistics fields are counts and should be integers: update the JSON Schema for CompetitionGroupStatistics so each property totalTeams, totalPlayers, totalClubs, and totalGyms uses "type": "integer" (keep the required array unchanged), and likewise change CompetitionGroupDetail.number to "type": "integer" so the schema enforces whole-number counts rather than allowing fractional values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@competition-group.schema.json`:
- Around line 204-243: The JSON Schema for the Person object is missing "gender"
in its required array, causing a mismatch with the TypeScript Person interface;
update the Person schema's required list to include "gender" so the required
array contains
["id","firstName","lastName","dateOfBirth","uciCode","nationality","clubId","gender"]
ensuring the schema's required fields (refer to the Person object, its
"properties" block, and the existing required array) match the TypeScript
interface.
- Around line 244-263: The JSON Schema for PreferredMatchdayDate is missing
gymId in the required array despite the TypeScript interface requiring gymId
(can be null); update the PreferredMatchdayDate schema by adding "gymId" to the
required list so the property must be present (keeping its type as
["string","null"] and format "uuid") to match the TypeScript interface.
In `@samples/competition-group-sample.json`:
- Line 3: The sample uses a prefixed ID
("cg-a1b2c3d4-e5f6-7890-abcd-ef1234567890") that violates the schema's
"format":"uuid" constraint; update the "id" value in
samples/competition-group-sample.json to a valid UUID string (e.g.,
"a1b2c3d4-e5f6-7890-abcd-ef1234567890") or, if prefixed IDs are intentional,
remove or relax the "format":"uuid" constraint in the schema; target the "id"
field in the sample (and any other sample IDs) or the schema's UUID constraint
accordingly.
---
Nitpick comments:
In `@competition-group.schema.json`:
- Around line 346-362: The numeric statistics fields are counts and should be
integers: update the JSON Schema for CompetitionGroupStatistics so each property
totalTeams, totalPlayers, totalClubs, and totalGyms uses "type": "integer" (keep
the required array unchanged), and likewise change CompetitionGroupDetail.number
to "type": "integer" so the schema enforces whole-number counts rather than
allowing fractional values.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
competition-group.schema.jsonsamples/competition-group-sample.jsonsrc/export/competition-group.ts
- Add "gender" to Person required fields in JSON schema - Add "gymId" to PreferredMatchdayDate required fields in JSON schema - Use "integer" type instead of "number" for count and numeric fields (CompetitionGroupStatistics, CompetitionGroupDetail.number, minAge, maxAge) - Fix sample data UUIDs: remove prefixes (cg-, comp-, cl-, etc.) to comply with the "format": "uuid" schema constraint https://claude.ai/code/session_016HF5vDCksu4GiumToeZCKE
There was a problem hiding this comment.
🧹 Nitpick comments (1)
competition-group.schema.json (1)
204-227: Previous review comments addressed; consider adding enum validation forgender.The
genderfield is now correctly included in therequiredarray (addressing the previous review feedback). However, the field is defined as a plain string without constraints. Ifgenderuses a controlled vocabulary (e.g., "m", "f", "d" for diverse), consider adding anenumto improve validation.♻️ Optional: Add enum constraint for gender
"gender": { - "type": "string" + "type": "string", + "enum": ["m", "f", "d"] },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@competition-group.schema.json` around lines 204 - 227, The Person schema's gender property is currently an unconstrained string; update Person.properties.gender to include an enum with the allowed values (e.g., "m", "f", "d" or whatever controlled vocabulary your domain uses) so validation enforces only those values, and ensure the enum matches any existing consumers/users of Person (update docs/tests if needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@competition-group.schema.json`:
- Around line 204-227: The Person schema's gender property is currently an
unconstrained string; update Person.properties.gender to include an enum with
the allowed values (e.g., "m", "f", "d" or whatever controlled vocabulary your
domain uses) so validation enforces only those values, and ensure the enum
matches any existing consumers/users of Person (update docs/tests if needed).
Add export format for competition groups following the same pattern as
the existing league group export. Includes TypeScript interfaces, JSON
schema, and sample data.
Key differences from league group export:
registration period, coordinators) instead of Season + League
https://claude.ai/code/session_016HF5vDCksu4GiumToeZCKE
Summary by CodeRabbit