Skip to content

feat: regenerated generated types#955

Open
Chisomchima wants to merge 1 commit into
masterfrom
DHIS2-21293-regenerate-generated-types
Open

feat: regenerated generated types#955
Chisomchima wants to merge 1 commit into
masterfrom
DHIS2-21293-regenerate-generated-types

Conversation

@Chisomchima
Copy link
Copy Markdown
Member

Regenerate generated types from DHIS2 2.43 API

Closes DHIS2-21293

Summary

Regenerates src/types/generated/models.ts from the DHIS2 stable-2-43-0 API using Birkbjo/dhis2-open-api-ts. The new file grows from ~10,981 to ~16,045 lines, reflecting the expanded API surface in 2.43.

All source files that depended on the old type shapes have been updated. yarn check-types passes with 0 errors and all 103 test suites pass.

Key API changes in DHIS2 2.43 that required code updates

Namespace enums → standalone enums

The generator no longer wraps per-model enums in TypeScript namespaces. All usages of the pattern ModelType.enumName.VALUE have been replaced with standalone enum imports:

Old New
DataElement.aggregationType AggregationType
DataElement.valueType ValueType
DataElement.domainType DataElementDomain
Category.dataDimensionType DataDimensionType
ProgramRuleVariable.programRuleVariableSourceType ProgramRuleVariableSourceType
ProgramRuleVariable.valueType ValueType
ProgramRuleAction.programRuleActionType ProgramRuleActionType
AnalyticsTableHook.phase AnalyticsTablePhase
AnalyticsTableHook.analyticsTableType AnalyticsTableType
AnalyticsTableHook.resourceTableType ResourceTableType
SqlView.type SqlViewType
SqlView.cacheStrategy CacheStrategy
Expression.missingValueStrategy MissingValueStrategy
ProgramNotificationTemplate.notificationTrigger NotificationTrigger
ProgramNotificationTemplate.notificationRecipient ProgramNotificationRecipient
DataSetNotificationTemplate.* DataSetNotificationTrigger, DataSetNotificationRecipient, SendStrategy
ValidationRule.operator Operator
ValidationRule.importance Importance
Program.programType ProgramType
AnalyticsPeriodBoundary.analyticsPeriodBoundaryType AnalyticsPeriodBoundaryType

Renamed or removed types

  • ProgramTrackedEntityAttribute removed — a local type is now defined in files that need it
  • SmsConfiguration removed — redefined locally in systemSettings.ts using the existing gateway types
  • IdentifiableObject changed from { id: string } (minimal) to a full model; useOnSubmit generic constraints updated to avoid breakage
  • ErrorReportLegacy removed — fixedModels.ts now defines ErrorReport inline
  • RelationshipConstraint.relationshipEntityRelationshipEntity
  • AttributeValues changed from Array<AttributeValue> to { empty: boolean }

Other notable changes

  • TRACKER_ASSOCIATE removed from ValueType; affected comparison in TrackedEntityAttributeFormFields replaced with false
  • DataInputPeriod.period is now optional with type { id: string } (no name field); null-checks added
  • Sharing no longer has external field; SharingSettings.external made optional
  • SystemSettings now exists in both generated and hand-written types; ambiguity resolved in models.ts via explicit re-export with an ESLint suppression comment

How to re-run the generation

cd /tmp && git clone https://github.com/Birkbjo/dhis2-open-api-ts.git
cd dhis2-open-api-ts && yarn install
yarn generate --url "https://play.im.dhis2.org/stable-2-43-0/api/openapi.json" --force
cp generated/models.ts <repo>/src/types/generated/models.ts

utility.ts and pickWithFieldFilters.ts in src/types/generated/ are hand-written and should not be overwritten.

Test plan

  • yarn check-types — 0 errors
  • yarn test — 103/103 suites pass
  • yarn format — no lint or formatting errors

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for dhis2-maintenance-app-beta ready!

Name Link
🔨 Latest commit ee58850
🔍 Latest deploy log https://app.netlify.com/projects/dhis2-maintenance-app-beta/deploys/6a1da086f700c30008a2832d
😎 Deploy Preview https://deploy-preview-955.maintenance-app-beta.netlify.dhis2.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 1, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
69 New issues
69 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

1 participant