Skip to content

Add a JSON Schema for the configuration file - #971

Merged
czechboy0 merged 5 commits into
apple:mainfrom
nandan-varma:config-json-schema
Oct 14, 2026
Merged

czechboy0 merged 5 commits into
apple:mainfrom
nandan-varma:config-json-schema

Conversation

@nandan-varma

@nandan-varma nandan-varma commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Closes #970. Editor validation and autocomplete for the config file.

Modifications

  • Public/openapi-generator-config.schema.json: all keys, enums and the nested filter/typeOverrides objects; $id is the raw URL.
  • Test_ConfigJSONSchema: checks keys against CodingKeys, nested keys, enum values, and that a sample config built from the schema decodes as _UserConfig.
  • Docs: "Editor support" section in Configuring the generator.
  • Example and tutorial configs: added the # yaml-language-server: $schema=… line.
  • .licenseignore: added Public/*, since JSON can't carry the license header.

Result

Editors with the YAML language server validate and autocomplete the config. Adding a key or enum case without updating the schema fails CI.

Test Plan

  • New unit test and full swift test pass.
  • Manual check in VS Code: a typo'd key and a bad enum value are flagged.

Notes for reviewers:

  • Nested objects are stricter than the parser on purpose.
  • accessModifier allows fileprivate/private; the docs list only public, package and internal.
  • Nested keys rely on synthesized Codable.

@nandan-varma
nandan-varma marked this pull request as ready for review October 13, 2026 19:58
@czechboy0
czechboy0 self-requested a review October 14, 2026 06:09

@czechboy0 czechboy0 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.

Thanks @nandan-varma - I added a few more tweaks, looks great overall

@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 14, 2026
@czechboy0
czechboy0 enabled auto-merge (squash) October 14, 2026 12:41
@czechboy0
czechboy0 merged commit 0334c7f into apple:main Oct 14, 2026
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish a JSON Schema file for the configuration file

2 participants