@fern-api/java-dynamic-snippets 4.10.4 → 4.10.6
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/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -2
- package/dist/index.d.ts +58 -2
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -14,6 +14,7 @@ declare namespace DynamicTypeLiteralMapper {
|
|
|
14
14
|
as?: ConvertedAs;
|
|
15
15
|
inUndiscriminatedUnion?: boolean;
|
|
16
16
|
isCollapsedOptionalNullable?: boolean;
|
|
17
|
+
nestedClassReference?: java.ClassReference;
|
|
17
18
|
}
|
|
18
19
|
type ConvertedAs = "mapKey" | "mapValue" | "request";
|
|
19
20
|
}
|
|
@@ -23,7 +24,9 @@ declare class DynamicTypeLiteralMapper {
|
|
|
23
24
|
context: DynamicSnippetsGeneratorContext;
|
|
24
25
|
});
|
|
25
26
|
private usesOptionalNullable;
|
|
27
|
+
private usesNullableAnnotation;
|
|
26
28
|
private wrapInOptionalIfNotNop;
|
|
29
|
+
private wrapNullableOrOptionalValue;
|
|
27
30
|
convert(args: DynamicTypeLiteralMapper.Args): java.TypeLiteral;
|
|
28
31
|
private convertList;
|
|
29
32
|
private convertLiteral;
|
|
@@ -32,6 +35,37 @@ declare class DynamicTypeLiteralMapper {
|
|
|
32
35
|
private convertNamed;
|
|
33
36
|
private convertDiscriminatedUnion;
|
|
34
37
|
private convertObject;
|
|
38
|
+
/**
|
|
39
|
+
* Mirrors the v1 generator's inline-type naming (see ObjectGenerator / InlineTypeIdResolver):
|
|
40
|
+
* when a property's type resolves to an inline named type, v1 emits it as a class nested within
|
|
41
|
+
* the enclosing object. This walks the property's type reference (descending through container
|
|
42
|
+
* wrappers, applying the same name suffixes as v1) and, if it terminates in an inline named type,
|
|
43
|
+
* returns the nested class reference to use. Returns undefined for non-inline types, which fall
|
|
44
|
+
* back to the standalone top-level class name.
|
|
45
|
+
*/
|
|
46
|
+
resolveInlineNestedClassReference({ enclosing, baseName, typeReference, reservedNames, siblingPropertyNames }: {
|
|
47
|
+
enclosing: java.ClassReference;
|
|
48
|
+
baseName: string;
|
|
49
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
50
|
+
reservedNames: Set<string>;
|
|
51
|
+
siblingPropertyNames: Set<string>;
|
|
52
|
+
}): java.ClassReference | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves the nested class reference for an inline member of an undiscriminated union.
|
|
55
|
+
* Unlike object properties and discriminated-union variants (whose nested name is derived
|
|
56
|
+
* from the property/discriminant name), v1 names an undiscriminated union's inline members
|
|
57
|
+
* after the member type's own name, with the union's name stripped as a prefix (see
|
|
58
|
+
* UndiscriminatedUnionGenerator). Descends through container wrappers to the terminal named
|
|
59
|
+
* type.
|
|
60
|
+
*/
|
|
61
|
+
private resolveUndiscriminatedInlineNestedClassReference;
|
|
62
|
+
/**
|
|
63
|
+
* Returns true when a property becomes a required stage in v1's staged builder. v1 stages
|
|
64
|
+
* fields that are neither optional, nullable, nor collections (list/set/map); those are all
|
|
65
|
+
* exposed on the final stage instead. This intentionally resolves aliases itself because the
|
|
66
|
+
* shared `isOptional` helper does not treat an alias to an optional type as optional.
|
|
67
|
+
*/
|
|
68
|
+
private isStagedBuilderProperty;
|
|
35
69
|
private convertToRawJavaLiteral;
|
|
36
70
|
private escapeJavaString;
|
|
37
71
|
private getDefaultValueForTypeReference;
|
|
@@ -96,13 +130,32 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
96
130
|
dynamicTypeMapper: DynamicTypeMapper;
|
|
97
131
|
dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
|
|
98
132
|
filePropertyMapper: FilePropertyMapper;
|
|
99
|
-
|
|
133
|
+
/**
|
|
134
|
+
* The set of type IDs that the v1 generator emits as nested (inline) classes rather than
|
|
135
|
+
* top-level types. The dynamic IR does not carry the `inline` flag, so the v2 SDK generator
|
|
136
|
+
* computes this from the full IR and threads it through. Used to mirror v1's nested-class
|
|
137
|
+
* naming when referencing inline types in snippets.
|
|
138
|
+
*/
|
|
139
|
+
inlineTypeIds: Set<string>;
|
|
140
|
+
constructor({ ir, config, options, sharedCustomConfig, inlineTypeIds }: {
|
|
100
141
|
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
101
142
|
config: FernGeneratorExec.GeneratorConfig;
|
|
102
143
|
options?: Options;
|
|
103
144
|
sharedCustomConfig?: BaseJavaCustomConfigSchema;
|
|
145
|
+
inlineTypeIds?: Set<string>;
|
|
104
146
|
});
|
|
105
147
|
clone(): DynamicSnippetsGeneratorContext;
|
|
148
|
+
isInlineType(typeId: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Builds a reference to a class nested within `enclosing`. The resulting reference imports the
|
|
151
|
+
* outermost enclosing class and is written using the dotted path (e.g. `PostRootRequest.Bar`).
|
|
152
|
+
*/
|
|
153
|
+
getNestedInlineClassReference({ enclosing, name }: {
|
|
154
|
+
enclosing: java.ClassReference;
|
|
155
|
+
name: string;
|
|
156
|
+
}): java.ClassReference;
|
|
157
|
+
wrappedAliases(): boolean;
|
|
158
|
+
enableInlineTypes(): boolean;
|
|
106
159
|
getClassName(name: FernIr.Name): string;
|
|
107
160
|
getEnumName(name: FernIr.Name): string;
|
|
108
161
|
getPropertyName(name: FernIr.Name): string;
|
|
@@ -168,6 +221,8 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
168
221
|
getPackageLayout(): string;
|
|
169
222
|
shouldInlinePathParameters(): boolean;
|
|
170
223
|
shouldInlineFileProperties(): boolean;
|
|
224
|
+
usesNullableAnnotation(): boolean;
|
|
225
|
+
usesOptionalNullable(): boolean;
|
|
171
226
|
private getPackageNameSegments;
|
|
172
227
|
private getPackageNameSegment;
|
|
173
228
|
private getPackagePrefixTokens;
|
|
@@ -241,10 +296,11 @@ declare class EndpointSnippetGenerator {
|
|
|
241
296
|
}
|
|
242
297
|
|
|
243
298
|
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
244
|
-
constructor({ ir, config, options }: {
|
|
299
|
+
constructor({ ir, config, options, inlineTypeIds }: {
|
|
245
300
|
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
246
301
|
config: FernGeneratorExec.GeneratorConfig;
|
|
247
302
|
options?: Options;
|
|
303
|
+
inlineTypeIds?: Set<string>;
|
|
248
304
|
});
|
|
249
305
|
generate(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
250
306
|
generateSync(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): FernIr.dynamic.EndpointSnippetResponse;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare namespace DynamicTypeLiteralMapper {
|
|
|
14
14
|
as?: ConvertedAs;
|
|
15
15
|
inUndiscriminatedUnion?: boolean;
|
|
16
16
|
isCollapsedOptionalNullable?: boolean;
|
|
17
|
+
nestedClassReference?: java.ClassReference;
|
|
17
18
|
}
|
|
18
19
|
type ConvertedAs = "mapKey" | "mapValue" | "request";
|
|
19
20
|
}
|
|
@@ -23,7 +24,9 @@ declare class DynamicTypeLiteralMapper {
|
|
|
23
24
|
context: DynamicSnippetsGeneratorContext;
|
|
24
25
|
});
|
|
25
26
|
private usesOptionalNullable;
|
|
27
|
+
private usesNullableAnnotation;
|
|
26
28
|
private wrapInOptionalIfNotNop;
|
|
29
|
+
private wrapNullableOrOptionalValue;
|
|
27
30
|
convert(args: DynamicTypeLiteralMapper.Args): java.TypeLiteral;
|
|
28
31
|
private convertList;
|
|
29
32
|
private convertLiteral;
|
|
@@ -32,6 +35,37 @@ declare class DynamicTypeLiteralMapper {
|
|
|
32
35
|
private convertNamed;
|
|
33
36
|
private convertDiscriminatedUnion;
|
|
34
37
|
private convertObject;
|
|
38
|
+
/**
|
|
39
|
+
* Mirrors the v1 generator's inline-type naming (see ObjectGenerator / InlineTypeIdResolver):
|
|
40
|
+
* when a property's type resolves to an inline named type, v1 emits it as a class nested within
|
|
41
|
+
* the enclosing object. This walks the property's type reference (descending through container
|
|
42
|
+
* wrappers, applying the same name suffixes as v1) and, if it terminates in an inline named type,
|
|
43
|
+
* returns the nested class reference to use. Returns undefined for non-inline types, which fall
|
|
44
|
+
* back to the standalone top-level class name.
|
|
45
|
+
*/
|
|
46
|
+
resolveInlineNestedClassReference({ enclosing, baseName, typeReference, reservedNames, siblingPropertyNames }: {
|
|
47
|
+
enclosing: java.ClassReference;
|
|
48
|
+
baseName: string;
|
|
49
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
50
|
+
reservedNames: Set<string>;
|
|
51
|
+
siblingPropertyNames: Set<string>;
|
|
52
|
+
}): java.ClassReference | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves the nested class reference for an inline member of an undiscriminated union.
|
|
55
|
+
* Unlike object properties and discriminated-union variants (whose nested name is derived
|
|
56
|
+
* from the property/discriminant name), v1 names an undiscriminated union's inline members
|
|
57
|
+
* after the member type's own name, with the union's name stripped as a prefix (see
|
|
58
|
+
* UndiscriminatedUnionGenerator). Descends through container wrappers to the terminal named
|
|
59
|
+
* type.
|
|
60
|
+
*/
|
|
61
|
+
private resolveUndiscriminatedInlineNestedClassReference;
|
|
62
|
+
/**
|
|
63
|
+
* Returns true when a property becomes a required stage in v1's staged builder. v1 stages
|
|
64
|
+
* fields that are neither optional, nullable, nor collections (list/set/map); those are all
|
|
65
|
+
* exposed on the final stage instead. This intentionally resolves aliases itself because the
|
|
66
|
+
* shared `isOptional` helper does not treat an alias to an optional type as optional.
|
|
67
|
+
*/
|
|
68
|
+
private isStagedBuilderProperty;
|
|
35
69
|
private convertToRawJavaLiteral;
|
|
36
70
|
private escapeJavaString;
|
|
37
71
|
private getDefaultValueForTypeReference;
|
|
@@ -96,13 +130,32 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
96
130
|
dynamicTypeMapper: DynamicTypeMapper;
|
|
97
131
|
dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
|
|
98
132
|
filePropertyMapper: FilePropertyMapper;
|
|
99
|
-
|
|
133
|
+
/**
|
|
134
|
+
* The set of type IDs that the v1 generator emits as nested (inline) classes rather than
|
|
135
|
+
* top-level types. The dynamic IR does not carry the `inline` flag, so the v2 SDK generator
|
|
136
|
+
* computes this from the full IR and threads it through. Used to mirror v1's nested-class
|
|
137
|
+
* naming when referencing inline types in snippets.
|
|
138
|
+
*/
|
|
139
|
+
inlineTypeIds: Set<string>;
|
|
140
|
+
constructor({ ir, config, options, sharedCustomConfig, inlineTypeIds }: {
|
|
100
141
|
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
101
142
|
config: FernGeneratorExec.GeneratorConfig;
|
|
102
143
|
options?: Options;
|
|
103
144
|
sharedCustomConfig?: BaseJavaCustomConfigSchema;
|
|
145
|
+
inlineTypeIds?: Set<string>;
|
|
104
146
|
});
|
|
105
147
|
clone(): DynamicSnippetsGeneratorContext;
|
|
148
|
+
isInlineType(typeId: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Builds a reference to a class nested within `enclosing`. The resulting reference imports the
|
|
151
|
+
* outermost enclosing class and is written using the dotted path (e.g. `PostRootRequest.Bar`).
|
|
152
|
+
*/
|
|
153
|
+
getNestedInlineClassReference({ enclosing, name }: {
|
|
154
|
+
enclosing: java.ClassReference;
|
|
155
|
+
name: string;
|
|
156
|
+
}): java.ClassReference;
|
|
157
|
+
wrappedAliases(): boolean;
|
|
158
|
+
enableInlineTypes(): boolean;
|
|
106
159
|
getClassName(name: FernIr.Name): string;
|
|
107
160
|
getEnumName(name: FernIr.Name): string;
|
|
108
161
|
getPropertyName(name: FernIr.Name): string;
|
|
@@ -168,6 +221,8 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
168
221
|
getPackageLayout(): string;
|
|
169
222
|
shouldInlinePathParameters(): boolean;
|
|
170
223
|
shouldInlineFileProperties(): boolean;
|
|
224
|
+
usesNullableAnnotation(): boolean;
|
|
225
|
+
usesOptionalNullable(): boolean;
|
|
171
226
|
private getPackageNameSegments;
|
|
172
227
|
private getPackageNameSegment;
|
|
173
228
|
private getPackagePrefixTokens;
|
|
@@ -241,10 +296,11 @@ declare class EndpointSnippetGenerator {
|
|
|
241
296
|
}
|
|
242
297
|
|
|
243
298
|
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
244
|
-
constructor({ ir, config, options }: {
|
|
299
|
+
constructor({ ir, config, options, inlineTypeIds }: {
|
|
245
300
|
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
246
301
|
config: FernGeneratorExec.GeneratorConfig;
|
|
247
302
|
options?: Options;
|
|
303
|
+
inlineTypeIds?: Set<string>;
|
|
248
304
|
});
|
|
249
305
|
generate(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
250
306
|
generateSync(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): FernIr.dynamic.EndpointSnippetResponse;
|