在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Cox-Automotive/apollo-client-maven-plugin开源软件地址(OpenSource Url):https://github.com/aoudiamoncef/apollo-client-maven-plugin开源编程语言(OpenSource Language):Kotlin 98.3%开源软件介绍(OpenSource Introduction):Apollo GraphQL Client Code Generation Maven PluginMaven plugin that calls the Apollo Kotlin compiler to generate your Java/Kotlin sources. Usage
Apollo 2 support
Getting Started
Configuration OptionsAll plugin configuration properties and their defaults: <configuration>
<services>
<!--Complete default configuration-->
<lahzouz-complete-api>
<enabled>true</enabled>
<addSourceRoot>true</addSourceRoot>
<sourceFolder>${project.basedir}/src/main/graphql/lahzouz</sourceFolder>
<schemaPath>${project.basedir}/src/main/graphql/lahzouz/schema.json</schemaPath>
<includes>
<include>**/*.graphql</include>
<include>**/*.gql</include>
<include>**/*.json</include>
<include>**/*.sdl"</include>
</includes>
<excludes></excludes>
<compilationUnit>
<name>lahzouz</name>
<outputDirectory>
${project.build.directory}/generated-sources/graphql-client/lahzouz/
</outputDirectory>
<testDirectory>
${project.build.directory}/generated-sources/graphql-client/lahzouz/test/
</testDirectory>
<debugDirectory>
${project.build.directory}/generated-sources/graphql-client/lahzouz/debug/
</debugDirectory>
<operationOutputFile>
${project.build.directory}/generated/operationOutput/apollo/lahzouz/operationOutput.json
</operationOutputFile>
<generateOperationDescriptors>false</generateOperationDescriptors>
<compilerParams>
<rootFolders>
<rootFolder>${project.basedir}/src/main/graphql/lahzouz/</rootFolder>
</rootFolders>
<customScalarsMapping></customScalarsMapping>
<operationIdGeneratorClass></operationIdGeneratorClass>
<schemaPackageName>com.lahzouz.apollo.graphql.client</schemaPackageName>
<packageName>com.lahzouz.apollo.graphql.client</packageName>
<codegenModels>OPERATION</codegenModels>
<flattenModels>true</flattenModels>
<generateApolloMetadata>false</generateApolloMetadata>
<generateAsInternal>false</generateAsInternal>
<generateFilterNotNull>false</generateFilterNotNull>
<generateFragmentImplementations>false</generateFragmentImplementations>
<generateKotlinModels>false</generateKotlinModels>
<generateOptionalOperationVariables>false</generateOptionalOperationVariables>
<generateQueryDocument>true</generateQueryDocument>
<generateResponseFields>false</generateResponseFields>
<generateSchema>false</generateSchema>
<generateTestBuilders>false</generateTestBuilders>
<moduleName>apollographql</moduleName>
<useSemanticNaming>true</useSemanticNaming>
<targetLanguage>JAVA</targetLanguage>
<sealedClassesForEnumsMatching></sealedClassesForEnumsMatching>
<alwaysGenerateTypesMatching></alwaysGenerateTypesMatching>
<metadataOutputFile>
${project.build.directory}/generated/metadata/apollo/lahzouz/metadata.json
</metadataOutputFile>
</compilerParams>
</compilationUnit>
<introspection>
<enabled>false</enabled>
<endpointUrl></endpointUrl>
<headers></headers>
<schemaFile>${project.basedir}/src/main/graphql/lahzouz/schema.json</schemaFile>
<connectTimeoutSeconds>10</connectTimeoutSeconds>
<readTimeoutSeconds>10</readTimeoutSeconds>
<writeTimeoutSeconds>10</writeTimeoutSeconds>
<useSelfSignedCertificat>false</useSelfSignedCertificat>
<useGzip>false</useGzip>
<prettyPrint>false</prettyPrint>
</introspection>
</lahzouz-complete-api>
<!--Minimal configuration-->
<lahzouz-min-api>
<compilationUnit>
<name>lahzouz</name>
</compilationUnit>
</lahzouz-min-api>
<!--Auto configuration-->
<lahzouz></lahzouz>
</services>
</configuration> Custom TypesTo use custom Scalar Types you need to define mapping configuration then register your custom adapter: <configuration>
...
<customScalarsMapping>
<Long>java.time.LocalDate</Long>
</customScalarsMapping>
...
</configuration> Implementation of a custom adapter for public class DateGraphQLAdapter implements Adapter<Date> {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
@Override
public Date fromJson(@NotNull final JsonReader jsonReader, @NotNull final CustomScalarAdapters customScalarAdapters) throws IOException {
try {
return DATE_FORMAT.parse(jsonReader.nextString());
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
@Override
public void toJson(@NotNull final JsonWriter jsonWriter, @NotNull final CustomScalarAdapters customScalarAdapters, final Date date) throws IOException {
jsonWriter.value(DATE_FORMAT.format(date));
}
} Using Apollo ClientSee documentation |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论