quicktype 18.0.6 → 19.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{cli/CompressedJSONFromStream.d.ts → CompressedJSONFromStream.d.ts} +1 -1
- package/dist/{cli/CompressedJSONFromStream.js → CompressedJSONFromStream.js} +2 -2
- package/dist/{cli/GraphQLIntrospection.d.ts → GraphQLIntrospection.d.ts} +0 -0
- package/dist/{cli/GraphQLIntrospection.js → GraphQLIntrospection.js} +1 -1
- package/dist/{cli/TypeSource.d.ts → TypeSource.d.ts} +2 -2
- package/dist/{cli/TypeSource.js → TypeSource.js} +0 -0
- package/dist/{cli/URLGrammar.d.ts → URLGrammar.d.ts} +0 -0
- package/dist/{cli/URLGrammar.js → URLGrammar.js} +1 -1
- package/dist/{cli/index.d.ts → index.d.ts} +1 -1
- package/dist/{cli/index.js → index.js} +4 -5
- package/package.json +61 -77
- package/dist/quicktype-core/Annotation.d.ts +0 -8
- package/dist/quicktype-core/Annotation.js +0 -16
- package/dist/quicktype-core/ConvenienceRenderer.d.ts +0 -138
- package/dist/quicktype-core/ConvenienceRenderer.js +0 -668
- package/dist/quicktype-core/DateTime.d.ts +0 -10
- package/dist/quicktype-core/DateTime.js +0 -57
- package/dist/quicktype-core/DeclarationIR.d.ts +0 -14
- package/dist/quicktype-core/DeclarationIR.js +0 -167
- package/dist/quicktype-core/EncodedMarkovChain.d.ts +0 -1
- package/dist/quicktype-core/EncodedMarkovChain.js +0 -4
- package/dist/quicktype-core/GatherNames.d.ts +0 -2
- package/dist/quicktype-core/GatherNames.js +0 -333
- package/dist/quicktype-core/Graph.d.ts +0 -12
- package/dist/quicktype-core/Graph.js +0 -220
- package/dist/quicktype-core/GraphRewriting.d.ts +0 -87
- package/dist/quicktype-core/GraphRewriting.js +0 -421
- package/dist/quicktype-core/MakeTransformations.d.ts +0 -4
- package/dist/quicktype-core/MakeTransformations.js +0 -193
- package/dist/quicktype-core/MarkovChain.d.ts +0 -15
- package/dist/quicktype-core/MarkovChain.js +0 -154
- package/dist/quicktype-core/Messages.d.ts +0 -294
- package/dist/quicktype-core/Messages.js +0 -105
- package/dist/quicktype-core/Naming.d.ts +0 -64
- package/dist/quicktype-core/Naming.js +0 -356
- package/dist/quicktype-core/Renderer.d.ts +0 -50
- package/dist/quicktype-core/Renderer.js +0 -274
- package/dist/quicktype-core/RendererOptions.d.ts +0 -71
- package/dist/quicktype-core/RendererOptions.js +0 -141
- package/dist/quicktype-core/Run.d.ts +0 -174
- package/dist/quicktype-core/Run.js +0 -393
- package/dist/quicktype-core/Source.d.ts +0 -65
- package/dist/quicktype-core/Source.js +0 -204
- package/dist/quicktype-core/TargetLanguage.d.ts +0 -34
- package/dist/quicktype-core/TargetLanguage.js +0 -66
- package/dist/quicktype-core/Transformers.d.ts +0 -209
- package/dist/quicktype-core/Transformers.js +0 -836
- package/dist/quicktype-core/Type.d.ts +0 -206
- package/dist/quicktype-core/Type.js +0 -716
- package/dist/quicktype-core/TypeBuilder.d.ts +0 -61
- package/dist/quicktype-core/TypeBuilder.js +0 -324
- package/dist/quicktype-core/TypeGraph.d.ts +0 -75
- package/dist/quicktype-core/TypeGraph.js +0 -420
- package/dist/quicktype-core/TypeUtils.d.ts +0 -33
- package/dist/quicktype-core/TypeUtils.js +0 -230
- package/dist/quicktype-core/UnifyClasses.d.ts +0 -16
- package/dist/quicktype-core/UnifyClasses.js +0 -159
- package/dist/quicktype-core/UnionBuilder.d.ts +0 -49
- package/dist/quicktype-core/UnionBuilder.js +0 -282
- package/dist/quicktype-core/attributes/AccessorNames.d.ts +0 -18
- package/dist/quicktype-core/attributes/AccessorNames.js +0 -182
- package/dist/quicktype-core/attributes/Constraints.d.ts +0 -38
- package/dist/quicktype-core/attributes/Constraints.js +0 -172
- package/dist/quicktype-core/attributes/Description.d.ts +0 -9
- package/dist/quicktype-core/attributes/Description.js +0 -97
- package/dist/quicktype-core/attributes/EnumValues.d.ts +0 -8
- package/dist/quicktype-core/attributes/EnumValues.js +0 -31
- package/dist/quicktype-core/attributes/StringTypes.d.ts +0 -28
- package/dist/quicktype-core/attributes/StringTypes.js +0 -189
- package/dist/quicktype-core/attributes/TypeAttributes.d.ts +0 -34
- package/dist/quicktype-core/attributes/TypeAttributes.js +0 -119
- package/dist/quicktype-core/attributes/TypeNames.d.ts +0 -46
- package/dist/quicktype-core/attributes/TypeNames.js +0 -274
- package/dist/quicktype-core/attributes/URIAttributes.d.ts +0 -8
- package/dist/quicktype-core/attributes/URIAttributes.js +0 -85
- package/dist/quicktype-core/index.d.ts +0 -48
- package/dist/quicktype-core/index.js +0 -180
- package/dist/quicktype-core/input/CompressedJSON.d.ts +0 -69
- package/dist/quicktype-core/input/CompressedJSON.js +0 -276
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.d.ts +0 -6
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +0 -18
- package/dist/quicktype-core/input/Inference.d.ts +0 -22
- package/dist/quicktype-core/input/Inference.js +0 -240
- package/dist/quicktype-core/input/Inputs.d.ts +0 -48
- package/dist/quicktype-core/input/Inputs.js +0 -145
- package/dist/quicktype-core/input/JSONSchemaInput.d.ts +0 -91
- package/dist/quicktype-core/input/JSONSchemaInput.js +0 -1041
- package/dist/quicktype-core/input/JSONSchemaStore.d.ts +0 -8
- package/dist/quicktype-core/input/JSONSchemaStore.js +0 -36
- package/dist/quicktype-core/input/PostmanCollection.d.ts +0 -5
- package/dist/quicktype-core/input/PostmanCollection.js +0 -60
- package/dist/quicktype-core/input/io/NodeIO.d.ts +0 -3
- package/dist/quicktype-core/input/io/NodeIO.js +0 -87
- package/dist/quicktype-core/input/io/get-stream/buffer-stream.d.ts +0 -2
- package/dist/quicktype-core/input/io/get-stream/buffer-stream.js +0 -45
- package/dist/quicktype-core/input/io/get-stream/index.d.ts +0 -9
- package/dist/quicktype-core/input/io/get-stream/index.js +0 -52
- package/dist/quicktype-core/language/All.d.ts +0 -3
- package/dist/quicktype-core/language/All.js +0 -57
- package/dist/quicktype-core/language/CPlusPlus.d.ts +0 -241
- package/dist/quicktype-core/language/CPlusPlus.js +0 -1847
- package/dist/quicktype-core/language/CSharp.d.ts +0 -201
- package/dist/quicktype-core/language/CSharp.js +0 -1850
- package/dist/quicktype-core/language/Crystal.d.ts +0 -37
- package/dist/quicktype-core/language/Crystal.js +0 -337
- package/dist/quicktype-core/language/Dart.d.ts +0 -66
- package/dist/quicktype-core/language/Dart.js +0 -576
- package/dist/quicktype-core/language/Elm.d.ts +0 -58
- package/dist/quicktype-core/language/Elm.js +0 -522
- package/dist/quicktype-core/language/Golang.d.ts +0 -51
- package/dist/quicktype-core/language/Golang.js +0 -460
- package/dist/quicktype-core/language/Haskell.d.ts +0 -56
- package/dist/quicktype-core/language/Haskell.js +0 -411
- package/dist/quicktype-core/language/JSONSchema.d.ts +0 -31
- package/dist/quicktype-core/language/JSONSchema.js +0 -169
- package/dist/quicktype-core/language/Java.d.ts +0 -125
- package/dist/quicktype-core/language/Java.js +0 -1081
- package/dist/quicktype-core/language/JavaScript.d.ts +0 -68
- package/dist/quicktype-core/language/JavaScript.js +0 -435
- package/dist/quicktype-core/language/JavaScriptPropTypes.d.ts +0 -40
- package/dist/quicktype-core/language/JavaScriptPropTypes.js +0 -213
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.d.ts +0 -2
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +0 -134
- package/dist/quicktype-core/language/Kotlin.d.ts +0 -109
- package/dist/quicktype-core/language/Kotlin.js +0 -832
- package/dist/quicktype-core/language/Objective-C.d.ts +0 -79
- package/dist/quicktype-core/language/Objective-C.js +0 -777
- package/dist/quicktype-core/language/Php.d.ts +0 -80
- package/dist/quicktype-core/language/Php.js +0 -702
- package/dist/quicktype-core/language/Pike.d.ts +0 -37
- package/dist/quicktype-core/language/Pike.js +0 -276
- package/dist/quicktype-core/language/Python.d.ts +0 -107
- package/dist/quicktype-core/language/Python.js +0 -969
- package/dist/quicktype-core/language/Rust.d.ts +0 -56
- package/dist/quicktype-core/language/Rust.js +0 -309
- package/dist/quicktype-core/language/Swift.d.ts +0 -96
- package/dist/quicktype-core/language/Swift.js +0 -1211
- package/dist/quicktype-core/language/TypeScriptFlow.d.ts +0 -77
- package/dist/quicktype-core/language/TypeScriptFlow.js +0 -286
- package/dist/quicktype-core/language/ruby/index.d.ts +0 -52
- package/dist/quicktype-core/language/ruby/index.js +0 -557
- package/dist/quicktype-core/language/ruby/keywords.d.ts +0 -3
- package/dist/quicktype-core/language/ruby/keywords.js +0 -358
- package/dist/quicktype-core/rewrites/CombineClasses.d.ts +0 -3
- package/dist/quicktype-core/rewrites/CombineClasses.js +0 -125
- package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +0 -4
- package/dist/quicktype-core/rewrites/ExpandStrings.js +0 -143
- package/dist/quicktype-core/rewrites/FlattenStrings.d.ts +0 -3
- package/dist/quicktype-core/rewrites/FlattenStrings.js +0 -45
- package/dist/quicktype-core/rewrites/FlattenUnions.d.ts +0 -3
- package/dist/quicktype-core/rewrites/FlattenUnions.js +0 -47
- package/dist/quicktype-core/rewrites/InferMaps.d.ts +0 -3
- package/dist/quicktype-core/rewrites/InferMaps.js +0 -117
- package/dist/quicktype-core/rewrites/ReplaceObjectType.d.ts +0 -3
- package/dist/quicktype-core/rewrites/ReplaceObjectType.js +0 -60
- package/dist/quicktype-core/rewrites/ResolveIntersections.d.ts +0 -3
- package/dist/quicktype-core/rewrites/ResolveIntersections.js +0 -244
- package/dist/quicktype-core/support/Acronyms.d.ts +0 -10
- package/dist/quicktype-core/support/Acronyms.js +0 -1128
- package/dist/quicktype-core/support/Chance.d.ts +0 -38
- package/dist/quicktype-core/support/Chance.js +0 -2146
- package/dist/quicktype-core/support/Converters.d.ts +0 -6
- package/dist/quicktype-core/support/Converters.js +0 -16
- package/dist/quicktype-core/support/Strings.d.ts +0 -44
- package/dist/quicktype-core/support/Strings.js +0 -525
- package/dist/quicktype-core/support/Support.d.ts +0 -29
- package/dist/quicktype-core/support/Support.js +0 -162
- package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +0 -645
- package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -39
- package/dist/quicktype-graphql-input/index.d.ts +0 -17
- package/dist/quicktype-graphql-input/index.js +0 -407
- package/dist/quicktype-typescript-input/index.d.ts +0 -2
- package/dist/quicktype-typescript-input/index.js +0 -98
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElmRenderer = exports.ElmTargetLanguage = exports.elmOptions = void 0;
|
|
4
|
-
const collection_utils_1 = require("collection-utils");
|
|
5
|
-
const TargetLanguage_1 = require("../TargetLanguage");
|
|
6
|
-
const RendererOptions_1 = require("../RendererOptions");
|
|
7
|
-
const Type_1 = require("../Type");
|
|
8
|
-
const TypeUtils_1 = require("../TypeUtils");
|
|
9
|
-
const ConvenienceRenderer_1 = require("../ConvenienceRenderer");
|
|
10
|
-
const Naming_1 = require("../Naming");
|
|
11
|
-
const Strings_1 = require("../support/Strings");
|
|
12
|
-
const Support_1 = require("../support/Support");
|
|
13
|
-
const Source_1 = require("../Source");
|
|
14
|
-
const Annotation_1 = require("../Annotation");
|
|
15
|
-
exports.elmOptions = {
|
|
16
|
-
justTypes: new RendererOptions_1.BooleanOption("just-types", "Plain types only", false),
|
|
17
|
-
useList: new RendererOptions_1.EnumOption("array-type", "Use Array or List", [
|
|
18
|
-
["array", false],
|
|
19
|
-
["list", true]
|
|
20
|
-
]),
|
|
21
|
-
// FIXME: Do this via a configurable named eventually.
|
|
22
|
-
moduleName: new RendererOptions_1.StringOption("module", "Generated module name", "NAME", "QuickType")
|
|
23
|
-
};
|
|
24
|
-
class ElmTargetLanguage extends TargetLanguage_1.TargetLanguage {
|
|
25
|
-
constructor() {
|
|
26
|
-
super("Elm", ["elm"], "elm");
|
|
27
|
-
}
|
|
28
|
-
getOptions() {
|
|
29
|
-
return [exports.elmOptions.justTypes, exports.elmOptions.moduleName, exports.elmOptions.useList];
|
|
30
|
-
}
|
|
31
|
-
get supportsOptionalClassProperties() {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
get supportsUnionsWithBothNumberTypes() {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
makeRenderer(renderContext, untypedOptionValues) {
|
|
38
|
-
return new ElmRenderer(this, renderContext, (0, RendererOptions_1.getOptionValues)(exports.elmOptions, untypedOptionValues));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.ElmTargetLanguage = ElmTargetLanguage;
|
|
42
|
-
const forbiddenNames = [
|
|
43
|
-
"if",
|
|
44
|
-
"then",
|
|
45
|
-
"else",
|
|
46
|
-
"case",
|
|
47
|
-
"of",
|
|
48
|
-
"let",
|
|
49
|
-
"in",
|
|
50
|
-
"infix",
|
|
51
|
-
"type",
|
|
52
|
-
"module",
|
|
53
|
-
"where",
|
|
54
|
-
"import",
|
|
55
|
-
"exposing",
|
|
56
|
-
"as",
|
|
57
|
-
"port",
|
|
58
|
-
"int",
|
|
59
|
-
"float",
|
|
60
|
-
"bool",
|
|
61
|
-
"string",
|
|
62
|
-
"Jenc",
|
|
63
|
-
"Jdec",
|
|
64
|
-
"Jpipe",
|
|
65
|
-
"always",
|
|
66
|
-
"identity",
|
|
67
|
-
"Array",
|
|
68
|
-
"List",
|
|
69
|
-
"Dict",
|
|
70
|
-
"Maybe",
|
|
71
|
-
"map",
|
|
72
|
-
"toList",
|
|
73
|
-
"makeArrayEncoder",
|
|
74
|
-
"makeDictEncoder",
|
|
75
|
-
"makeNullableEncoder",
|
|
76
|
-
"Int",
|
|
77
|
-
"True",
|
|
78
|
-
"False",
|
|
79
|
-
"String",
|
|
80
|
-
"Float"
|
|
81
|
-
];
|
|
82
|
-
const legalizeName = (0, Strings_1.legalizeCharacters)(cp => (0, Strings_1.isAscii)(cp) && (0, Strings_1.isLetterOrUnderscoreOrDigit)(cp));
|
|
83
|
-
function elmNameStyle(original, upper) {
|
|
84
|
-
const words = (0, Strings_1.splitIntoWords)(original);
|
|
85
|
-
return (0, Strings_1.combineWords)(words, legalizeName, upper ? Strings_1.firstUpperWordStyle : Strings_1.allLowerWordStyle, Strings_1.firstUpperWordStyle, upper ? Strings_1.allUpperWordStyle : Strings_1.allLowerWordStyle, Strings_1.allUpperWordStyle, "", Strings_1.isLetterOrUnderscore);
|
|
86
|
-
}
|
|
87
|
-
const upperNamingFunction = (0, Naming_1.funPrefixNamer)("upper", n => elmNameStyle(n, true));
|
|
88
|
-
const lowerNamingFunction = (0, Naming_1.funPrefixNamer)("lower", n => elmNameStyle(n, false));
|
|
89
|
-
function requiredOrOptional(p) {
|
|
90
|
-
function optional(fallback) {
|
|
91
|
-
return { reqOrOpt: "Jpipe.optional", fallback };
|
|
92
|
-
}
|
|
93
|
-
const t = p.type;
|
|
94
|
-
if (p.isOptional || (t instanceof Type_1.UnionType && (0, TypeUtils_1.nullableFromUnion)(t) !== null)) {
|
|
95
|
-
return optional(" Nothing");
|
|
96
|
-
}
|
|
97
|
-
if (t.kind === "null") {
|
|
98
|
-
return optional(" ()");
|
|
99
|
-
}
|
|
100
|
-
return { reqOrOpt: "Jpipe.required", fallback: "" };
|
|
101
|
-
}
|
|
102
|
-
class ElmRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
103
|
-
_options;
|
|
104
|
-
_topLevelDependents = new Map();
|
|
105
|
-
_namedTypeDependents = new Map();
|
|
106
|
-
constructor(targetLanguage, renderContext, _options) {
|
|
107
|
-
super(targetLanguage, renderContext);
|
|
108
|
-
this._options = _options;
|
|
109
|
-
}
|
|
110
|
-
forbiddenNamesForGlobalNamespace() {
|
|
111
|
-
return forbiddenNames;
|
|
112
|
-
}
|
|
113
|
-
makeTopLevelDependencyNames(t, topLevelName) {
|
|
114
|
-
const encoder = new Naming_1.DependencyName(lowerNamingFunction, topLevelName.order, lookup => `${lookup(topLevelName)}_to_string`);
|
|
115
|
-
let decoder = undefined;
|
|
116
|
-
if (this.namedTypeToNameForTopLevel(t) === undefined) {
|
|
117
|
-
decoder = new Naming_1.DependencyName(lowerNamingFunction, topLevelName.order, lookup => lookup(topLevelName));
|
|
118
|
-
}
|
|
119
|
-
this._topLevelDependents.set(topLevelName, { encoder, decoder });
|
|
120
|
-
if (decoder !== undefined) {
|
|
121
|
-
return [encoder, decoder];
|
|
122
|
-
}
|
|
123
|
-
return [encoder];
|
|
124
|
-
}
|
|
125
|
-
makeNamedTypeNamer() {
|
|
126
|
-
return upperNamingFunction;
|
|
127
|
-
}
|
|
128
|
-
makeNamedTypeDependencyNames(_, typeName) {
|
|
129
|
-
const encoder = new Naming_1.DependencyName(lowerNamingFunction, typeName.order, lookup => `encode_${lookup(typeName)}`);
|
|
130
|
-
const decoder = new Naming_1.DependencyName(lowerNamingFunction, typeName.order, lookup => lookup(typeName));
|
|
131
|
-
this._namedTypeDependents.set(typeName, { encoder, decoder });
|
|
132
|
-
return [encoder, decoder];
|
|
133
|
-
}
|
|
134
|
-
namerForObjectProperty() {
|
|
135
|
-
return lowerNamingFunction;
|
|
136
|
-
}
|
|
137
|
-
forbiddenForObjectProperties(_c, _className) {
|
|
138
|
-
return { names: [], includeGlobalForbidden: true };
|
|
139
|
-
}
|
|
140
|
-
makeUnionMemberNamer() {
|
|
141
|
-
return upperNamingFunction;
|
|
142
|
-
}
|
|
143
|
-
get unionMembersInGlobalNamespace() {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
makeEnumCaseNamer() {
|
|
147
|
-
return upperNamingFunction;
|
|
148
|
-
}
|
|
149
|
-
get enumCasesInGlobalNamespace() {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
proposeUnionMemberName(u, unionName, fieldType, lookup) {
|
|
153
|
-
const fieldName = super.proposeUnionMemberName(u, unionName, fieldType, lookup);
|
|
154
|
-
return `${fieldName}_in_${lookup(unionName)}`;
|
|
155
|
-
}
|
|
156
|
-
get commentLineStart() {
|
|
157
|
-
return "-- ";
|
|
158
|
-
}
|
|
159
|
-
emitDescriptionBlock(lines) {
|
|
160
|
-
if (lines.length === 1) {
|
|
161
|
-
this.emitLine("{-| ", lines[0], " -}");
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
this.emitCommentLines(lines, "", undefined, "-}", "{-| ");
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
get arrayType() {
|
|
168
|
-
return this._options.useList ? "List" : "Array";
|
|
169
|
-
}
|
|
170
|
-
elmType(t, noOptional = false) {
|
|
171
|
-
return (0, TypeUtils_1.matchType)(t, _anyType => (0, Source_1.singleWord)((0, Source_1.annotated)(Annotation_1.anyTypeIssueAnnotation, "Jdec.Value")), _nullType => (0, Source_1.singleWord)((0, Source_1.annotated)(Annotation_1.nullTypeIssueAnnotation, "()")), _boolType => (0, Source_1.singleWord)("Bool"), _integerType => (0, Source_1.singleWord)("Int"), _doubleType => (0, Source_1.singleWord)("Float"), _stringType => (0, Source_1.singleWord)("String"), arrayType => (0, Source_1.multiWord)(" ", this.arrayType, (0, Source_1.parenIfNeeded)(this.elmType(arrayType.items))), classType => (0, Source_1.singleWord)(this.nameForNamedType(classType)), mapType => (0, Source_1.multiWord)(" ", "Dict String", (0, Source_1.parenIfNeeded)(this.elmType(mapType.values))), enumType => (0, Source_1.singleWord)(this.nameForNamedType(enumType)), unionType => {
|
|
172
|
-
const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
|
|
173
|
-
if (nullable !== null) {
|
|
174
|
-
const nullableType = this.elmType(nullable);
|
|
175
|
-
if (noOptional)
|
|
176
|
-
return nullableType;
|
|
177
|
-
return (0, Source_1.multiWord)(" ", "Maybe", (0, Source_1.parenIfNeeded)(nullableType));
|
|
178
|
-
}
|
|
179
|
-
return (0, Source_1.singleWord)(this.nameForNamedType(unionType));
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
elmProperty(p) {
|
|
183
|
-
if (p.isOptional) {
|
|
184
|
-
return (0, Source_1.multiWord)(" ", "Maybe", (0, Source_1.parenIfNeeded)(this.elmType(p.type, true))).source;
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
return this.elmType(p.type).source;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
decoderNameForNamedType(t) {
|
|
191
|
-
const name = this.nameForNamedType(t);
|
|
192
|
-
return (0, Support_1.defined)(this._namedTypeDependents.get(name)).decoder;
|
|
193
|
-
}
|
|
194
|
-
decoderNameForType(t, noOptional = false) {
|
|
195
|
-
return (0, TypeUtils_1.matchType)(t, _anyType => (0, Source_1.singleWord)("Jdec.value"), _nullType => (0, Source_1.multiWord)(" ", "Jdec.null", "()"), _boolType => (0, Source_1.singleWord)("Jdec.bool"), _integerType => (0, Source_1.singleWord)("Jdec.int"), _doubleType => (0, Source_1.singleWord)("Jdec.float"), _stringType => (0, Source_1.singleWord)("Jdec.string"), arrayType => (0, Source_1.multiWord)(" ", ["Jdec.", (0, Strings_1.decapitalize)(this.arrayType)], (0, Source_1.parenIfNeeded)(this.decoderNameForType(arrayType.items))), classType => (0, Source_1.singleWord)(this.decoderNameForNamedType(classType)), mapType => (0, Source_1.multiWord)(" ", "Jdec.dict", (0, Source_1.parenIfNeeded)(this.decoderNameForType(mapType.values))), enumType => (0, Source_1.singleWord)(this.decoderNameForNamedType(enumType)), unionType => {
|
|
196
|
-
const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
|
|
197
|
-
if (nullable !== null) {
|
|
198
|
-
const nullableDecoder = this.decoderNameForType(nullable);
|
|
199
|
-
if (noOptional)
|
|
200
|
-
return nullableDecoder;
|
|
201
|
-
return (0, Source_1.multiWord)(" ", "Jdec.nullable", (0, Source_1.parenIfNeeded)(nullableDecoder));
|
|
202
|
-
}
|
|
203
|
-
return (0, Source_1.singleWord)(this.decoderNameForNamedType(unionType));
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
decoderNameForProperty(p) {
|
|
207
|
-
if (p.isOptional) {
|
|
208
|
-
return (0, Source_1.multiWord)(" ", "Jdec.nullable", (0, Source_1.parenIfNeeded)(this.decoderNameForType(p.type, true)));
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
return this.decoderNameForType(p.type);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
encoderNameForNamedType(t) {
|
|
215
|
-
const name = this.nameForNamedType(t);
|
|
216
|
-
return (0, Support_1.defined)(this._namedTypeDependents.get(name)).encoder;
|
|
217
|
-
}
|
|
218
|
-
encoderNameForType(t, noOptional = false) {
|
|
219
|
-
return (0, TypeUtils_1.matchType)(t, _anyType => (0, Source_1.singleWord)("identity"), _nullType => (0, Source_1.multiWord)(" ", "always", "Jenc.null"), _boolType => (0, Source_1.singleWord)("Jenc.bool"), _integerType => (0, Source_1.singleWord)("Jenc.int"), _doubleType => (0, Source_1.singleWord)("Jenc.float"), _stringType => (0, Source_1.singleWord)("Jenc.string"), arrayType => (0, Source_1.multiWord)(" ", ["make", this.arrayType, "Encoder"], (0, Source_1.parenIfNeeded)(this.encoderNameForType(arrayType.items))), classType => (0, Source_1.singleWord)(this.encoderNameForNamedType(classType)), mapType => (0, Source_1.multiWord)(" ", "makeDictEncoder", (0, Source_1.parenIfNeeded)(this.encoderNameForType(mapType.values))), enumType => (0, Source_1.singleWord)(this.encoderNameForNamedType(enumType)), unionType => {
|
|
220
|
-
const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
|
|
221
|
-
if (nullable !== null) {
|
|
222
|
-
const nullableEncoder = this.encoderNameForType(nullable);
|
|
223
|
-
if (noOptional)
|
|
224
|
-
return nullableEncoder;
|
|
225
|
-
return (0, Source_1.multiWord)(" ", "makeNullableEncoder", (0, Source_1.parenIfNeeded)(nullableEncoder));
|
|
226
|
-
}
|
|
227
|
-
return (0, Source_1.singleWord)(this.encoderNameForNamedType(unionType));
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
encoderNameForProperty(p) {
|
|
231
|
-
if (p.isOptional) {
|
|
232
|
-
return (0, Source_1.multiWord)(" ", "makeNullableEncoder", (0, Source_1.parenIfNeeded)(this.encoderNameForType(p.type, true)));
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
return this.encoderNameForType(p.type);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
emitTopLevelDefinition(t, topLevelName) {
|
|
239
|
-
this.emitLine("type alias ", topLevelName, " = ", this.elmType(t).source);
|
|
240
|
-
}
|
|
241
|
-
emitClassDefinition(c, className) {
|
|
242
|
-
let description = this.descriptionForType(c);
|
|
243
|
-
this.forEachClassProperty(c, "none", (name, jsonName) => {
|
|
244
|
-
const propertyDescription = this.descriptionForClassProperty(c, jsonName);
|
|
245
|
-
if (propertyDescription === undefined)
|
|
246
|
-
return;
|
|
247
|
-
if (description === undefined) {
|
|
248
|
-
description = [];
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
description.push("");
|
|
252
|
-
}
|
|
253
|
-
description.push(`${this.sourcelikeToString(name)}:`);
|
|
254
|
-
description.push(...propertyDescription);
|
|
255
|
-
});
|
|
256
|
-
this.emitDescription(description);
|
|
257
|
-
this.emitLine("type alias ", className, " =");
|
|
258
|
-
this.indent(() => {
|
|
259
|
-
let onFirst = true;
|
|
260
|
-
this.forEachClassProperty(c, "none", (name, _jsonName, p) => {
|
|
261
|
-
this.emitLine(onFirst ? "{" : ",", " ", name, " : ", this.elmProperty(p));
|
|
262
|
-
onFirst = false;
|
|
263
|
-
});
|
|
264
|
-
if (onFirst) {
|
|
265
|
-
this.emitLine("{");
|
|
266
|
-
}
|
|
267
|
-
this.emitLine("}");
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
emitEnumDefinition(e, enumName) {
|
|
271
|
-
this.emitDescription(this.descriptionForType(e));
|
|
272
|
-
this.emitLine("type ", enumName);
|
|
273
|
-
this.indent(() => {
|
|
274
|
-
let onFirst = true;
|
|
275
|
-
this.forEachEnumCase(e, "none", name => {
|
|
276
|
-
const equalsOrPipe = onFirst ? "=" : "|";
|
|
277
|
-
this.emitLine(equalsOrPipe, " ", name);
|
|
278
|
-
onFirst = false;
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
emitUnionDefinition(u, unionName) {
|
|
283
|
-
this.emitDescription(this.descriptionForType(u));
|
|
284
|
-
this.emitLine("type ", unionName);
|
|
285
|
-
this.indent(() => {
|
|
286
|
-
let onFirst = true;
|
|
287
|
-
this.forEachUnionMember(u, null, "none", null, (constructor, t) => {
|
|
288
|
-
const equalsOrPipe = onFirst ? "=" : "|";
|
|
289
|
-
if (t.kind === "null") {
|
|
290
|
-
this.emitLine(equalsOrPipe, " ", constructor);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
this.emitLine(equalsOrPipe, " ", constructor, " ", (0, Source_1.parenIfNeeded)(this.elmType(t)));
|
|
294
|
-
}
|
|
295
|
-
onFirst = false;
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
emitTopLevelFunctions(t, topLevelName) {
|
|
300
|
-
const { encoder, decoder } = (0, Support_1.defined)(this._topLevelDependents.get(topLevelName));
|
|
301
|
-
if (this.namedTypeToNameForTopLevel(t) === undefined) {
|
|
302
|
-
this.emitLine((0, Support_1.defined)(decoder), " : Jdec.Decoder ", topLevelName);
|
|
303
|
-
this.emitLine((0, Support_1.defined)(decoder), " = ", this.decoderNameForType(t).source);
|
|
304
|
-
this.ensureBlankLine();
|
|
305
|
-
}
|
|
306
|
-
this.emitLine(encoder, " : ", topLevelName, " -> String");
|
|
307
|
-
this.emitLine(encoder, " r = Jenc.encode 0 (", this.encoderNameForType(t).source, " r)");
|
|
308
|
-
}
|
|
309
|
-
emitClassFunctions(c, className) {
|
|
310
|
-
const decoderName = this.decoderNameForNamedType(c);
|
|
311
|
-
this.emitLine(decoderName, " : Jdec.Decoder ", className);
|
|
312
|
-
this.emitLine(decoderName, " =");
|
|
313
|
-
this.indent(() => {
|
|
314
|
-
this.emitLine("Jpipe.decode ", className);
|
|
315
|
-
this.indent(() => {
|
|
316
|
-
this.forEachClassProperty(c, "none", (_, jsonName, p) => {
|
|
317
|
-
const propDecoder = (0, Source_1.parenIfNeeded)(this.decoderNameForProperty(p));
|
|
318
|
-
const { reqOrOpt, fallback } = requiredOrOptional(p);
|
|
319
|
-
this.emitLine("|> ", reqOrOpt, ' "', (0, Strings_1.stringEscape)(jsonName), '" ', propDecoder, fallback);
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
this.ensureBlankLine();
|
|
324
|
-
const encoderName = this.encoderNameForNamedType(c);
|
|
325
|
-
this.emitLine(encoderName, " : ", className, " -> Jenc.Value");
|
|
326
|
-
this.emitLine(encoderName, " x =");
|
|
327
|
-
this.indent(() => {
|
|
328
|
-
this.emitLine("Jenc.object");
|
|
329
|
-
this.indent(() => {
|
|
330
|
-
let onFirst = true;
|
|
331
|
-
this.forEachClassProperty(c, "none", (name, jsonName, p) => {
|
|
332
|
-
const bracketOrComma = onFirst ? "[" : ",";
|
|
333
|
-
const propEncoder = this.encoderNameForProperty(p).source;
|
|
334
|
-
this.emitLine(bracketOrComma, ' ("', (0, Strings_1.stringEscape)(jsonName), '", ', propEncoder, " x.", name, ")");
|
|
335
|
-
onFirst = false;
|
|
336
|
-
});
|
|
337
|
-
if (onFirst) {
|
|
338
|
-
this.emitLine("[");
|
|
339
|
-
}
|
|
340
|
-
this.emitLine("]");
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
emitEnumFunctions(e, enumName) {
|
|
345
|
-
const decoderName = this.decoderNameForNamedType(e);
|
|
346
|
-
this.emitLine(decoderName, " : Jdec.Decoder ", enumName);
|
|
347
|
-
this.emitLine(decoderName, " =");
|
|
348
|
-
this.indent(() => {
|
|
349
|
-
this.emitLine("Jdec.string");
|
|
350
|
-
this.indent(() => {
|
|
351
|
-
this.emitLine("|> Jdec.andThen (\\str ->");
|
|
352
|
-
this.indent(() => {
|
|
353
|
-
this.emitLine("case str of");
|
|
354
|
-
this.indent(() => {
|
|
355
|
-
this.forEachEnumCase(e, "none", (name, jsonName) => {
|
|
356
|
-
this.emitLine('"', (0, Strings_1.stringEscape)(jsonName), '" -> Jdec.succeed ', name);
|
|
357
|
-
});
|
|
358
|
-
this.emitLine('somethingElse -> Jdec.fail <| "Invalid ', enumName, ': " ++ somethingElse');
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
this.emitLine(")");
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
this.ensureBlankLine();
|
|
365
|
-
const encoderName = this.encoderNameForNamedType(e);
|
|
366
|
-
this.emitLine(encoderName, " : ", enumName, " -> Jenc.Value");
|
|
367
|
-
this.emitLine(encoderName, " x = case x of");
|
|
368
|
-
this.indent(() => {
|
|
369
|
-
this.forEachEnumCase(e, "none", (name, jsonName) => {
|
|
370
|
-
this.emitLine(name, ' -> Jenc.string "', (0, Strings_1.stringEscape)(jsonName), '"');
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
emitUnionFunctions(u, unionName) {
|
|
375
|
-
// We need arrays first, then strings, and integers before doubles.
|
|
376
|
-
function sortOrder(_, t) {
|
|
377
|
-
if (t.kind === "array") {
|
|
378
|
-
return " array";
|
|
379
|
-
}
|
|
380
|
-
else if (t.kind === "double") {
|
|
381
|
-
return " xdouble";
|
|
382
|
-
}
|
|
383
|
-
else if (t.isPrimitive()) {
|
|
384
|
-
return " " + t.kind;
|
|
385
|
-
}
|
|
386
|
-
return t.kind;
|
|
387
|
-
}
|
|
388
|
-
const decoderName = this.decoderNameForNamedType(u);
|
|
389
|
-
this.emitLine(decoderName, " : Jdec.Decoder ", unionName);
|
|
390
|
-
this.emitLine(decoderName, " =");
|
|
391
|
-
this.indent(() => {
|
|
392
|
-
this.emitLine("Jdec.oneOf");
|
|
393
|
-
this.indent(() => {
|
|
394
|
-
let onFirst = true;
|
|
395
|
-
this.forEachUnionMember(u, null, "none", sortOrder, (constructor, t) => {
|
|
396
|
-
const bracketOrComma = onFirst ? "[" : ",";
|
|
397
|
-
if (t.kind === "null") {
|
|
398
|
-
this.emitLine(bracketOrComma, " Jdec.null ", constructor);
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
const decoder = (0, Source_1.parenIfNeeded)(this.decoderNameForType(t));
|
|
402
|
-
this.emitLine(bracketOrComma, " Jdec.map ", constructor, " ", decoder);
|
|
403
|
-
}
|
|
404
|
-
onFirst = false;
|
|
405
|
-
});
|
|
406
|
-
this.emitLine("]");
|
|
407
|
-
});
|
|
408
|
-
});
|
|
409
|
-
this.ensureBlankLine();
|
|
410
|
-
const encoderName = this.encoderNameForNamedType(u);
|
|
411
|
-
this.emitLine(encoderName, " : ", unionName, " -> Jenc.Value");
|
|
412
|
-
this.emitLine(encoderName, " x = case x of");
|
|
413
|
-
this.indent(() => {
|
|
414
|
-
this.forEachUnionMember(u, null, "none", sortOrder, (constructor, t) => {
|
|
415
|
-
if (t.kind === "null") {
|
|
416
|
-
this.emitLine(constructor, " -> Jenc.null");
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
const encoder = this.encoderNameForType(t).source;
|
|
420
|
-
this.emitLine(constructor, " y -> ", encoder, " y");
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
emitSourceStructure() {
|
|
426
|
-
const exports = [];
|
|
427
|
-
const topLevelDecoders = [];
|
|
428
|
-
this.forEachTopLevel("none", (_, name) => {
|
|
429
|
-
let { encoder, decoder } = (0, Support_1.defined)(this._topLevelDependents.get(name));
|
|
430
|
-
if (decoder === undefined) {
|
|
431
|
-
decoder = (0, Support_1.defined)(this._namedTypeDependents.get(name)).decoder;
|
|
432
|
-
}
|
|
433
|
-
topLevelDecoders.push(decoder);
|
|
434
|
-
exports.push(name, encoder, decoder);
|
|
435
|
-
});
|
|
436
|
-
this.forEachObject("none", (t, name) => {
|
|
437
|
-
if (!(0, collection_utils_1.mapContains)(this.topLevels, t))
|
|
438
|
-
exports.push(name);
|
|
439
|
-
});
|
|
440
|
-
this.forEachEnum("none", (t, name) => {
|
|
441
|
-
if (!(0, collection_utils_1.mapContains)(this.topLevels, t))
|
|
442
|
-
exports.push([name, "(..)"]);
|
|
443
|
-
});
|
|
444
|
-
this.forEachUnion("none", (t, name) => {
|
|
445
|
-
if (!(0, collection_utils_1.mapContains)(this.topLevels, t))
|
|
446
|
-
exports.push([name, "(..)"]);
|
|
447
|
-
});
|
|
448
|
-
if (this.leadingComments !== undefined) {
|
|
449
|
-
this.emitCommentLines(this.leadingComments);
|
|
450
|
-
}
|
|
451
|
-
else if (!this._options.justTypes) {
|
|
452
|
-
this.emitCommentLines([
|
|
453
|
-
"To decode the JSON data, add this file to your project, run",
|
|
454
|
-
"",
|
|
455
|
-
" elm-package install NoRedInk/elm-decode-pipeline",
|
|
456
|
-
"",
|
|
457
|
-
"add these imports",
|
|
458
|
-
"",
|
|
459
|
-
" import Json.Decode exposing (decodeString)`);"
|
|
460
|
-
]);
|
|
461
|
-
this.emitLine("-- import ", this._options.moduleName, " exposing (", (0, collection_utils_1.arrayIntercalate)(", ", topLevelDecoders), ")");
|
|
462
|
-
this.emitMultiline(`--
|
|
463
|
-
-- and you're off to the races with
|
|
464
|
-
--`);
|
|
465
|
-
this.forEachTopLevel("none", (_, name) => {
|
|
466
|
-
let { decoder } = (0, Support_1.defined)(this._topLevelDependents.get(name));
|
|
467
|
-
if (decoder === undefined) {
|
|
468
|
-
decoder = (0, Support_1.defined)(this._namedTypeDependents.get(name)).decoder;
|
|
469
|
-
}
|
|
470
|
-
this.emitLine("-- decodeString ", decoder, " myJsonString");
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
if (!this._options.justTypes) {
|
|
474
|
-
this.ensureBlankLine();
|
|
475
|
-
this.emitLine("module ", this._options.moduleName, " exposing");
|
|
476
|
-
this.indent(() => {
|
|
477
|
-
for (let i = 0; i < exports.length; i++) {
|
|
478
|
-
this.emitLine(i === 0 ? "(" : ",", " ", exports[i]);
|
|
479
|
-
}
|
|
480
|
-
this.emitLine(")");
|
|
481
|
-
});
|
|
482
|
-
this.ensureBlankLine();
|
|
483
|
-
this.emitMultiline(`import Json.Decode as Jdec
|
|
484
|
-
import Json.Decode.Pipeline as Jpipe
|
|
485
|
-
import Json.Encode as Jenc
|
|
486
|
-
import Dict exposing (Dict, map, toList)`);
|
|
487
|
-
if (this._options.useList) {
|
|
488
|
-
this.emitLine("import List exposing (map)");
|
|
489
|
-
}
|
|
490
|
-
else {
|
|
491
|
-
this.emitLine("import Array exposing (Array, map)");
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
this.forEachTopLevel("leading-and-interposing", (t, topLevelName) => this.emitTopLevelDefinition(t, topLevelName), t => this.namedTypeToNameForTopLevel(t) === undefined);
|
|
495
|
-
this.forEachNamedType("leading-and-interposing", (c, className) => this.emitClassDefinition(c, className), (e, enumName) => this.emitEnumDefinition(e, enumName), (u, unionName) => this.emitUnionDefinition(u, unionName));
|
|
496
|
-
if (this._options.justTypes)
|
|
497
|
-
return;
|
|
498
|
-
this.ensureBlankLine();
|
|
499
|
-
this.emitLine("-- decoders and encoders");
|
|
500
|
-
this.forEachTopLevel("leading-and-interposing", (t, topLevelName) => this.emitTopLevelFunctions(t, topLevelName));
|
|
501
|
-
this.forEachNamedType("leading-and-interposing", (c, className) => this.emitClassFunctions(c, className), (e, enumName) => this.emitEnumFunctions(e, enumName), (u, unionName) => this.emitUnionFunctions(u, unionName));
|
|
502
|
-
this.ensureBlankLine();
|
|
503
|
-
this.emitLine("--- encoder helpers");
|
|
504
|
-
this.ensureBlankLine();
|
|
505
|
-
this.emitLine("make", this.arrayType, "Encoder : (a -> Jenc.Value) -> ", this.arrayType, " a -> Jenc.Value");
|
|
506
|
-
this.emitLine("make", this.arrayType, "Encoder f arr =");
|
|
507
|
-
this.indent(() => {
|
|
508
|
-
this.emitLine("Jenc.", (0, Strings_1.decapitalize)(this.arrayType), " (", this.arrayType, ".map f arr)");
|
|
509
|
-
});
|
|
510
|
-
this.ensureBlankLine();
|
|
511
|
-
this.emitMultiline(`makeDictEncoder : (a -> Jenc.Value) -> Dict String a -> Jenc.Value
|
|
512
|
-
makeDictEncoder f dict =
|
|
513
|
-
Jenc.object (toList (Dict.map (\\k -> f) dict))
|
|
514
|
-
|
|
515
|
-
makeNullableEncoder : (a -> Jenc.Value) -> Maybe a -> Jenc.Value
|
|
516
|
-
makeNullableEncoder f m =
|
|
517
|
-
case m of
|
|
518
|
-
Just x -> f x
|
|
519
|
-
Nothing -> Jenc.null`);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
exports.ElmRenderer = ElmRenderer;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Type } from "../Type";
|
|
2
|
-
import { Name, DependencyName, Namer } from "../Naming";
|
|
3
|
-
import { StringOption, BooleanOption, Option, OptionValues } from "../RendererOptions";
|
|
4
|
-
import { Sourcelike } from "../Source";
|
|
5
|
-
import { TargetLanguage } from "../TargetLanguage";
|
|
6
|
-
import { ConvenienceRenderer } from "../ConvenienceRenderer";
|
|
7
|
-
import { RenderContext } from "../Renderer";
|
|
8
|
-
export declare const goOptions: {
|
|
9
|
-
justTypes: BooleanOption;
|
|
10
|
-
justTypesAndPackage: BooleanOption;
|
|
11
|
-
packageName: StringOption;
|
|
12
|
-
multiFileOutput: BooleanOption;
|
|
13
|
-
};
|
|
14
|
-
export declare class GoTargetLanguage extends TargetLanguage {
|
|
15
|
-
constructor();
|
|
16
|
-
protected getOptions(): Option<any>[];
|
|
17
|
-
get supportsUnionsWithBothNumberTypes(): boolean;
|
|
18
|
-
get supportsOptionalClassProperties(): boolean;
|
|
19
|
-
protected makeRenderer(renderContext: RenderContext, untypedOptionValues: {
|
|
20
|
-
[name: string]: any;
|
|
21
|
-
}): GoRenderer;
|
|
22
|
-
protected get defaultIndentation(): string;
|
|
23
|
-
}
|
|
24
|
-
export declare class GoRenderer extends ConvenienceRenderer {
|
|
25
|
-
private readonly _options;
|
|
26
|
-
private readonly _topLevelUnmarshalNames;
|
|
27
|
-
private _currentFilename;
|
|
28
|
-
constructor(targetLanguage: TargetLanguage, renderContext: RenderContext, _options: OptionValues<typeof goOptions>);
|
|
29
|
-
protected makeNamedTypeNamer(): Namer;
|
|
30
|
-
protected namerForObjectProperty(): Namer;
|
|
31
|
-
protected makeUnionMemberNamer(): Namer;
|
|
32
|
-
protected makeEnumCaseNamer(): Namer;
|
|
33
|
-
protected get enumCasesInGlobalNamespace(): boolean;
|
|
34
|
-
protected makeTopLevelDependencyNames(_: Type, topLevelName: Name): DependencyName[];
|
|
35
|
-
protected startFile(basename: Sourcelike): void;
|
|
36
|
-
protected endFile(): void;
|
|
37
|
-
private emitBlock;
|
|
38
|
-
private emitFunc;
|
|
39
|
-
private emitStruct;
|
|
40
|
-
private nullableGoType;
|
|
41
|
-
private propertyGoType;
|
|
42
|
-
private goType;
|
|
43
|
-
private emitTopLevel;
|
|
44
|
-
private emitClass;
|
|
45
|
-
private emitEnum;
|
|
46
|
-
private emitUnion;
|
|
47
|
-
private emitSingleFileHeaderComments;
|
|
48
|
-
private emitPackageDefinitons;
|
|
49
|
-
private emitHelperFunctions;
|
|
50
|
-
protected emitSourceStructure(): void;
|
|
51
|
-
}
|