diff --git a/head/schema-cplusplus/test/inputs/schema/pattern-properties.schema/default/quicktype.hpp b/head/schema-cplusplus/test/inputs/schema/pattern-properties.schema/default/quicktype.hpp
new file mode 100644
index 0000000..5832a8a
--- /dev/null
+++ b/head/schema-cplusplus/test/inputs/schema/pattern-properties.schema/default/quicktype.hpp
@@ -0,0 +1,151 @@
+//  To parse this JSON data, first install
+//
+//      json.hpp  https://github.com/nlohmann/json
+//
+//  Then include this file, and then do
+//
+//     TopLevel data = nlohmann::json::parse(jsonString);
+
+#pragma once
+
+#include <optional>
+#include "json.hpp"
+
+#include <optional>
+#include <stdexcept>
+#include <regex>
+
+#ifndef NLOHMANN_OPT_HELPER
+#define NLOHMANN_OPT_HELPER
+namespace nlohmann {
+    template <typename T>
+    struct adl_serializer<std::shared_ptr<T>> {
+        static void to_json(json & j, const std::shared_ptr<T> & opt) {
+            if (!opt) j = nullptr; else j = *opt;
+        }
+
+        static std::shared_ptr<T> from_json(const json & j) {
+            if (j.is_null()) return std::shared_ptr<T>(); else return std::make_shared<T>(j.get<T>());
+        }
+    };
+    template <typename T>
+    struct adl_serializer<std::optional<T>> {
+        static void to_json(json & j, const std::optional<T> & opt) {
+            if (!opt) j = nullptr; else j = *opt;
+        }
+
+        static std::optional<T> from_json(const json & j) {
+            if (j.is_null()) return std::optional<T>(); else return std::make_optional<T>(j.get<T>());
+        }
+    };
+}
+#endif
+
+namespace quicktype {
+    using nlohmann::json;
+
+    #ifndef NLOHMANN_UNTYPED_quicktype_HELPER
+    #define NLOHMANN_UNTYPED_quicktype_HELPER
+    inline json get_untyped(const json & j, const char * property) {
+        if (j.find(property) != j.end()) {
+            return j.at(property).get<json>();
+        }
+        return json();
+    }
+
+    inline json get_untyped(const json & j, std::string property) {
+        return get_untyped(j, property.data());
+    }
+    #endif
+
+    #ifndef NLOHMANN_OPTIONAL_quicktype_HELPER
+    #define NLOHMANN_OPTIONAL_quicktype_HELPER
+    template <typename T>
+    inline std::shared_ptr<T> get_heap_optional(const json & j, const char * property) {
+        auto it = j.find(property);
+        if (it != j.end() && !it->is_null()) {
+            return j.at(property).get<std::shared_ptr<T>>();
+        }
+        return std::shared_ptr<T>();
+    }
+
+    template <typename T>
+    inline std::shared_ptr<T> get_heap_optional(const json & j, std::string property) {
+        return get_heap_optional<T>(j, property.data());
+    }
+    template <typename T>
+    inline std::optional<T> get_stack_optional(const json & j, const char * property) {
+        auto it = j.find(property);
+        if (it != j.end() && !it->is_null()) {
+            return j.at(property).get<std::optional<T>>();
+        }
+        return std::optional<T>();
+    }
+
+    template <typename T>
+    inline std::optional<T> get_stack_optional(const json & j, std::string property) {
+        return get_stack_optional<T>(j, property.data());
+    }
+    #endif
+
+    class Alternator {
+        public:
+        Alternator() = default;
+        virtual ~Alternator() = default;
+
+        private:
+        std::optional<std::string> name;
+        std::optional<double> voltage;
+
+        public:
+        const std::optional<std::string> & get_name() const { return name; }
+        std::optional<std::string> & get_mutable_name() { return name; }
+        void set_name(const std::optional<std::string> & value) { this->name = value; }
+
+        const std::optional<double> & get_voltage() const { return voltage; }
+        std::optional<double> & get_mutable_voltage() { return voltage; }
+        void set_voltage(const std::optional<double> & value) { this->voltage = value; }
+    };
+
+    class TopLevel {
+        public:
+        TopLevel() = default;
+        virtual ~TopLevel() = default;
+
+        private:
+        std::optional<std::map<std::string, Alternator>> alternators;
+
+        public:
+        const std::optional<std::map<std::string, Alternator>> & get_alternators() const { return alternators; }
+        std::optional<std::map<std::string, Alternator>> & get_mutable_alternators() { return alternators; }
+        void set_alternators(const std::optional<std::map<std::string, Alternator>> & value) { this->alternators = value; }
+    };
+}
+
+namespace quicktype {
+    void from_json(const json & j, Alternator & x);
+    void to_json(json & j, const Alternator & x);
+
+    void from_json(const json & j, TopLevel & x);
+    void to_json(json & j, const TopLevel & x);
+
+    inline void from_json(const json & j, Alternator& x) {
+        x.set_name(get_stack_optional<std::string>(j, "name"));
+        x.set_voltage(get_stack_optional<double>(j, "voltage"));
+    }
+
+    inline void to_json(json & j, const Alternator & x) {
+        j = json::object();
+        j["name"] = x.get_name();
+        j["voltage"] = x.get_voltage();
+    }
+
+    inline void from_json(const json & j, TopLevel& x) {
+        x.set_alternators(get_stack_optional<std::map<std::string, Alternator>>(j, "alternators"));
+    }
+
+    inline void to_json(json & j, const TopLevel & x) {
+        j = json::object();
+        j["alternators"] = x.get_alternators();
+    }
+}
diff --git a/head/schema-csharp/test/inputs/schema/pattern-properties.schema/default/QuickType.cs b/head/schema-csharp/test/inputs/schema/pattern-properties.schema/default/QuickType.cs
new file mode 100644
index 0000000..69d6b21
--- /dev/null
+++ b/head/schema-csharp/test/inputs/schema/pattern-properties.schema/default/QuickType.cs
@@ -0,0 +1,70 @@
+// <auto-generated />
+//
+// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
+//
+//    using QuickType;
+//
+//    var topLevel = TopLevel.FromJson(jsonString);
+#nullable enable
+#pragma warning disable CS8618
+#pragma warning disable CS8601
+#pragma warning disable CS8602
+#pragma warning disable CS8603
+#pragma warning disable CS8604
+#pragma warning disable CS8625
+#pragma warning disable CS8765
+
+namespace QuickType
+{
+    using System;
+    using System.Collections.Generic;
+
+    using System.Globalization;
+    using Newtonsoft.Json;
+    using Newtonsoft.Json.Converters;
+
+    public partial class TopLevel
+    {
+        [JsonProperty("alternators", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
+        public Dictionary<string, Alternator>? Alternators { get; set; }
+    }
+
+    public partial class Alternator
+    {
+        [JsonProperty("name", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
+        public string? Name { get; set; }
+
+        [JsonProperty("voltage", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
+        public double? Voltage { get; set; }
+    }
+
+    public partial class TopLevel
+    {
+        public static TopLevel FromJson(string json) => JsonConvert.DeserializeObject<TopLevel>(json, QuickType.Converter.Settings);
+    }
+
+    public static partial class Serialize
+    {
+        public static string ToJson(this TopLevel self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);
+    }
+
+    internal static partial class Converter
+    {
+        public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
+        {
+            MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
+            DateParseHandling = DateParseHandling.None,
+            Converters =
+            {
+                new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
+            },
+        };
+    }
+}
+#pragma warning restore CS8618
+#pragma warning restore CS8601
+#pragma warning restore CS8602
+#pragma warning restore CS8603
+#pragma warning restore CS8604
+#pragma warning restore CS8625
+#pragma warning restore CS8765
diff --git a/head/schema-csharp-SystemTextJson/test/inputs/schema/pattern-properties.schema/default/QuickType.cs b/head/schema-csharp-SystemTextJson/test/inputs/schema/pattern-properties.schema/default/QuickType.cs
new file mode 100644
index 0000000..c2f6d80
--- /dev/null
+++ b/head/schema-csharp-SystemTextJson/test/inputs/schema/pattern-properties.schema/default/QuickType.cs
@@ -0,0 +1,177 @@
+// <auto-generated />
+//
+// To parse this JSON data, add NuGet 'System.Text.Json' then do:
+//
+//    using QuickType;
+//
+//    var topLevel = TopLevel.FromJson(jsonString);
+#nullable enable
+#pragma warning disable CS8618
+#pragma warning disable CS8601
+#pragma warning disable CS8602
+#pragma warning disable CS8603
+
+namespace QuickType
+{
+    using System;
+    using System.Collections.Generic;
+
+    using System.Text.Json;
+    using System.Text.Json.Serialization;
+    using System.Globalization;
+
+    public partial class TopLevel
+    {
+        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+        [JsonPropertyName("alternators")]
+        public Dictionary<string, Alternator>? Alternators { get; set; }
+    }
+
+    public partial class Alternator
+    {
+        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+        [JsonPropertyName("name")]
+        public string? Name { get; set; }
+
+        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+        [JsonPropertyName("voltage")]
+        public double? Voltage { get; set; }
+    }
+
+    public partial class TopLevel
+    {
+        public static TopLevel FromJson(string json) => JsonSerializer.Deserialize<TopLevel>(json, QuickType.Converter.Settings);
+    }
+
+    public static partial class Serialize
+    {
+        public static string ToJson(this TopLevel self) => JsonSerializer.Serialize(self, QuickType.Converter.Settings);
+    }
+
+    internal static partial class Converter
+    {
+        public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
+        {
+            Converters =
+            {
+                new DateOnlyConverter(),
+                new TimeOnlyConverter(),
+                IsoDateTimeOffsetConverter.Singleton
+            },
+        };
+    }
+    
+    public class DateOnlyConverter : JsonConverter<DateOnly>
+    {
+        private readonly string serializationFormat;
+        public DateOnlyConverter() : this(null) { }
+
+        public DateOnlyConverter(string? serializationFormat)
+        {
+                this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
+        }
+
+        public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+        {
+                var value = reader.GetString();
+                return DateOnly.Parse(value!);
+        }
+
+        public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
+                => writer.WriteStringValue(value.ToString(serializationFormat));
+    }
+
+    public class TimeOnlyConverter : JsonConverter<TimeOnly>
+    {
+        private readonly string serializationFormat;
+
+        public TimeOnlyConverter() : this(null) { }
+
+        public TimeOnlyConverter(string? serializationFormat)
+        {
+                this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
+        }
+
+        public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+        {
+                var value = reader.GetString();
+                return TimeOnly.Parse(value!);
+        }
+
+        public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
+                => writer.WriteStringValue(value.ToString(serializationFormat));
+    }
+
+    internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
+    {
+        public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);
+
+        private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
+
+        private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
+        private string? _dateTimeFormat;
+        private CultureInfo? _culture;
+
+        public DateTimeStyles DateTimeStyles
+        {
+                get => _dateTimeStyles;
+                set => _dateTimeStyles = value;
+        }
+
+        public string? DateTimeFormat
+        {
+                get => _dateTimeFormat ?? string.Empty;
+                set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
+        }
+
+        public CultureInfo Culture
+        {
+                get => _culture ?? CultureInfo.CurrentCulture;
+                set => _culture = value;
+        }
+
+        public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
+        {
+                string text;
+
+
+                if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
+                        || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
+                {
+                        value = value.ToUniversalTime();
+                }
+
+                text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);
+
+                writer.WriteStringValue(text);
+        }
+
+        public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+        {
+                string? dateText = reader.GetString();
+
+                if (string.IsNullOrEmpty(dateText) == false)
+                {
+                        if (!string.IsNullOrEmpty(_dateTimeFormat))
+                        {
+                                return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
+                        }
+                        else
+                        {
+                                return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
+                        }
+                }
+                else
+                {
+                        return default(DateTimeOffset);
+                }
+        }
+
+
+        public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
+    }
+}
+#pragma warning restore CS8618
+#pragma warning restore CS8601
+#pragma warning restore CS8602
+#pragma warning restore CS8603
diff --git a/head/schema-dart/test/inputs/schema/pattern-properties.schema/default/TopLevel.dart b/head/schema-dart/test/inputs/schema/pattern-properties.schema/default/TopLevel.dart
new file mode 100644
index 0000000..9d8a773
--- /dev/null
+++ b/head/schema-dart/test/inputs/schema/pattern-properties.schema/default/TopLevel.dart
@@ -0,0 +1,45 @@
+// To parse this JSON data, do
+//
+//     final topLevel = topLevelFromJson(jsonString);
+
+import 'dart:convert';
+
+TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str));
+
+String topLevelToJson(TopLevel data) => json.encode(data.toJson());
+
+class TopLevel {
+    final Map<String, Alternator>? alternators;
+
+    TopLevel({
+        this.alternators,
+    });
+
+    factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel(
+        alternators: Map.from(json["alternators"]!).map((k, v) => MapEntry<String, Alternator>(k, Alternator.fromJson(v))),
+    );
+
+    Map<String, dynamic> toJson() => {
+        "alternators": Map.from(alternators!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())),
+    };
+}
+
+class Alternator {
+    final String? name;
+    final double? voltage;
+
+    Alternator({
+        this.name,
+        this.voltage,
+    });
+
+    factory Alternator.fromJson(Map<String, dynamic> json) => Alternator(
+        name: json["name"],
+        voltage: json["voltage"]?.toDouble(),
+    );
+
+    Map<String, dynamic> toJson() => {
+        "name": name,
+        "voltage": voltage,
+    };
+}
diff --git a/head/schema-elm/test/inputs/schema/pattern-properties.schema/default/QuickType.elm b/head/schema-elm/test/inputs/schema/pattern-properties.schema/default/QuickType.elm
new file mode 100644
index 0000000..e7e6a6c
--- /dev/null
+++ b/head/schema-elm/test/inputs/schema/pattern-properties.schema/default/QuickType.elm
@@ -0,0 +1,70 @@
+-- To decode the JSON data, add this file to your project, run
+--
+--     elm install NoRedInk/elm-json-decode-pipeline
+--
+-- add these imports
+--
+--     import Json.Decode exposing (decodeString)
+--     import QuickType exposing (quickType)
+--
+-- and you're off to the races with
+--
+--     decodeString quickType myJsonString
+
+module QuickType exposing
+    ( QuickType
+    , quickTypeToString
+    , quickType
+    , Alternator
+    )
+
+import Json.Decode as Jdec
+import Json.Decode.Pipeline as Jpipe
+import Json.Encode as Jenc
+import Dict exposing (Dict)
+
+type alias QuickType =
+    { alternators : Maybe (Dict String Alternator)
+    }
+
+type alias Alternator =
+    { name : Maybe String
+    , voltage : Maybe Float
+    }
+
+-- decoders and encoders
+
+quickTypeToString : QuickType -> String
+quickTypeToString r = Jenc.encode 0 (encodeQuickType r)
+
+quickType : Jdec.Decoder QuickType
+quickType =
+    Jdec.succeed QuickType
+        |> Jpipe.optional "alternators" (Jdec.nullable (Jdec.dict alternator)) Nothing
+
+encodeQuickType : QuickType -> Jenc.Value
+encodeQuickType x =
+    Jenc.object
+        [ ("alternators", makeNullableEncoder (Jenc.dict identity encodeAlternator) x.alternators)
+        ]
+
+alternator : Jdec.Decoder Alternator
+alternator =
+    Jdec.succeed Alternator
+        |> Jpipe.optional "name" (Jdec.nullable Jdec.string) Nothing
+        |> Jpipe.optional "voltage" (Jdec.nullable Jdec.float) Nothing
+
+encodeAlternator : Alternator -> Jenc.Value
+encodeAlternator x =
+    Jenc.object
+        [ ("name", makeNullableEncoder Jenc.string x.name)
+        , ("voltage", makeNullableEncoder Jenc.float x.voltage)
+        ]
+
+--- encoder helpers
+
+makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value
+makeNullableEncoder f m =
+    case m of
+    Just x -> f x
+    Nothing -> Jenc.null
diff --git a/head/schema-flow/test/inputs/schema/pattern-properties.schema/default/TopLevel.js b/head/schema-flow/test/inputs/schema/pattern-properties.schema/default/TopLevel.js
new file mode 100644
index 0000000..230221b
--- /dev/null
+++ b/head/schema-flow/test/inputs/schema/pattern-properties.schema/default/TopLevel.js
@@ -0,0 +1,199 @@
+// @flow
+
+// To parse this data:
+//
+//   const Convert = require("./TopLevel");
+//
+//   const topLevel = Convert.toTopLevel(json);
+//
+// These functions will throw an error if the JSON doesn't
+// match the expected interface, even if the JSON is valid.
+
+export type TopLevel = {
+    alternators?: { [key: string]: Alternator };
+    [property: string]: mixed;
+};
+
+export type Alternator = {
+    name?:    string;
+    voltage?: number;
+    [property: string]: mixed;
+};
+
+// Converts JSON strings to/from your types
+// and asserts the results of JSON.parse at runtime
+function toTopLevel(json: string): TopLevel {
+    return cast(JSON.parse(json), r("TopLevel"));
+}
+
+function topLevelToJson(value: TopLevel): string {
+    return JSON.stringify(uncast(value, r("TopLevel")), null, 2);
+}
+
+function invalidValue(typ: any, val: any, key: any, parent: any = '') {
+    const prettyTyp = prettyTypeName(typ);
+    const parentText = parent ? ` on ${parent}` : '';
+    const keyText = key ? ` for key "${key}"` : '';
+    throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
+}
+
+function prettyTypeName(typ: any): string {
+    if (Array.isArray(typ)) {
+        if (typ.length === 2 && typ[0] === undefined) {
+            return `an optional ${prettyTypeName(typ[1])}`;
+        } else {
+            return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
+        }
+    } else if (typeof typ === "object" && typ.literal !== undefined) {
+        return typ.literal;
+    } else {
+        return typeof typ;
+    }
+}
+
+function jsonToJSProps(typ: any): any {
+    if (typ.jsonToJS === undefined) {
+        const map: any = {};
+        typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
+        typ.jsonToJS = map;
+    }
+    return typ.jsonToJS;
+}
+
+function jsToJSONProps(typ: any): any {
+    if (typ.jsToJSON === undefined) {
+        const map: any = {};
+        typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
+        typ.jsToJSON = map;
+    }
+    return typ.jsToJSON;
+}
+
+function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
+    function transformPrimitive(typ: string, val: any): any {
+        if (typeof typ === typeof val) return val;
+        return invalidValue(typ, val, key, parent);
+    }
+
+    function transformUnion(typs: any[], val: any): any {
+        // val must validate against one typ in typs
+        const l = typs.length;
+        for (let i = 0; i < l; i++) {
+            const typ = typs[i];
+            try {
+                return transform(val, typ, getProps);
+            } catch (_) {}
+        }
+        return invalidValue(typs, val, key, parent);
+    }
+
+    function transformEnum(cases: string[], val: any): any {
+        if (cases.indexOf(val) !== -1) return val;
+        return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
+    }
+
+    function transformArray(typ: any, val: any): any {
+        // val must be an array with no invalid elements
+        if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
+        return val.map(el => transform(el, typ, getProps));
+    }
+
+    function transformDate(val: any): any {
+        if (val === null) {
+            return null;
+        }
+        const d = new Date(val);
+        if (isNaN(d.valueOf())) {
+            return invalidValue(l("Date"), val, key, parent);
+        }
+        return d;
+    }
+
+    function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
+        if (val === null || typeof val !== "object" || Array.isArray(val)) {
+            return invalidValue(l(ref || "object"), val, key, parent);
+        }
+        const result: any = {};
+        Object.getOwnPropertyNames(props).forEach(key => {
+            const prop = props[key];
+            const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
+            result[prop.key] = transform(v, prop.typ, getProps, key, ref);
+        });
+        Object.getOwnPropertyNames(val).forEach(key => {
+            if (!Object.prototype.hasOwnProperty.call(props, key)) {
+                result[key] = transform(val[key], additional, getProps, key, ref);
+            }
+        });
+        return result;
+    }
+
+    if (typ === "any") return val;
+    if (typ === null) {
+        if (val === null) return val;
+        return invalidValue(typ, val, key, parent);
+    }
+    if (typ === false) return invalidValue(typ, val, key, parent);
+    let ref: any = undefined;
+    while (typeof typ === "object" && typ.ref !== undefined) {
+        ref = typ.ref;
+        typ = typeMap[typ.ref];
+    }
+    if (Array.isArray(typ)) return transformEnum(typ, val);
+    if (typeof typ === "object") {
+        return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
+            : typ.hasOwnProperty("arrayItems")    ? transformArray(typ.arrayItems, val)
+            : typ.hasOwnProperty("props")         ? transformObject(getProps(typ), typ.additional, val)
+            : invalidValue(typ, val, key, parent);
+    }
+    // Numbers can be parsed by Date but shouldn't be.
+    if (typ === Date && typeof val !== "number") return transformDate(val);
+    return transformPrimitive(typ, val);
+}
+
+function cast<T>(val: any, typ: any): T {
+    return transform(val, typ, jsonToJSProps);
+}
+
+function uncast<T>(val: T, typ: any): any {
+    return transform(val, typ, jsToJSONProps);
+}
+
+function l(typ: any) {
+    return { literal: typ };
+}
+
+function a(typ: any) {
+    return { arrayItems: typ };
+}
+
+function u(...typs: any[]) {
+    return { unionMembers: typs };
+}
+
+function o(props: any[], additional: any) {
+    return { props, additional };
+}
+
+function m(additional: any) {
+    const props: any[] = [];
+    return { props, additional };
+}
+
+function r(name: string) {
+    return { ref: name };
+}
+
+const typeMap: any = {
+    "TopLevel": o([
+        { json: "alternators", js: "alternators", typ: u(undefined, m(r("Alternator"))) },
+    ], "any"),
+    "Alternator": o([
+        { json: "name", js: "name", typ: u(undefined, "") },
+        { json: "voltage", js: "voltage", typ: u(undefined, 3.14) },
+    ], "any"),
+};
+
+module.exports = {
+    "topLevelToJson": topLevelToJson,
+    "toTopLevel": toTopLevel,
+};
diff --git a/head/schema-golang/test/inputs/schema/pattern-properties.schema/default/quicktype.go b/head/schema-golang/test/inputs/schema/pattern-properties.schema/default/quicktype.go
new file mode 100644
index 0000000..306a4b4
--- /dev/null
+++ b/head/schema-golang/test/inputs/schema/pattern-properties.schema/default/quicktype.go
@@ -0,0 +1,28 @@
+// Code generated from JSON Schema using quicktype. DO NOT EDIT.
+// To parse and unparse this JSON data, add this code to your project and do:
+//
+//    topLevel, err := UnmarshalTopLevel(bytes)
+//    bytes, err = topLevel.Marshal()
+
+package main
+
+import "encoding/json"
+
+func UnmarshalTopLevel(data []byte) (TopLevel, error) {
+	var r TopLevel
+	err := json.Unmarshal(data, &r)
+	return r, err
+}
+
+func (r *TopLevel) Marshal() ([]byte, error) {
+	return json.Marshal(r)
+}
+
+type TopLevel struct {
+	Alternators map[string]Alternator `json:"alternators,omitempty"`
+}
+
+type Alternator struct {
+	Name    *string  `json:"name,omitempty"`
+	Voltage *float64 `json:"voltage,omitempty"`
+}
diff --git a/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java b/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java
new file mode 100644
index 0000000..0fe3853
--- /dev/null
+++ b/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java
@@ -0,0 +1,18 @@
+package io.quicktype;
+
+import com.fasterxml.jackson.annotation.*;
+
+public class Alternator {
+    private String name;
+    private Double voltage;
+
+    @JsonProperty("name")
+    public String getName() { return name; }
+    @JsonProperty("name")
+    public void setName(String value) { this.name = value; }
+
+    @JsonProperty("voltage")
+    public Double getVoltage() { return voltage; }
+    @JsonProperty("voltage")
+    public void setVoltage(Double value) { this.voltage = value; }
+}
diff --git a/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java b/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java
new file mode 100644
index 0000000..a8eb236
--- /dev/null
+++ b/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java
@@ -0,0 +1,101 @@
+// To use this code, add the following Maven dependency to your project:
+//
+//
+//     com.fasterxml.jackson.core     : jackson-databind          : 2.9.0
+//     com.fasterxml.jackson.datatype : jackson-datatype-jsr310   : 2.9.0
+//
+// Import this package:
+//
+//     import io.quicktype.Converter;
+//
+// Then you can deserialize a JSON string with
+//
+//     TopLevel data = Converter.fromJsonString(jsonString);
+
+package io.quicktype;
+
+import java.io.IOException;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.util.*;
+import java.time.LocalDate;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.temporal.ChronoField;
+
+public class Converter {
+    // Date-time helpers
+
+    private static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder()
+            .appendOptional(DateTimeFormatter.ISO_DATE_TIME)
+            .appendOptional(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+            .appendOptional(DateTimeFormatter.ISO_INSTANT)
+            .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SX"))
+            .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssX"))
+            .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+            .toFormatter()
+            .withZone(ZoneOffset.UTC);
+
+    public static OffsetDateTime parseDateTimeString(String str) {
+        return ZonedDateTime.from(Converter.DATE_TIME_FORMATTER.parse(str)).toOffsetDateTime();
+    }
+
+    private static final DateTimeFormatter TIME_FORMATTER = new DateTimeFormatterBuilder()
+            .appendOptional(DateTimeFormatter.ISO_TIME)
+            .appendOptional(DateTimeFormatter.ISO_OFFSET_TIME)
+            .parseDefaulting(ChronoField.YEAR, 2020)
+            .parseDefaulting(ChronoField.MONTH_OF_YEAR, 1)
+            .parseDefaulting(ChronoField.DAY_OF_MONTH, 1)
+            .toFormatter()
+            .withZone(ZoneOffset.UTC);
+
+    public static OffsetTime parseTimeString(String str) {
+        return ZonedDateTime.from(Converter.TIME_FORMATTER.parse(str)).toOffsetDateTime().toOffsetTime();
+    }
+    // Serialize/deserialize helpers
+
+    public static TopLevel fromJsonString(String json) throws IOException {
+        return getObjectReader().readValue(json);
+    }
+
+    public static String toJsonString(TopLevel obj) throws JsonProcessingException {
+        return getObjectWriter().writeValueAsString(obj);
+    }
+
+    private static ObjectReader reader;
+    private static ObjectWriter writer;
+
+    private static void instantiateMapper() {
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.findAndRegisterModules();
+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+        SimpleModule module = new SimpleModule();
+        module.addDeserializer(OffsetDateTime.class, new JsonDeserializer<OffsetDateTime>() {
+            @Override
+            public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+                String value = jsonParser.getText();
+                return Converter.parseDateTimeString(value);
+            }
+        });
+        mapper.registerModule(module);
+        reader = mapper.readerFor(TopLevel.class);
+        writer = mapper.writerFor(TopLevel.class);
+    }
+
+    private static ObjectReader getObjectReader() {
+        if (reader == null) instantiateMapper();
+        return reader;
+    }
+
+    private static ObjectWriter getObjectWriter() {
+        if (writer == null) instantiateMapper();
+        return writer;
+    }
+}
diff --git a/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java b/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java
new file mode 100644
index 0000000..dd82fab
--- /dev/null
+++ b/head/schema-java/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java
@@ -0,0 +1,13 @@
+package io.quicktype;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.Map;
+
+public class TopLevel {
+    private Map<String, Alternator> alternators;
+
+    @JsonProperty("alternators")
+    public Map<String, Alternator> getAlternators() { return alternators; }
+    @JsonProperty("alternators")
+    public void setAlternators(Map<String, Alternator> value) { this.alternators = value; }
+}
diff --git a/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java b/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java
new file mode 100644
index 0000000..0fe3853
--- /dev/null
+++ b/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java
@@ -0,0 +1,18 @@
+package io.quicktype;
+
+import com.fasterxml.jackson.annotation.*;
+
+public class Alternator {
+    private String name;
+    private Double voltage;
+
+    @JsonProperty("name")
+    public String getName() { return name; }
+    @JsonProperty("name")
+    public void setName(String value) { this.name = value; }
+
+    @JsonProperty("voltage")
+    public Double getVoltage() { return voltage; }
+    @JsonProperty("voltage")
+    public void setVoltage(Double value) { this.voltage = value; }
+}
diff --git a/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java b/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java
new file mode 100644
index 0000000..7d4811b
--- /dev/null
+++ b/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java
@@ -0,0 +1,121 @@
+// To use this code, add the following Maven dependency to your project:
+//
+//
+//     com.fasterxml.jackson.core     : jackson-databind          : 2.9.0
+//
+//
+// Import this package:
+//
+//     import io.quicktype.Converter;
+//
+// Then you can deserialize a JSON string with
+//
+//     TopLevel data = Converter.fromJsonString(jsonString);
+
+package io.quicktype;
+
+import java.io.IOException;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.util.*;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+public class Converter {
+    // Date-time helpers
+
+    private static final String[] DATE_TIME_FORMATS = {
+            "yyyy-MM-dd'T'HH:mm:ss.SX",
+            "yyyy-MM-dd'T'HH:mm:ss.S",
+            "yyyy-MM-dd'T'HH:mm:ssX",
+            "yyyy-MM-dd'T'HH:mm:ss",
+            "yyyy-MM-dd HH:mm:ss.SX",
+            "yyyy-MM-dd HH:mm:ss.S",
+            "yyyy-MM-dd HH:mm:ssX",
+            "yyyy-MM-dd HH:mm:ss",
+            "HH:mm:ss.SZ",
+            "HH:mm:ss.S",
+            "HH:mm:ssZ",
+            "HH:mm:ss",
+            "yyyy-MM-dd",
+    };
+
+    public static Date parseAllDateTimeString(String str) {
+        for (String format : DATE_TIME_FORMATS) {
+            try {
+                return new SimpleDateFormat(format).parse(str);
+            } catch (Exception ex) {
+                // Ignored
+            }
+        }
+        return null;
+    }
+
+    public static String serializeDateTime(Date datetime) {
+        return new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ").format(datetime);
+    }
+
+    public static String serializeDate(Date datetime) {
+        return new SimpleDateFormat("yyyy-MM-dd").format(datetime);
+    }
+
+    public static String serializeTime(Date datetime) {
+        return new SimpleDateFormat("hh:mm:ssZ").format(datetime);
+    }
+    // Serialize/deserialize helpers
+
+    public static TopLevel fromJsonString(String json) throws IOException {
+        return getObjectReader().readValue(json);
+    }
+
+    public static String toJsonString(TopLevel obj) throws JsonProcessingException {
+        return getObjectWriter().writeValueAsString(obj);
+    }
+
+    private static ObjectReader reader;
+    private static ObjectWriter writer;
+
+    private static void instantiateMapper() {
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.findAndRegisterModules();
+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+        SimpleModule module = new SimpleModule();
+        module.addDeserializer(Date.class, new JsonDeserializer<Date>() {
+            @Override
+            public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+                String value = jsonParser.getText();
+                return Converter.parseAllDateTimeString(value);
+            }
+        });
+        module.addDeserializer(Date.class, new JsonDeserializer<Date>() {
+            @Override
+            public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+                String value = jsonParser.getText();
+                return Converter.parseAllDateTimeString(value);
+            }
+        });
+        module.addDeserializer(Date.class, new JsonDeserializer<Date>() {
+            @Override
+            public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+                String value = jsonParser.getText();
+                return Converter.parseAllDateTimeString(value);
+            }
+        });
+        mapper.registerModule(module);
+        reader = mapper.readerFor(TopLevel.class);
+        writer = mapper.writerFor(TopLevel.class);
+    }
+
+    private static ObjectReader getObjectReader() {
+        if (reader == null) instantiateMapper();
+        return reader;
+    }
+
+    private static ObjectWriter getObjectWriter() {
+        if (writer == null) instantiateMapper();
+        return writer;
+    }
+}
diff --git a/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java b/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java
new file mode 100644
index 0000000..dd82fab
--- /dev/null
+++ b/head/schema-java-datetime-legacy/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java
@@ -0,0 +1,13 @@
+package io.quicktype;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.Map;
+
+public class TopLevel {
+    private Map<String, Alternator> alternators;
+
+    @JsonProperty("alternators")
+    public Map<String, Alternator> getAlternators() { return alternators; }
+    @JsonProperty("alternators")
+    public void setAlternators(Map<String, Alternator> value) { this.alternators = value; }
+}
diff --git a/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java b/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java
new file mode 100644
index 0000000..0fe3853
--- /dev/null
+++ b/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Alternator.java
@@ -0,0 +1,18 @@
+package io.quicktype;
+
+import com.fasterxml.jackson.annotation.*;
+
+public class Alternator {
+    private String name;
+    private Double voltage;
+
+    @JsonProperty("name")
+    public String getName() { return name; }
+    @JsonProperty("name")
+    public void setName(String value) { this.name = value; }
+
+    @JsonProperty("voltage")
+    public Double getVoltage() { return voltage; }
+    @JsonProperty("voltage")
+    public void setVoltage(Double value) { this.voltage = value; }
+}
diff --git a/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java b/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java
new file mode 100644
index 0000000..a8eb236
--- /dev/null
+++ b/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/Converter.java
@@ -0,0 +1,101 @@
+// To use this code, add the following Maven dependency to your project:
+//
+//
+//     com.fasterxml.jackson.core     : jackson-databind          : 2.9.0
+//     com.fasterxml.jackson.datatype : jackson-datatype-jsr310   : 2.9.0
+//
+// Import this package:
+//
+//     import io.quicktype.Converter;
+//
+// Then you can deserialize a JSON string with
+//
+//     TopLevel data = Converter.fromJsonString(jsonString);
+
+package io.quicktype;
+
+import java.io.IOException;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.util.*;
+import java.time.LocalDate;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.temporal.ChronoField;
+
+public class Converter {
+    // Date-time helpers
+
+    private static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder()
+            .appendOptional(DateTimeFormatter.ISO_DATE_TIME)
+            .appendOptional(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+            .appendOptional(DateTimeFormatter.ISO_INSTANT)
+            .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SX"))
+            .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssX"))
+            .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+            .toFormatter()
+            .withZone(ZoneOffset.UTC);
+
+    public static OffsetDateTime parseDateTimeString(String str) {
+        return ZonedDateTime.from(Converter.DATE_TIME_FORMATTER.parse(str)).toOffsetDateTime();
+    }
+
+    private static final DateTimeFormatter TIME_FORMATTER = new DateTimeFormatterBuilder()
+            .appendOptional(DateTimeFormatter.ISO_TIME)
+            .appendOptional(DateTimeFormatter.ISO_OFFSET_TIME)
+            .parseDefaulting(ChronoField.YEAR, 2020)
+            .parseDefaulting(ChronoField.MONTH_OF_YEAR, 1)
+            .parseDefaulting(ChronoField.DAY_OF_MONTH, 1)
+            .toFormatter()
+            .withZone(ZoneOffset.UTC);
+
+    public static OffsetTime parseTimeString(String str) {
+        return ZonedDateTime.from(Converter.TIME_FORMATTER.parse(str)).toOffsetDateTime().toOffsetTime();
+    }
+    // Serialize/deserialize helpers
+
+    public static TopLevel fromJsonString(String json) throws IOException {
+        return getObjectReader().readValue(json);
+    }
+
+    public static String toJsonString(TopLevel obj) throws JsonProcessingException {
+        return getObjectWriter().writeValueAsString(obj);
+    }
+
+    private static ObjectReader reader;
+    private static ObjectWriter writer;
+
+    private static void instantiateMapper() {
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.findAndRegisterModules();
+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+        SimpleModule module = new SimpleModule();
+        module.addDeserializer(OffsetDateTime.class, new JsonDeserializer<OffsetDateTime>() {
+            @Override
+            public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+                String value = jsonParser.getText();
+                return Converter.parseDateTimeString(value);
+            }
+        });
+        mapper.registerModule(module);
+        reader = mapper.readerFor(TopLevel.class);
+        writer = mapper.writerFor(TopLevel.class);
+    }
+
+    private static ObjectReader getObjectReader() {
+        if (reader == null) instantiateMapper();
+        return reader;
+    }
+
+    private static ObjectWriter getObjectWriter() {
+        if (writer == null) instantiateMapper();
+        return writer;
+    }
+}
diff --git a/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java b/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java
new file mode 100644
index 0000000..dd82fab
--- /dev/null
+++ b/head/schema-java-lombok/test/inputs/schema/pattern-properties.schema/default/src/main/java/io/quicktype/TopLevel.java
@@ -0,0 +1,13 @@
+package io.quicktype;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.Map;
+
+public class TopLevel {
+    private Map<String, Alternator> alternators;
+
+    @JsonProperty("alternators")
+    public Map<String, Alternator> getAlternators() { return alternators; }
+    @JsonProperty("alternators")
+    public void setAlternators(Map<String, Alternator> value) { this.alternators = value; }
+}
diff --git a/head/schema-javascript/test/inputs/schema/pattern-properties.schema/default/TopLevel.js b/head/schema-javascript/test/inputs/schema/pattern-properties.schema/default/TopLevel.js
new file mode 100644
index 0000000..b569867
--- /dev/null
+++ b/head/schema-javascript/test/inputs/schema/pattern-properties.schema/default/TopLevel.js
@@ -0,0 +1,186 @@
+// To parse this data:
+//
+//   const Convert = require("./TopLevel");
+//
+//   const topLevel = Convert.toTopLevel(json);
+//
+// These functions will throw an error if the JSON doesn't
+// match the expected interface, even if the JSON is valid.
+
+// Converts JSON strings to/from your types
+// and asserts the results of JSON.parse at runtime
+function toTopLevel(json) {
+    return cast(JSON.parse(json), r("TopLevel"));
+}
+
+function topLevelToJson(value) {
+    return JSON.stringify(uncast(value, r("TopLevel")), null, 2);
+}
+
+function invalidValue(typ, val, key, parent = '') {
+    const prettyTyp = prettyTypeName(typ);
+    const parentText = parent ? ` on ${parent}` : '';
+    const keyText = key ? ` for key "${key}"` : '';
+    throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
+}
+
+function prettyTypeName(typ) {
+    if (Array.isArray(typ)) {
+        if (typ.length === 2 && typ[0] === undefined) {
+            return `an optional ${prettyTypeName(typ[1])}`;
+        } else {
+            return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
+        }
+    } else if (typeof typ === "object" && typ.literal !== undefined) {
+        return typ.literal;
+    } else {
+        return typeof typ;
+    }
+}
+
+function jsonToJSProps(typ) {
+    if (typ.jsonToJS === undefined) {
+        const map = {};
+        typ.props.forEach((p) => map[p.json] = { key: p.js, typ: p.typ });
+        typ.jsonToJS = map;
+    }
+    return typ.jsonToJS;
+}
+
+function jsToJSONProps(typ) {
+    if (typ.jsToJSON === undefined) {
+        const map = {};
+        typ.props.forEach((p) => map[p.js] = { key: p.json, typ: p.typ });
+        typ.jsToJSON = map;
+    }
+    return typ.jsToJSON;
+}
+
+function transform(val, typ, getProps, key = '', parent = '') {
+    function transformPrimitive(typ, val) {
+        if (typeof typ === typeof val) return val;
+        return invalidValue(typ, val, key, parent);
+    }
+
+    function transformUnion(typs, val) {
+        // val must validate against one typ in typs
+        const l = typs.length;
+        for (let i = 0; i < l; i++) {
+            const typ = typs[i];
+            try {
+                return transform(val, typ, getProps);
+            } catch (_) {}
+        }
+        return invalidValue(typs, val, key, parent);
+    }
+
+    function transformEnum(cases, val) {
+        if (cases.indexOf(val) !== -1) return val;
+        return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
+    }
+
+    function transformArray(typ, val) {
+        // val must be an array with no invalid elements
+        if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
+        return val.map(el => transform(el, typ, getProps));
+    }
+
+    function transformDate(val) {
+        if (val === null) {
+            return null;
+        }
+        const d = new Date(val);
+        if (isNaN(d.valueOf())) {
+            return invalidValue(l("Date"), val, key, parent);
+        }
+        return d;
+    }
+
+    function transformObject(props, additional, val) {
+        if (val === null || typeof val !== "object" || Array.isArray(val)) {
+            return invalidValue(l(ref || "object"), val, key, parent);
+        }
+        const result = {};
+        Object.getOwnPropertyNames(props).forEach(key => {
+            const prop = props[key];
+            const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
+            result[prop.key] = transform(v, prop.typ, getProps, key, ref);
+        });
+        Object.getOwnPropertyNames(val).forEach(key => {
+            if (!Object.prototype.hasOwnProperty.call(props, key)) {
+                result[key] = transform(val[key], additional, getProps, key, ref);
+            }
+        });
+        return result;
+    }
+
+    if (typ === "any") return val;
+    if (typ === null) {
+        if (val === null) return val;
+        return invalidValue(typ, val, key, parent);
+    }
+    if (typ === false) return invalidValue(typ, val, key, parent);
+    let ref = undefined;
+    while (typeof typ === "object" && typ.ref !== undefined) {
+        ref = typ.ref;
+        typ = typeMap[typ.ref];
+    }
+    if (Array.isArray(typ)) return transformEnum(typ, val);
+    if (typeof typ === "object") {
+        return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
+            : typ.hasOwnProperty("arrayItems")    ? transformArray(typ.arrayItems, val)
+            : typ.hasOwnProperty("props")         ? transformObject(getProps(typ), typ.additional, val)
+            : invalidValue(typ, val, key, parent);
+    }
+    // Numbers can be parsed by Date but shouldn't be.
+    if (typ === Date && typeof val !== "number") return transformDate(val);
+    return transformPrimitive(typ, val);
+}
+
+function cast(val, typ) {
+    return transform(val, typ, jsonToJSProps);
+}
+
+function uncast(val, typ) {
+    return transform(val, typ, jsToJSONProps);
+}
+
+function l(typ) {
+    return { literal: typ };
+}
+
+function a(typ) {
+    return { arrayItems: typ };
+}
+
+function u(...typs) {
+    return { unionMembers: typs };
+}
+
+function o(props, additional) {
+    return { props, additional };
+}
+
+function m(additional) {
+    const props = [];
+    return { props, additional };
+}
+
+function r(name) {
+    return { ref: name };
+}
+
+const typeMap = {
+    "TopLevel": o([
+        { json: "alternators", js: "alternators", typ: u(undefined, m(r("Alternator"))) },
+    ], "any"),
+    "Alternator": o([
+        { json: "name", js: "name", typ: u(undefined, "") },
+        { json: "voltage", js: "voltage", typ: u(undefined, 3.14) },
+    ], "any"),
+};
+
+module.exports = {
+    "topLevelToJson": topLevelToJson,
+    "toTopLevel": toTopLevel,
+};
diff --git a/head/schema-kotlinx/test/inputs/schema/pattern-properties.schema/default/TopLevel.kt b/head/schema-kotlinx/test/inputs/schema/pattern-properties.schema/default/TopLevel.kt
new file mode 100644
index 0000000..96e1cb1
--- /dev/null
+++ b/head/schema-kotlinx/test/inputs/schema/pattern-properties.schema/default/TopLevel.kt
@@ -0,0 +1,22 @@
+// To parse the JSON, install kotlin's serialization plugin and do:
+//
+// val json     = Json { allowStructuredMapKeys = true }
+// val topLevel = json.parse(TopLevel.serializer(), jsonString)
+
+package quicktype
+
+import kotlinx.serialization.*
+import kotlinx.serialization.json.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+@Serializable
+data class TopLevel (
+    val alternators: Map<String, Alternator>? = null
+)
+
+@Serializable
+data class Alternator (
+    val name: String? = null,
+    val voltage: Double? = null
+)
diff --git a/head/schema-php/test/inputs/schema/pattern-properties.schema/default/TopLevel.php b/head/schema-php/test/inputs/schema/pattern-properties.schema/default/TopLevel.php
new file mode 100644
index 0000000..0e0a7c3
--- /dev/null
+++ b/head/schema-php/test/inputs/schema/pattern-properties.schema/default/TopLevel.php
@@ -0,0 +1,297 @@
+<?php
+declare(strict_types=1);
+
+// This is an autogenerated file:TopLevel
+
+class TopLevel {
+    private ?stdClass $alternators; // json:alternators Optional
+
+    /**
+     * @param stdClass|null $alternators
+     */
+    public function __construct(?stdClass $alternators) {
+        $this->alternators = $alternators;
+    }
+
+    /**
+     * @param ?stdClass $value
+     * @throws Exception
+     * @return ?stdClass
+     */
+    public static function fromAlternators(?stdClass $value): ?stdClass {
+        if (!is_null($value)) {
+            $out = new stdClass();
+            foreach ($value as $k => $v) {
+                $out->$k = Alternator::from($v); /*class*/
+            }
+            return $out;
+        } else {
+            return  null;
+        }
+    }
+
+    /**
+     * @throws Exception
+     * @return ?stdClass
+     */
+    public function toAlternators(): ?stdClass {
+        if (TopLevel::validateAlternators($this->alternators))  {
+            if (!is_null($this->alternators)) {
+                $out = new stdClass();
+                foreach ($this->alternators as $k => $v) {
+                    $out->$k = $v->to(); /*class*/
+                }
+                return $out;
+            } else {
+                return  null;
+            }
+        }
+        throw new Exception('never get to this TopLevel::alternators');
+    }
+
+    /**
+     * @param stdClass|null
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateAlternators(?stdClass $value): bool {
+        if (!is_null($value)) {
+            foreach ($value as $k => $v) {
+                $v->validate();
+            }
+        }
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return ?stdClass
+     */
+    public function getAlternators(): ?stdClass {
+        if (TopLevel::validateAlternators($this->alternators))  {
+            return $this->alternators;
+        }
+        throw new Exception('never get to getAlternators TopLevel::alternators');
+    }
+
+    /**
+     * @return ?stdClass
+     */
+    public static function sampleAlternators(): ?stdClass {
+        return  (function () {
+            $out = new stdClass();
+            $out->{'TopLevel'} = Alternator::sample(); /*31:alternators*/
+            return $out;
+        })(); /* 31:alternators*/
+    }
+
+    /**
+     * @throws Exception
+     * @return bool
+     */
+    public function validate(): bool {
+        return TopLevel::validateAlternators($this->alternators);
+    }
+
+    /**
+     * @return stdClass
+     * @throws Exception
+     */
+    public function to(): stdClass  {
+        $out = new stdClass();
+        $out->{'alternators'} = $this->toAlternators();
+        return $out;
+    }
+
+    /**
+     * @param stdClass $obj
+     * @return TopLevel
+     * @throws Exception
+     */
+    public static function from(stdClass $obj): TopLevel {
+        return new TopLevel(
+         TopLevel::fromAlternators($obj->{'alternators'})
+        );
+    }
+
+    /**
+     * @return TopLevel
+     */
+    public static function sample(): TopLevel {
+        return new TopLevel(
+         TopLevel::sampleAlternators()
+        );
+    }
+}
+
+// This is an autogenerated file:Alternator
+
+class Alternator {
+    private ?string $name; // json:name Optional
+    private ?float $voltage; // json:voltage Optional
+
+    /**
+     * @param string|null $name
+     * @param float|null $voltage
+     */
+    public function __construct(?string $name, ?float $voltage) {
+        $this->name = $name;
+        $this->voltage = $voltage;
+    }
+
+    /**
+     * @param ?string $value
+     * @throws Exception
+     * @return ?string
+     */
+    public static function fromName(?string $value): ?string {
+        if (!is_null($value)) {
+            return $value; /*string*/
+        } else {
+            return  null;
+        }
+    }
+
+    /**
+     * @throws Exception
+     * @return ?string
+     */
+    public function toName(): ?string {
+        if (Alternator::validateName($this->name))  {
+            if (!is_null($this->name)) {
+                return $this->name; /*string*/
+            } else {
+                return  null;
+            }
+        }
+        throw new Exception('never get to this Alternator::name');
+    }
+
+    /**
+     * @param string|null
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateName(?string $value): bool {
+        if (!is_null($value)) {
+        }
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return ?string
+     */
+    public function getName(): ?string {
+        if (Alternator::validateName($this->name))  {
+            return $this->name;
+        }
+        throw new Exception('never get to getName Alternator::name');
+    }
+
+    /**
+     * @return ?string
+     */
+    public static function sampleName(): ?string {
+        return 'Alternator::name::31'; /*31:name*/
+    }
+
+    /**
+     * @param ?float $value
+     * @throws Exception
+     * @return ?float
+     */
+    public static function fromVoltage(?float $value): ?float {
+        if (!is_null($value)) {
+            return $value; /*float*/
+        } else {
+            return  null;
+        }
+    }
+
+    /**
+     * @throws Exception
+     * @return ?float
+     */
+    public function toVoltage(): ?float {
+        if (Alternator::validateVoltage($this->voltage))  {
+            if (!is_null($this->voltage)) {
+                return $this->voltage; /*float*/
+            } else {
+                return  null;
+            }
+        }
+        throw new Exception('never get to this Alternator::voltage');
+    }
+
+    /**
+     * @param float|null
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateVoltage(?float $value): bool {
+        if (!is_null($value)) {
+        }
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return ?float
+     */
+    public function getVoltage(): ?float {
+        if (Alternator::validateVoltage($this->voltage))  {
+            return $this->voltage;
+        }
+        throw new Exception('never get to getVoltage Alternator::voltage');
+    }
+
+    /**
+     * @return ?float
+     */
+    public static function sampleVoltage(): ?float {
+        return 32.032; /*32:voltage*/
+    }
+
+    /**
+     * @throws Exception
+     * @return bool
+     */
+    public function validate(): bool {
+        return Alternator::validateName($this->name)
+        || Alternator::validateVoltage($this->voltage);
+    }
+
+    /**
+     * @return stdClass
+     * @throws Exception
+     */
+    public function to(): stdClass  {
+        $out = new stdClass();
+        $out->{'name'} = $this->toName();
+        $out->{'voltage'} = $this->toVoltage();
+        return $out;
+    }
+
+    /**
+     * @param stdClass $obj
+     * @return Alternator
+     * @throws Exception
+     */
+    public static function from(stdClass $obj): Alternator {
+        return new Alternator(
+         Alternator::fromName($obj->{'name'})
+        ,Alternator::fromVoltage($obj->{'voltage'})
+        );
+    }
+
+    /**
+     * @return Alternator
+     */
+    public static function sample(): Alternator {
+        return new Alternator(
+         Alternator::sampleName()
+        ,Alternator::sampleVoltage()
+        );
+    }
+}
diff --git a/head/schema-python/test/inputs/schema/pattern-properties.schema/default/quicktype.py b/head/schema-python/test/inputs/schema/pattern-properties.schema/default/quicktype.py
new file mode 100644
index 0000000..4a103ad
--- /dev/null
+++ b/head/schema-python/test/inputs/schema/pattern-properties.schema/default/quicktype.py
@@ -0,0 +1,90 @@
+from dataclasses import dataclass
+from typing import Any, TypeVar, Callable, Type, cast
+
+
+T = TypeVar("T")
+
+
+def from_str(x: Any) -> str:
+    assert isinstance(x, str)
+    return x
+
+
+def from_none(x: Any) -> Any:
+    assert x is None
+    return x
+
+
+def from_union(fs, x):
+    for f in fs:
+        try:
+            return f(x)
+        except:
+            pass
+    assert False
+
+
+def from_float(x: Any) -> float:
+    assert isinstance(x, (float, int)) and not isinstance(x, bool)
+    return float(x)
+
+
+def to_float(x: Any) -> float:
+    assert isinstance(x, (int, float))
+    return x
+
+
+def from_dict(f: Callable[[Any], T], x: Any) -> dict[str, T]:
+    assert isinstance(x, dict)
+    return { k: f(v) for (k, v) in x.items() }
+
+
+def to_class(c: Type[T], x: Any) -> dict:
+    assert isinstance(x, c)
+    return cast(Any, x).to_dict()
+
+
+@dataclass
+class Alternator:
+    name: str | None = None
+    voltage: float | None = None
+
+    @staticmethod
+    def from_dict(obj: Any) -> 'Alternator':
+        assert isinstance(obj, dict)
+        name = from_union([from_str, from_none], obj.get("name"))
+        voltage = from_union([from_float, from_none], obj.get("voltage"))
+        return Alternator(name, voltage)
+
+    def to_dict(self) -> dict:
+        result: dict = {}
+        if self.name is not None:
+            result["name"] = from_union([from_str, from_none], self.name)
+        if self.voltage is not None:
+            result["voltage"] = from_union([to_float, from_none], self.voltage)
+        return result
+
+
+@dataclass
+class TopLevel:
+    alternators: dict[str, Alternator] | None = None
+
+    @staticmethod
+    def from_dict(obj: Any) -> 'TopLevel':
+        assert isinstance(obj, dict)
+        alternators = from_union([lambda x: from_dict(Alternator.from_dict, x), from_none], obj.get("alternators"))
+        return TopLevel(alternators)
+
+    def to_dict(self) -> dict:
+        result: dict = {}
+        if self.alternators is not None:
+            result["alternators"] = from_union([lambda x: from_dict(lambda x: to_class(Alternator, x), x), from_none], self.alternators)
+        return result
+
+
+def top_level_from_dict(s: Any) -> TopLevel:
+    return TopLevel.from_dict(s)
+
+
+def top_level_to_dict(x: TopLevel) -> Any:
+    return to_class(TopLevel, x)
diff --git a/head/schema-ruby/test/inputs/schema/pattern-properties.schema/default/TopLevel.rb b/head/schema-ruby/test/inputs/schema/pattern-properties.schema/default/TopLevel.rb
new file mode 100644
index 0000000..6d6e3cd
--- /dev/null
+++ b/head/schema-ruby/test/inputs/schema/pattern-properties.schema/default/TopLevel.rb
@@ -0,0 +1,74 @@
+# This code may look unusually verbose for Ruby (and it is), but
+# it performs some subtle and complex validation of JSON data.
+#
+# To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do:
+#
+#   top_level = TopLevel.from_json! "{…}"
+#   puts top_level.alternators&["…"].alternator_name
+#
+# If from_json! succeeds, the value returned matches the schema.
+
+require 'json'
+require 'dry-types'
+require 'dry-struct'
+
+module Types
+  include Dry.Types(default: :nominal)
+
+  Hash   = Strict::Hash
+  String = Strict::String
+  Double = Strict::Float | Strict::Integer
+end
+
+class Alternator < Dry::Struct
+  attribute :alternator_name, Types::String.optional
+  attribute :voltage,         Types::Double.optional
+
+  def self.from_dynamic!(d)
+    d = Types::Hash[d]
+    new(
+      alternator_name: d["name"],
+      voltage:         d["voltage"],
+    )
+  end
+
+  def self.from_json!(json)
+    from_dynamic!(JSON.parse(json))
+  end
+
+  def to_dynamic
+    {
+      "name"    => alternator_name,
+      "voltage" => voltage,
+    }
+  end
+
+  def to_json(options = nil)
+    JSON.generate(to_dynamic, options)
+  end
+end
+
+class TopLevel < Dry::Struct
+  attribute :alternators, Types::Hash.meta(of: Alternator).optional
+
+  def self.from_dynamic!(d)
+    d = Types::Hash[d]
+    new(
+      alternators: Types::Hash.optional[d["alternators"]]&.map { |k, v| [k, Alternator.from_dynamic!(v)] }&.to_h,
+    )
+  end
+
+  def self.from_json!(json)
+    from_dynamic!(JSON.parse(json))
+  end
+
+  def to_dynamic
+    {
+      "alternators" => alternators&.map { |k, v| [k, v.to_dynamic] }.to_h,
+    }
+  end
+
+  def to_json(options = nil)
+    JSON.generate(to_dynamic, options)
+  end
+end
diff --git a/head/schema-rust/test/inputs/schema/pattern-properties.schema/default/module_under_test.rs b/head/schema-rust/test/inputs/schema/pattern-properties.schema/default/module_under_test.rs
new file mode 100644
index 0000000..7c2d3d3
--- /dev/null
+++ b/head/schema-rust/test/inputs/schema/pattern-properties.schema/default/module_under_test.rs
@@ -0,0 +1,27 @@
+// Example code that deserializes and serializes the model.
+// extern crate serde;
+// #[macro_use]
+// extern crate serde_derive;
+// extern crate serde_json;
+//
+// use generated_module::TopLevel;
+//
+// fn main() {
+//     let json = r#"{"answer": 42}"#;
+//     let model: TopLevel = serde_json::from_str(&json).unwrap();
+// }
+
+use serde::{Serialize, Deserialize};
+use std::collections::HashMap;
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct TopLevel {
+    pub alternators: Option<HashMap<String, Alternator>>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Alternator {
+    pub name: Option<String>,
+
+    pub voltage: Option<f64>,
+}
diff --git a/head/schema-scala3/test/inputs/schema/pattern-properties.schema/default/TopLevel.scala b/head/schema-scala3/test/inputs/schema/pattern-properties.schema/default/TopLevel.scala
new file mode 100644
index 0000000..06754be
--- /dev/null
+++ b/head/schema-scala3/test/inputs/schema/pattern-properties.schema/default/TopLevel.scala
@@ -0,0 +1,17 @@
+package quicktype
+
+import io.circe.syntax._
+import io.circe._
+import cats.syntax.functor._
+
+// If a union has a null in, then we'll need this too... 
+type NullValue = None.type
+
+case class TopLevel (
+    val alternators : Option[Map[String, Alternator]] = None
+) derives Encoder.AsObject, Decoder
+
+case class Alternator (
+    val name : Option[String] = None,
+    val voltage : Option[Double] = None
+) derives Encoder.AsObject, Decoder
diff --git a/head/schema-scala3-upickle/test/inputs/schema/pattern-properties.schema/default/TopLevel.scala b/head/schema-scala3-upickle/test/inputs/schema/pattern-properties.schema/default/TopLevel.scala
new file mode 100644
index 0000000..ec408df
--- /dev/null
+++ b/head/schema-scala3-upickle/test/inputs/schema/pattern-properties.schema/default/TopLevel.scala
@@ -0,0 +1,75 @@
+package quicktype
+
+// Custom pickler so that missing keys and JSON nulls both read as None,
+// and None is left out when writing (upickle's default for Option is a
+// JSON array).
+object OptionPickler extends upickle.AttributeTagged:
+    import upickle.default.Writer
+    import upickle.default.Reader
+    override implicit def OptionWriter[T: Writer]: Writer[Option[T]] =
+        implicitly[Writer[T]].comap[Option[T]] {
+            case None => null.asInstanceOf[T]
+            case Some(x) => x
+        }
+
+    override implicit def OptionReader[T: Reader]: Reader[Option[T]] = {
+        new Reader.Delegate[Any, Option[T]](implicitly[Reader[T]].map(Some(_))){
+        override def visitNull(index: Int) = None
+        }
+    }
+end OptionPickler
+
+// If a union has a null in, then we'll need this too...
+type NullValue = None.type
+given OptionPickler.ReadWriter[NullValue] = OptionPickler.readwriter[ujson.Value].bimap[NullValue](
+    _ => ujson.Null,
+    json => if json.isNull then None else throw new upickle.core.Abort("not null")
+)
+
+object JsonExt:
+    val valueReader = OptionPickler.readwriter[ujson.Value]
+
+    // upickle's built-in primitive readers are lenient -- the numeric and
+    // boolean readers accept strings, and the string reader accepts
+    // numbers and booleans -- so untagged unions need strict readers to
+    // pick the right member.
+    val strictString: OptionPickler.Reader[String] = valueReader.map {
+        case ujson.Str(s) => s
+        case json => throw new upickle.core.Abort("expected string, got " + json)
+    }
+    val strictLong: OptionPickler.Reader[Long] = valueReader.map {
+        case ujson.Num(n) if n.isWhole => n.toLong
+        case json => throw new upickle.core.Abort("expected integer, got " + json)
+    }
+    val strictDouble: OptionPickler.Reader[Double] = valueReader.map {
+        case ujson.Num(n) => n
+        case json => throw new upickle.core.Abort("expected number, got " + json)
+    }
+    val strictBoolean: OptionPickler.Reader[Boolean] = valueReader.map {
+        case ujson.Bool(b) => b
+        case json => throw new upickle.core.Abort("expected boolean, got " + json)
+    }
+
+    def badMerge[T](r1: => OptionPickler.Reader[?], rest: OptionPickler.Reader[?]*): OptionPickler.Reader[T] = valueReader.map { json =>
+        var t: T | Null = null
+        val stack       = Vector.newBuilder[Throwable]
+        (r1 +: rest).foreach { reader =>
+            if t == null then
+            try
+                t = OptionPickler.read[T](json, trace = true)(using reader.asInstanceOf[OptionPickler.Reader[T]])
+            catch
+                case exc => stack += exc
+        }
+        if t != null then t.nn else throw new Exception(json.toString(), stack.result().headOption.getOrElse(null))
+    }
+end JsonExt
+
+
+case class TopLevel (
+    val alternators : Option[Map[String, Alternator]] = None
+) derives OptionPickler.ReadWriter
+
+case class Alternator (
+    val name : Option[String] = None,
+    val voltage : Option[Double] = None
+) derives OptionPickler.ReadWriter
diff --git a/head/schema-schema/test/inputs/schema/pattern-properties.schema/default/TopLevel.schema b/head/schema-schema/test/inputs/schema/pattern-properties.schema/default/TopLevel.schema
new file mode 100644
index 0000000..1f8ce82
--- /dev/null
+++ b/head/schema-schema/test/inputs/schema/pattern-properties.schema/default/TopLevel.schema
@@ -0,0 +1,34 @@
+{
+    "$schema": "http://json-schema.org/draft-06/schema#",
+    "$ref": "#/definitions/TopLevel",
+    "definitions": {
+        "TopLevel": {
+            "type": "object",
+            "additionalProperties": {},
+            "properties": {
+                "alternators": {
+                    "type": "object",
+                    "additionalProperties": {
+                        "$ref": "#/definitions/Alternator"
+                    }
+                }
+            },
+            "required": [],
+            "title": "TopLevel"
+        },
+        "Alternator": {
+            "type": "object",
+            "additionalProperties": {},
+            "properties": {
+                "name": {
+                    "type": "string"
+                },
+                "voltage": {
+                    "type": "number"
+                }
+            },
+            "required": [],
+            "title": "Alternator"
+        }
+    }
+}
diff --git a/head/schema-typescript/test/inputs/schema/pattern-properties.schema/default/TopLevel.ts b/head/schema-typescript/test/inputs/schema/pattern-properties.schema/default/TopLevel.ts
new file mode 100644
index 0000000..79cb368
--- /dev/null
+++ b/head/schema-typescript/test/inputs/schema/pattern-properties.schema/default/TopLevel.ts
@@ -0,0 +1,194 @@
+// To parse this data:
+//
+//   import { Convert, TopLevel } from "./TopLevel";
+//
+//   const topLevel = Convert.toTopLevel(json);
+//
+// These functions will throw an error if the JSON doesn't
+// match the expected interface, even if the JSON is valid.
+
+export interface TopLevel {
+    alternators?: { [key: string]: Alternator };
+    [property: string]: unknown;
+}
+
+export interface Alternator {
+    name?:    string;
+    voltage?: number;
+    [property: string]: unknown;
+}
+
+// Converts JSON strings to/from your types
+// and asserts the results of JSON.parse at runtime
+export class Convert {
+    public static toTopLevel(json: string): TopLevel {
+        return cast(JSON.parse(json), r("TopLevel"));
+    }
+
+    public static topLevelToJson(value: TopLevel): string {
+        return JSON.stringify(uncast(value, r("TopLevel")), null, 2);
+    }
+}
+
+function invalidValue(typ: any, val: any, key: any, parent: any = ''): never {
+    const prettyTyp = prettyTypeName(typ);
+    const parentText = parent ? ` on ${parent}` : '';
+    const keyText = key ? ` for key "${key}"` : '';
+    throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
+}
+
+function prettyTypeName(typ: any): string {
+    if (Array.isArray(typ)) {
+        if (typ.length === 2 && typ[0] === undefined) {
+            return `an optional ${prettyTypeName(typ[1])}`;
+        } else {
+            return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
+        }
+    } else if (typeof typ === "object" && typ.literal !== undefined) {
+        return typ.literal;
+    } else {
+        return typeof typ;
+    }
+}
+
+function jsonToJSProps(typ: any): any {
+    if (typ.jsonToJS === undefined) {
+        const map: any = {};
+        typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
+        typ.jsonToJS = map;
+    }
+    return typ.jsonToJS;
+}
+
+function jsToJSONProps(typ: any): any {
+    if (typ.jsToJSON === undefined) {
+        const map: any = {};
+        typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
+        typ.jsToJSON = map;
+    }
+    return typ.jsToJSON;
+}
+
+function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
+    function transformPrimitive(typ: string, val: any): any {
+        if (typeof typ === typeof val) return val;
+        return invalidValue(typ, val, key, parent);
+    }
+
+    function transformUnion(typs: any[], val: any): any {
+        // val must validate against one typ in typs
+        const l = typs.length;
+        for (let i = 0; i < l; i++) {
+            const typ = typs[i];
+            try {
+                return transform(val, typ, getProps);
+            } catch (_) {}
+        }
+        return invalidValue(typs, val, key, parent);
+    }
+
+    function transformEnum(cases: string[], val: any): any {
+        if (cases.indexOf(val) !== -1) return val;
+        return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
+    }
+
+    function transformArray(typ: any, val: any): any {
+        // val must be an array with no invalid elements
+        if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
+        return val.map(el => transform(el, typ, getProps));
+    }
+
+    function transformDate(val: any): any {
+        if (val === null) {
+            return null;
+        }
+        const d = new Date(val);
+        if (isNaN(d.valueOf())) {
+            return invalidValue(l("Date"), val, key, parent);
+        }
+        return d;
+    }
+
+    function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
+        if (val === null || typeof val !== "object" || Array.isArray(val)) {
+            return invalidValue(l(ref || "object"), val, key, parent);
+        }
+        const result: any = {};
+        Object.getOwnPropertyNames(props).forEach(key => {
+            const prop = props[key];
+            const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
+            result[prop.key] = transform(v, prop.typ, getProps, key, ref);
+        });
+        Object.getOwnPropertyNames(val).forEach(key => {
+            if (!Object.prototype.hasOwnProperty.call(props, key)) {
+                result[key] = transform(val[key], additional, getProps, key, ref);
+            }
+        });
+        return result;
+    }
+
+    if (typ === "any") return val;
+    if (typ === null) {
+        if (val === null) return val;
+        return invalidValue(typ, val, key, parent);
+    }
+    if (typ === false) return invalidValue(typ, val, key, parent);
+    let ref: any = undefined;
+    while (typeof typ === "object" && typ.ref !== undefined) {
+        ref = typ.ref;
+        typ = typeMap[typ.ref];
+    }
+    if (Array.isArray(typ)) return transformEnum(typ, val);
+    if (typeof typ === "object") {
+        return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
+            : typ.hasOwnProperty("arrayItems")    ? transformArray(typ.arrayItems, val)
+            : typ.hasOwnProperty("props")         ? transformObject(getProps(typ), typ.additional, val)
+            : invalidValue(typ, val, key, parent);
+    }
+    // Numbers can be parsed by Date but shouldn't be.
+    if (typ === Date && typeof val !== "number") return transformDate(val);
+    return transformPrimitive(typ, val);
+}
+
+function cast<T>(val: any, typ: any): T {
+    return transform(val, typ, jsonToJSProps);
+}
+
+function uncast<T>(val: T, typ: any): any {
+    return transform(val, typ, jsToJSONProps);
+}
+
+function l(typ: any) {
+    return { literal: typ };
+}
+
+function a(typ: any) {
+    return { arrayItems: typ };
+}
+
+function u(...typs: any[]) {
+    return { unionMembers: typs };
+}
+
+function o(props: any[], additional: any) {
+    return { props, additional };
+}
+
+function m(additional: any) {
+    const props: any[] = [];
+    return { props, additional };
+}
+
+function r(name: string) {
+    return { ref: name };
+}
+
+const typeMap: any = {
+    "TopLevel": o([
+        { json: "alternators", js: "alternators", typ: u(undefined, m(r("Alternator"))) },
+    ], "any"),
+    "Alternator": o([
+        { json: "name", js: "name", typ: u(undefined, "") },
+        { json: "voltage", js: "voltage", typ: u(undefined, 3.14) },
+    ], "any"),
+};
