Skip to content

Fix skills.sh.json to match the skills.sh schema - #255

Open
reidbaker-agent wants to merge 1 commit into
flutter:mainfrom
reidbaker-agent:fix-253-groupings
Open

reidbaker-agent wants to merge 1 commit into
flutter:mainfrom
reidbaker-agent:fix-253-groupings

Conversation

@reidbaker-agent

Copy link
Copy Markdown
Member

Fixes #253

skills.sh.json used groups, but the skills.sh schema expects groupings and sets additionalProperties: false. Its $schema URL also returned a 404. This change:

  • Renames groups to groupings.
  • Points $schema at https://skills.sh/schemas/skills.sh.schema.json.
  • Updates tool/generator/test/lint_skills_test.dart to read groupings, expect the new URL, and fail on any top-level or group key the schema does not allow.
  • Updates the generator README and fixes a test comment that listed hidden as a valid notGrouped value (the schema allows only top and bottom).

No other mismatches: notGrouped: "bottom" and every group's title, description and skills match the schema.

Validation against the live schema with Python jsonschema (Draft 2020-12, as the schema declares):

$ python3 validate.py skills.sh.json
valid
$ python3 validate.py skills.sh.json   # before this change
ERROR: Additional properties are not allowed ('groups' was unexpected)
ERROR: 'groupings' is a required property
invalid

dart analyze --fatal-infos, dart format and dart test pass in tool/generator.

Rename groups to groupings and point $schema at the live schema URL.
Update the lint test and generator README to match, and check that the
file only uses keys the schema allows.

Fixes flutter#253

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the schema URL and renames the 'groups' property to 'groupings' in 'skills.sh.json' to align with the latest schema definition. Corresponding updates are made to the generator's documentation and the lint tests, which now also validate that only allowed keys are present. The review feedback suggests enhancing the test assertions by explicitly verifying the types of the 'groupings' list and the required 'skills' property to prevent cryptic type errors during parsing.

Comment on lines +103 to 104
final groups = (skillsShJson['groupings'] as List<Object?>)
.cast<Map<String, Object?>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To prevent cryptic TypeErrors when parsing skills.sh.json (e.g., if groupings is missing, null, or not a list of maps), it is safer to explicitly assert the type of groupings and its elements using expect before casting.

Suggested change
final groups = (skillsShJson['groupings'] as List<Object?>)
.cast<Map<String, Object?>>();
expect(skillsShJson['groupings'], isA<List<Object?>>());
final groupingsList = skillsShJson['groupings'] as List<Object?>;
expect(groupingsList, everyElement(isA<Map<String, Object?>>()));
final groups = groupingsList.cast<Map<String, Object?>>();

Comment on lines +108 to +111
expect(
group.keys,
everyElement(isIn(['title', 'description', 'skills'])),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While we validate that the keys of each group only contain allowed properties, we should also explicitly assert that the required skills property is present and is a list. This provides a clear failure message if a group is missing its skills list, rather than throwing a TypeError later in _collectUniqueGroupedSkills.

Suggested change
expect(
group.keys,
everyElement(isIn(['title', 'description', 'skills'])),
);
expect(
group.keys,
everyElement(isIn(['title', 'description', 'skills'])),
);
expect(group['skills'], isA<List<Object?>>());

@reidbaker reidbaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import 'package:test/test.dart';

const String _expectedSkillsShSchema =
'https://skills.sh/schemas/skills.sh.json';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best I can tell this url did not exist.

@reidbaker
reidbaker requested review from johnpryan and kevmoo October 30, 2026 15:21
@reidbaker

Copy link
Copy Markdown
Member

@johnpryan would you like me to wait on your reviews for this repo?

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.

skills.sh.json uses groups instead of groupings, so skills.sh shows no groups

3 participants

⌂ Proxy