Skip to content

feat(types): better additional properties typing - #42

Merged
nfroidure merged 1 commit into
mainfrom
feat/better_additional_properties_typing
Jun 30, 2026
Merged

nfroidure merged 1 commit into
mainfrom
feat/better_additional_properties_typing

Conversation

@nfroidure

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves how the JSON Schema → TypeScript generator types object index signatures by deriving the value type from additionalProperties, and it updates the OpenAPI fixture + snapshots to reflect the new output.

Changes:

  • Derive the index-signature value type from schema.additionalProperties (when it’s a schema) instead of always unknown.
  • Attempt to derive the index-signature key type from schema.propertyNames (new behavior).
  • Update fixture (fixtures/openapi/diagrams.json) and Jest snapshots to match the newly generated types.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/utils/jsonSchema.ts Updates object index-signature generation to use typed additionalProperties (and propertyNames) results.
src/snapshots/index.test.ts.snap Updates expected generated .d.ts output for changed index-signature typing.
fixtures/openapi/diagrams.json Adjusts the fixture schema to use propertyNames + additionalProperties for SensorModelHash.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/jsonSchema.ts Resolved
@nfroidure
nfroidure merged commit f8ff385 into main Jun 30, 2026
2 checks passed
@nfroidure
nfroidure deleted the feat/better_additional_properties_typing branch June 30, 2026 13:25
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