← All case studies

Personal project

Copybook Converter

2026

Built and verified 2026-11-01 — REST API with Swagger docs, pinned to a stable Spring Boot release, 29/29 tests passing (owner's local mvn test run).

Technology

JavaSpring BootMavenJacksonSwagger / OpenAPI

Overview

A Spring Boot REST API that parses COBOL copybook definitions (PIC, OCCURS, VALUE, REDEFINES) and converts them into Java POJOs, a JSON Schema document, and a sample JSON object.

My role

  • Designed and built the parser, three generator services (Java POJO / JSON Schema / JSON object), and the REST API end to end.

Architecture

Spring Boot WAR application. A regex-based parser builds a field hierarchy from raw copybook text using a level-number stack. Three independent generator services walk that hierarchy to produce Java source, a JSON Schema document, and a sample JSON object. A single REST controller (five POST endpoints under /api/copybook, multipart file upload) wires them together, documented via springdoc-openapi/Swagger UI.

Engineering challenges

  • Mapping COBOL PIC clauses to Java and JSON types consistently across three independently-written generators — a review caught a real inconsistency (see Outcomes) that's since been fixed.
  • COBOL's REDEFINES clause (one field sharing storage with another) has no equivalent in Java or JSON Schema — resolved by surfacing the relationship as a comment/schema description rather than fabricating real aliasing.
  • This project previously had no working tests. Running the suite for the first time surfaced two real, previously-undiscovered bugs (see Outcomes) — a reminder that source review alone doesn't catch everything.

Testing & quality

Unit tests for the parser and all three generator services, plus controller tests for the happy path and the structured error response. 29/29 passing as of 2026-11-01 (owner's local mvn test run).

Outcomes & lessons

  • Found and fixed 2026-10-31: the parser could not actually process its own README example — an unindented top-level record line had its level number mistaken for a mainframe sequence number and stripped. Found only once the test suite was first run.
  • Found and fixed 2026-10-31: the JSON-object generator double-wrapped every primitive field nested inside a group, found only after the fix above let parsing succeed for the first time.
  • Fixed 2026-10-31: a COMP-3 decimal field (e.g. PIC S9(4)V99 COMP-3) previously typed inconsistently across the three generators (Double vs. integer/0) — now consistent (Double / number / 0.0) everywhere.
  • Fixed 2026-10-31: REDEFINES fields are surfaced via a comment in the generated Java source and a description in the generated JSON Schema, rather than silently treated as an ordinary unrelated field.