@graphql-codegen/java 3.2.9 → 3.2.12
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/config.d.ts +6 -6
- package/index.js +6 -8
- package/index.mjs +6 -8
- package/package.json +4 -4
package/config.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface JavaResolversPluginRawConfig extends RawConfig {
|
|
|
7
7
|
* @description Customize the class members prefix. The default is empty (this might be a breaking change from the default that was _)
|
|
8
8
|
*
|
|
9
9
|
* @exampleMarkdown
|
|
10
|
-
* ```
|
|
10
|
+
* ```yaml
|
|
11
11
|
* src/main/java/my-org/my-app/Resolvers.java:
|
|
12
12
|
* plugins:
|
|
13
13
|
* - java
|
|
@@ -20,7 +20,7 @@ export interface JavaResolversPluginRawConfig extends RawConfig {
|
|
|
20
20
|
* @description Customize the Java package name. The default package name will be generated according to the output file path.
|
|
21
21
|
*
|
|
22
22
|
* @exampleMarkdown
|
|
23
|
-
* ```
|
|
23
|
+
* ```yaml
|
|
24
24
|
* generates:
|
|
25
25
|
* src/main/java/my-org/my-app/Resolvers.java:
|
|
26
26
|
* plugins:
|
|
@@ -34,7 +34,7 @@ export interface JavaResolversPluginRawConfig extends RawConfig {
|
|
|
34
34
|
* @description Overrides the default value of enum values declared in your GraphQL schema.
|
|
35
35
|
*
|
|
36
36
|
* @exampleMarkdown
|
|
37
|
-
* ```
|
|
37
|
+
* ```yaml
|
|
38
38
|
* config:
|
|
39
39
|
* enumValues:
|
|
40
40
|
* MyEnum:
|
|
@@ -47,7 +47,7 @@ export interface JavaResolversPluginRawConfig extends RawConfig {
|
|
|
47
47
|
* @description Allow you to customize the parent class name.
|
|
48
48
|
*
|
|
49
49
|
* @exampleMarkdown
|
|
50
|
-
* ```
|
|
50
|
+
* ```yaml
|
|
51
51
|
* generates:
|
|
52
52
|
* src/main/java/my-org/my-app/MyGeneratedTypes.java:
|
|
53
53
|
* plugins:
|
|
@@ -62,7 +62,7 @@ export interface JavaResolversPluginRawConfig extends RawConfig {
|
|
|
62
62
|
* @description Allow you to customize the list type
|
|
63
63
|
*
|
|
64
64
|
* @exampleMarkdown
|
|
65
|
-
* ```
|
|
65
|
+
* ```yaml
|
|
66
66
|
* generates:
|
|
67
67
|
* src/main/java/my-org/my-app/Types.java:
|
|
68
68
|
* plugins:
|
|
@@ -77,7 +77,7 @@ export interface JavaResolversPluginRawConfig extends RawConfig {
|
|
|
77
77
|
* @description If true, will create empty constructor instead of args map
|
|
78
78
|
*
|
|
79
79
|
* @exampleMarkdown
|
|
80
|
-
* ```
|
|
80
|
+
* ```yaml
|
|
81
81
|
* generates:
|
|
82
82
|
* src/main/java/my-org/my-app/Types.java:
|
|
83
83
|
* plugins:
|
package/index.js
CHANGED
|
@@ -109,7 +109,7 @@ class JavaResolversVisitor extends visitorPluginCommon.BaseVisitor {
|
|
|
109
109
|
const typeName = convertedName.endsWith('Input') ? convertedName : `${convertedName}Input`;
|
|
110
110
|
result = {
|
|
111
111
|
baseType: typeName,
|
|
112
|
-
typeName
|
|
112
|
+
typeName,
|
|
113
113
|
isScalar: false,
|
|
114
114
|
isEnum: false,
|
|
115
115
|
isArray,
|
|
@@ -173,14 +173,12 @@ class JavaResolversVisitor extends visitorPluginCommon.BaseVisitor {
|
|
|
173
173
|
this.${this.config.classMembersPrefix}${arg.name.value} = ${typeToUse.typeName}.valueOf((String) args.get("${arg.name.value}"));
|
|
174
174
|
}`, 3);
|
|
175
175
|
}
|
|
176
|
+
else if (arg.name.value === 'interface') {
|
|
177
|
+
// forcing prefix of _ since interface is a keyword in JAVA
|
|
178
|
+
return visitorPluginCommon.indent(`this._${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
179
|
+
}
|
|
176
180
|
else {
|
|
177
|
-
|
|
178
|
-
// forcing prefix of _ since interface is a keyword in JAVA
|
|
179
|
-
return visitorPluginCommon.indent(`this._${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
return visitorPluginCommon.indent(`this.${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
183
|
-
}
|
|
181
|
+
return visitorPluginCommon.indent(`this.${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
184
182
|
}
|
|
185
183
|
})
|
|
186
184
|
.join('\n');
|
package/index.mjs
CHANGED
|
@@ -105,7 +105,7 @@ class JavaResolversVisitor extends BaseVisitor {
|
|
|
105
105
|
const typeName = convertedName.endsWith('Input') ? convertedName : `${convertedName}Input`;
|
|
106
106
|
result = {
|
|
107
107
|
baseType: typeName,
|
|
108
|
-
typeName
|
|
108
|
+
typeName,
|
|
109
109
|
isScalar: false,
|
|
110
110
|
isEnum: false,
|
|
111
111
|
isArray,
|
|
@@ -169,14 +169,12 @@ class JavaResolversVisitor extends BaseVisitor {
|
|
|
169
169
|
this.${this.config.classMembersPrefix}${arg.name.value} = ${typeToUse.typeName}.valueOf((String) args.get("${arg.name.value}"));
|
|
170
170
|
}`, 3);
|
|
171
171
|
}
|
|
172
|
+
else if (arg.name.value === 'interface') {
|
|
173
|
+
// forcing prefix of _ since interface is a keyword in JAVA
|
|
174
|
+
return indent(`this._${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
175
|
+
}
|
|
172
176
|
else {
|
|
173
|
-
|
|
174
|
-
// forcing prefix of _ since interface is a keyword in JAVA
|
|
175
|
-
return indent(`this._${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
return indent(`this.${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
179
|
-
}
|
|
177
|
+
return indent(`this.${this.config.classMembersPrefix}${arg.name.value} = new ${typeToUse.typeName}((Map<String, Object>) args.get("${arg.name.value}"));`, 3);
|
|
180
178
|
}
|
|
181
179
|
})
|
|
182
180
|
.join('\n');
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/java",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.12",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating Java code based on a GraphQL schema",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-codegen/java-common": "^2.1.
|
|
9
|
+
"@graphql-codegen/java-common": "^2.1.18",
|
|
10
10
|
"@graphql-codegen/plugin-helpers": "^2.4.0",
|
|
11
|
-
"@graphql-codegen/visitor-plugin-common": "2.
|
|
12
|
-
"tslib": "~2.
|
|
11
|
+
"@graphql-codegen/visitor-plugin-common": "2.8.0",
|
|
12
|
+
"tslib": "~2.4.0"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|