glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
11.77k stars 1.04k forks source link

fix: Emit top level primitives for missing Languages #2552

Closed inferrinizzard closed 2 months ago

inferrinizzard commented 3 months ago

Description

Adds extra steps to emit top level Primitives in the following languages:

Motivation and Context

Fixes #2488

Input Data

{
    "id": "http://json-schema.org/geo",
    "$schema": "http://json-schema.org/draft-06/schema#",
    "description": "Top level primitive",
    "type": "number"
}

Previous Behaviour / Output

Previously had no output in types section, only converters

New Behaviour / Output

TypeScript:

/**
 * Top level primitive
 */
type Coordinate = number;

Kotlin:

/**
 * Top level primitive
 */
typealias Coordinate = Double

How Has This Been Tested?

Added new top-level-primitive.schema test

Screenshots (if appropriate):

N/a