quicktypeJSONSchema does not persist generated code (JSON path does) #1056

Closed
opened 2026-08-13 05:44:02 +00:00 by spikerj · 1 comment
Owner

quicktypeJSON persists generatedCode / language / type name via saveData. quicktypeJSONSchema returns the SerializedRenderResult and does not call saveData.

Both live under the same "QUICKTYPE CORE METHODS (Enhanced with persistence)" section. A student who converts from JSON Schema then refreshes (or loadFromStorage) loses the generated types, while the JSON-sample path survives. The component cannot recover the last schema conversion from getCurrentData().

Fix: persist the same fields after a successful schema conversion (rawJson can be the schema string, or a dedicated field if schema vs sample must stay distinct).

Found by Wave 7 coverage (quick-type.service.leftovers.spec.ts).

`quicktypeJSON` persists `generatedCode` / language / type name via `saveData`. `quicktypeJSONSchema` returns the `SerializedRenderResult` and does **not** call `saveData`. Both live under the same "QUICKTYPE CORE METHODS (Enhanced with persistence)" section. A student who converts from JSON Schema then refreshes (or `loadFromStorage`) loses the generated types, while the JSON-sample path survives. The component cannot recover the last schema conversion from `getCurrentData()`. Fix: persist the same fields after a successful schema conversion (rawJson can be the schema string, or a dedicated field if schema vs sample must stay distinct). Found by Wave 7 coverage (`quick-type.service.leftovers.spec.ts`).
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). quicktypeJSONSchema persists generated code the same way the JSON path does. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). quicktypeJSONSchema persists generated code the same way the JSON path does. Closing.
Sign in to join this conversation.