Skip to content

Post-Processing Pipeline

Atlassian’s OpenAPI specs have known defects that would produce incorrect or unusable generated TypeScript. The post-processing pipeline fixes these before code generation runs.

Fetches the raw spec from developer.atlassian.com. Results are cached locally to avoid hitting Atlassian servers on every regeneration.

Parses the JSON spec and validates it is well-formed OpenAPI 3.x.

Transforms are functions that take the full spec and return a modified spec. Applied in order:

TransformWhat it fixes
fixErrorResponsesAdds missing 4xx/5xx response schemas
fixOneOfAnyOfFlattens broken oneOf/anyOf schemas
fixNullableFieldsAdds nullable: true where responses can be null
fixDeprecationsMarks deprecated endpoints consistently
fixCamelCaseRenames snake_case and kebab-case property names
sanitizeOperationIdsDeduplicates and sanitizes operationId values

Patches are precise JSON-patch operations targeting specific known defects:

// Example patch: fix a specific wrong type in jira-v3
{ op: 'replace', path: '/components/schemas/IssueBean/properties/id/type', value: 'string' }

The cleaned spec is written to packages/specs/src/cleaned/ and committed to git. This means the cleaned specs are versioned — you can see exactly what was changed between spec versions.

A human-readable diff summary is generated in packages/specs/src/diff/ showing what the pipeline changed. Useful for reviewing spec updates.

To fix a newly discovered spec defect:

  1. For a structural pattern — add a new transform function in packages/generator/src/pipeline/transforms/
  2. For a one-off defect — add a JSON patch entry in packages/generator/src/pipeline/patches/<spec-id>.ts
  3. Run pnpm run update-specs and verify the fix in the diff output
  4. Run pnpm run generate and verify the generated TypeScript is correct