├── _config.yml ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── custom.md │ └── feature_request.md └── pull_request_template.md ├── src ├── test │ ├── resources │ │ ├── json │ │ │ ├── mappingconfig3.json │ │ │ ├── mappingconfig4.conf │ │ │ ├── mappingconfig5.conf │ │ │ ├── mappingconfig.json │ │ │ └── mappingconfig2.json │ │ ├── schemas │ │ │ ├── multi2.graphqls │ │ │ ├── empty.graphqls │ │ │ ├── primitive-query-response-type.graphqls │ │ │ ├── sub-proj_1 │ │ │ │ └── sub-schema1.graphqls │ │ │ ├── sub-proj_2 │ │ │ │ └── sub-schema2.graphqls │ │ │ ├── multi1.graphqls │ │ │ ├── kt │ │ │ │ ├── default.graphqls │ │ │ │ ├── suspend.graphqls │ │ │ │ ├── nullable-custom-type-with-api-return-type.graphqls │ │ │ │ ├── customTypesMapping-directive.graphqls │ │ │ │ ├── nullable-extend.graphqls │ │ │ │ └── restricted-words.graphqls │ │ │ ├── union-with-enum.graphqls │ │ │ ├── optional-vs-mandatory-types.graphqls │ │ │ ├── input.graphqls │ │ │ ├── invalid.graphqls │ │ │ ├── type-interface-duplicate-fields.graphqls │ │ │ ├── type-interface-duplicate-fields1.graphqls │ │ │ ├── queries-same-name.graphqls │ │ │ ├── union-resolver.graphqls │ │ │ ├── no-queries.graphqls │ │ │ ├── empty-types.graphqls │ │ │ ├── interfaces.graphqls │ │ │ ├── relay.graphqls │ │ │ ├── external-type-extend.graphqls │ │ │ ├── scala │ │ │ │ └── null-extend3.graphqls │ │ │ ├── only-extend-queries.graphqls │ │ │ ├── types-as-interfaces-parametrized.graphqls │ │ │ ├── union-projection.graphqls │ │ │ ├── date-scalar.graphqls │ │ │ ├── restricted-words.graphqls │ │ │ ├── nullable-list-type-with-nullable-sub-types.graphqls │ │ │ ├── parametrized-input-client.graphqls │ │ │ ├── types-as-interfaces.graphqls │ │ │ ├── types-as-interfaces-extends-interface.graphqls │ │ │ ├── projection-interfaces.graphqls │ │ │ ├── defaults.graphqls │ │ │ ├── fields-with-data-fetcher-result.graphqls │ │ │ ├── extend1.graphqls │ │ │ ├── input-wrapper.graphqls │ │ │ └── defaults-with-Long.graphqls │ │ ├── expected-classes │ │ │ ├── kt │ │ │ │ ├── empty │ │ │ │ │ ├── Event.kt.txt │ │ │ │ │ ├── Node.kt.txt │ │ │ │ │ ├── EventInput.kt.txt │ │ │ │ │ ├── PinnableItem.kt.txt │ │ │ │ │ ├── QueryResolver.kt.txt │ │ │ │ │ ├── MutationResolver.kt.txt │ │ │ │ │ └── Status.kt.txt │ │ │ │ ├── relay │ │ │ │ │ ├── Organization.kt.txt │ │ │ │ │ ├── User.kt.txt │ │ │ │ │ ├── UsersQueryResolver.kt.txt │ │ │ │ │ ├── OrganizationsQueryResolver.kt.txt │ │ │ │ │ ├── UsersQueryResolver_reactive.kt.txt │ │ │ │ │ └── QueryResolver.kt.txt │ │ │ │ ├── suspend │ │ │ │ │ ├── Friend.kt.txt │ │ │ │ │ ├── QueryResolver.kt.txt │ │ │ │ │ └── FriendsQueryResolver.kt.txt │ │ │ │ ├── deprecated │ │ │ │ │ ├── PinnableItem.kt.txt │ │ │ │ │ ├── Node.kt.txt │ │ │ │ │ ├── EventInput.kt.txt │ │ │ │ │ ├── QueryResolver.kt.txt │ │ │ │ │ ├── Status.kt.txt │ │ │ │ │ ├── EventsQueryResolver.kt.txt │ │ │ │ │ ├── MutationResolver.kt.txt │ │ │ │ │ ├── CreateEventMutationResolver.kt.txt │ │ │ │ │ └── Event.kt.txt │ │ │ │ ├── optional │ │ │ │ │ └── InterfaceWithOptionalField.kt.txt │ │ │ │ ├── enum-union │ │ │ │ │ ├── EnumUnion.kt.txt │ │ │ │ │ ├── EnumMember1.kt.txt │ │ │ │ │ └── EnumMember2.kt.txt │ │ │ │ ├── restricted-words │ │ │ │ │ ├── Char.kt.txt │ │ │ │ │ ├── TestEnum.kt.txt │ │ │ │ │ ├── WhenQueryAPI.kt.txt │ │ │ │ │ └── FunQueryResponse.kt.txt │ │ │ │ ├── types-as-interfaces-extends-interface │ │ │ │ │ ├── Node.kt.txt │ │ │ │ │ ├── Profile.kt.txt │ │ │ │ │ ├── QueryResolver.kt.txt │ │ │ │ │ ├── User.kt.txt │ │ │ │ │ └── UserCurrentQueryResolver.kt.txt │ │ │ │ ├── interfaces │ │ │ │ │ ├── Bar.kt.txt │ │ │ │ │ ├── BarBar.kt.txt │ │ │ │ │ ├── Bar1.kt.txt │ │ │ │ │ ├── Foo.kt.txt │ │ │ │ │ └── Foo1.kt.txt │ │ │ │ ├── nullable │ │ │ │ │ ├── Null1QueryQueryResolver.kt.txt │ │ │ │ │ ├── Null4QueryQueryResolver.kt.txt │ │ │ │ │ ├── Null2QueryQueryResolver.kt.txt │ │ │ │ │ ├── Null3QueryQueryResolver.kt.txt │ │ │ │ │ ├── Null5QueryQueryResolver.kt.txt │ │ │ │ │ └── NullableCustomTypeWithApiReturnType.kt.txt │ │ │ │ ├── jackson-resolver-union │ │ │ │ │ ├── without-model-package │ │ │ │ │ │ ├── MyUnionMemberASuffix.kt.txt │ │ │ │ │ │ ├── MyUnionMemberBSuffix.kt.txt │ │ │ │ │ │ ├── MyUnionToResolveSuffix.kt.txt │ │ │ │ │ │ └── MyResultObjectSuffix.kt.txt │ │ │ │ │ ├── UnionMemberA.kt.txt │ │ │ │ │ ├── UnionMemberB.kt.txt │ │ │ │ │ ├── UnionToResolve.kt.txt │ │ │ │ │ └── ResultObject.kt.txt │ │ │ │ ├── types-as-interfaces │ │ │ │ │ ├── Order.kt.txt │ │ │ │ │ ├── User.kt.txt │ │ │ │ │ ├── QueryResolver.kt.txt │ │ │ │ │ ├── UserCurrentQueryResolver.kt.txt │ │ │ │ │ └── UserResolver.kt.txt │ │ │ │ ├── CodesOfConductQueryResolver.kt.txt │ │ │ │ ├── GithubActorTO.kt.txt │ │ │ │ ├── AddLabelsToLabelableMutationResolver.kt.txt │ │ │ │ ├── field-resolver │ │ │ │ │ ├── AcceptTopicSuggestionMutationWithAnnotation.kt.txt │ │ │ │ │ ├── AcceptTopicSuggestionPayloadResolver.kt.txt │ │ │ │ │ └── AcceptTopicSuggestionMutationWithAnnotations.kt.txt │ │ │ │ └── VersionQueryResponse_int.kt.txt │ │ │ ├── empty │ │ │ │ ├── Node.java.txt │ │ │ │ ├── PinnableItem.java.txt │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ └── Status.java.txt │ │ │ ├── scala │ │ │ │ ├── empty │ │ │ │ │ ├── Node.scala.txt │ │ │ │ │ ├── PinnableItem.scala.txt │ │ │ │ │ ├── QueryResolver.scala.txt │ │ │ │ │ ├── MutationResolver.scala.txt │ │ │ │ │ ├── Event.scala.txt │ │ │ │ │ ├── EventInput.scala.txt │ │ │ │ │ └── Status.scala.txt │ │ │ │ ├── extend │ │ │ │ │ ├── PinnableItem.scala.txt │ │ │ │ │ ├── AssetsQueryResolver.scala.txt │ │ │ │ │ ├── EventsQueryResolver.scala.txt │ │ │ │ │ ├── Node.scala.txt │ │ │ │ │ ├── nullreturn │ │ │ │ │ │ ├── SimplesQueryResolver.scala.txt │ │ │ │ │ │ ├── SimplesQueryResolver_without_option.scala.txt │ │ │ │ │ │ ├── SimpleEventCountQueryResolver.scala.txt │ │ │ │ │ │ ├── SimpleEventCountsQueryResolver.scala.txt │ │ │ │ │ │ ├── SimplesQueryResponse.scala.txt │ │ │ │ │ │ └── SimplesQueryResponse_without_option.scala.txt │ │ │ │ │ ├── nullable │ │ │ │ │ │ ├── Null3QueryQueryResolver.scala.txt │ │ │ │ │ │ ├── Null1QueryQueryResolver.scala.txt │ │ │ │ │ │ ├── Null2QueryQueryResolver.scala.txt │ │ │ │ │ │ └── QueryResolver.scala.txt │ │ │ │ │ ├── resolver │ │ │ │ │ │ ├── SimpleEventCountQueryResolver.scala.txt │ │ │ │ │ │ ├── SimpleEventCountsQueryResolver.scala.txt │ │ │ │ │ │ └── SimpleEventCountQueryResponse.scala.txt │ │ │ │ │ ├── AssetInput.scala.txt │ │ │ │ │ ├── CreateAssetMutationResolver.scala.txt │ │ │ │ │ ├── CreateEventMutationResolver.scala.txt │ │ │ │ │ ├── EventInput.scala.txt │ │ │ │ │ ├── QueryResolver.scala.txt │ │ │ │ │ ├── MutationResolver.scala.txt │ │ │ │ │ ├── Status.scala.txt │ │ │ │ │ ├── Asset.scala.txt │ │ │ │ │ └── Event.scala.txt │ │ │ │ ├── deprecated │ │ │ │ │ ├── PinnableItem.scala.txt │ │ │ │ │ ├── Node.scala.txt │ │ │ │ │ ├── QueryResolver.scala.txt │ │ │ │ │ ├── EventsQueryResolver.scala.txt │ │ │ │ │ ├── MutationResolver.scala.txt │ │ │ │ │ ├── EventInput.scala.txt │ │ │ │ │ ├── CreateEventMutationResolver.scala.txt │ │ │ │ │ └── Status.scala.txt │ │ │ │ ├── optional │ │ │ │ │ └── InterfaceWithOptionalField.scala.txt │ │ │ │ ├── enum-union │ │ │ │ │ ├── EnumUnion.scala.txt │ │ │ │ │ ├── EnumMember1.scala.txt │ │ │ │ │ └── EnumMember2.scala.txt │ │ │ │ ├── types-as-interfaces-extends-interface │ │ │ │ │ ├── Node.scala.txt │ │ │ │ │ ├── QueryResolver.scala.txt │ │ │ │ │ ├── UserCurrentQueryResolver.scala.txt │ │ │ │ │ ├── User.scala.txt │ │ │ │ │ └── Profile.scala.txt │ │ │ │ ├── relay │ │ │ │ │ ├── Organization.scala.txt │ │ │ │ │ ├── User.scala.txt │ │ │ │ │ ├── UsersQueryResolver.scala.txt │ │ │ │ │ ├── UsersQueryResolver_reactive.scala.txt │ │ │ │ │ ├── OrganizationsQueryResolver.scala.txt │ │ │ │ │ └── QueryResolver.scala.txt │ │ │ │ ├── types-as-interfaces │ │ │ │ │ ├── QueryResolver.scala.txt │ │ │ │ │ ├── UserCurrentQueryResolver.scala.txt │ │ │ │ │ ├── Order.scala.txt │ │ │ │ │ ├── User.scala.txt │ │ │ │ │ └── UserResolver.scala.txt │ │ │ │ ├── CodesOfConductQueryResolver.scala.txt │ │ │ │ ├── jackson-resolver-union │ │ │ │ │ ├── without-model-package │ │ │ │ │ │ ├── MyUnionMemberBSuffix.scala.txt │ │ │ │ │ │ ├── MyUnionMemberASuffix.scala.txt │ │ │ │ │ │ ├── MyUnionToResolveSuffix.scala.txt │ │ │ │ │ │ └── MyResultObjectSuffix.scala.txt │ │ │ │ │ ├── UnionMemberB.scala.txt │ │ │ │ │ ├── UnionMemberA.scala.txt │ │ │ │ │ ├── UnionToResolve.scala.txt │ │ │ │ │ └── ResultObject.scala.txt │ │ │ │ ├── AddLabelsToLabelableMutationResolver.scala.txt │ │ │ │ ├── annotation │ │ │ │ │ ├── User.scala.txt │ │ │ │ │ ├── MutationResolver.scala.txt │ │ │ │ │ └── CreateEventMutationResolver.scala.txt │ │ │ │ ├── custom-type │ │ │ │ │ └── ResponseContainingDate.scala.txt │ │ │ │ └── VersionQueryResponse_int.scala.txt │ │ │ ├── extend │ │ │ │ ├── PinnableItem.java.txt │ │ │ │ ├── AssetsQueryResolver.java.txt │ │ │ │ ├── EventsQueryResolver.java.txt │ │ │ │ ├── Node.java.txt │ │ │ │ ├── CreateAssetMutationResolver.java.txt │ │ │ │ ├── CreateEventMutationResolver.java.txt │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ └── Status.java.txt │ │ │ ├── EmptyQueryResolver.java.txt │ │ │ ├── EmptyMutationResolver.java.txt │ │ │ ├── extend-with-resolvers │ │ │ │ ├── PinnableItem.java.txt │ │ │ │ ├── Node.java.txt │ │ │ │ ├── AssetsQueryResolver.java.txt │ │ │ │ ├── EventsQueryResolver.java.txt │ │ │ │ ├── NodeResolver.java.txt │ │ │ │ ├── CreateAssetMutationResolver.java.txt │ │ │ │ ├── CreateEventMutationResolver.java.txt │ │ │ │ ├── EventResolver.java.txt │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ └── Status.java.txt │ │ │ ├── MyUnion.java.txt │ │ │ ├── enum-union │ │ │ │ ├── EnumUnion.java.txt │ │ │ │ ├── EnumMember1.java.txt │ │ │ │ └── EnumMember2.java.txt │ │ │ ├── optional │ │ │ │ ├── InterfaceWithOptionalField.java.txt │ │ │ │ ├── MetaQueryResolver.java.txt │ │ │ │ ├── NodeQueryResolver.java.txt │ │ │ │ ├── NodeQueryResolver_mono.java.txt │ │ │ │ └── NodesQueryResolver.java.txt │ │ │ ├── resolvers │ │ │ │ ├── A.java.txt │ │ │ │ ├── EventResolver.java.txt │ │ │ │ └── AcceptTopicSuggestionPayloadResolver.java.txt │ │ │ ├── restricted-words │ │ │ │ ├── Char.java.txt │ │ │ │ ├── NativeQueryAPI.java.txt │ │ │ │ ├── CaseQueryAPI.java.txt │ │ │ │ ├── PrivateQueryAPI.java.txt │ │ │ │ ├── QueryAPI.java.txt │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── TestEnum.java.txt │ │ │ │ └── CaseQueryResponse.java.txt │ │ │ ├── deprecated │ │ │ │ ├── PinnableItem.java.txt │ │ │ │ ├── Node.java.txt │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── EventsQueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ ├── CreateEventMutationResolver.java.txt │ │ │ │ └── Status.java.txt │ │ │ ├── types-as-interfaces-extends-interface │ │ │ │ ├── Node.java.txt │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── UserCurrentQueryResolver.java.txt │ │ │ │ └── User.java.txt │ │ │ ├── types-as-interfaces │ │ │ │ ├── QueryResolver.java.txt │ │ │ │ ├── UserCurrentQueryResolver.java.txt │ │ │ │ ├── Order.java.txt │ │ │ │ ├── User.java.txt │ │ │ │ └── UserResolver.java.txt │ │ │ ├── interfaces │ │ │ │ ├── Bar.java.txt │ │ │ │ ├── BarBar.java.txt │ │ │ │ └── Foo.java.txt │ │ │ ├── apis │ │ │ │ └── CodeOfConductQueryResolver_withoutThrowsException.java.txt │ │ │ ├── relay │ │ │ │ ├── UsersQueryResolver.java.txt │ │ │ │ ├── OrganizationsQueryResolver.java.txt │ │ │ │ ├── UsersQueryResolver_reactive.java.txt │ │ │ │ └── QueryResolver.java.txt │ │ │ ├── from-introspection-result │ │ │ │ ├── ProductsQueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ ├── ProductByIdQueryResolver.java.txt │ │ │ │ ├── CreateMutationResolver.java.txt │ │ │ │ ├── ProductsByIdsQueryResolver.java.txt │ │ │ │ └── QueryResolver.java.txt │ │ │ ├── custom-type │ │ │ │ └── ExternalResolver.java.txt │ │ │ ├── ProductsByIdsQueryResolver.java.txt │ │ │ ├── SubscriptionResolver.java.txt │ │ │ ├── types-as-interfaces-parametrized │ │ │ │ └── Foo.java.txt │ │ │ ├── VersionQueryResolver.java.txt │ │ │ ├── MutationResolver.java.txt │ │ │ ├── ProductsByCategoryIdAndStatusQueryResolver.java.txt │ │ │ ├── jackson-resolver-union │ │ │ │ ├── without-model-package │ │ │ │ │ ├── MyUnionToResolveSuffix.java.txt │ │ │ │ │ └── MyResultObjectSuffix.java.txt │ │ │ │ ├── UnionToResolve.java.txt │ │ │ │ └── ResultObject.java.txt │ │ │ ├── EventsCreatedSubscriptionResolver.java.txt │ │ │ ├── EventByIdQueryResolver.java.txt │ │ │ ├── parent-interfaces │ │ │ │ ├── SubscriptionResolver.java.txt │ │ │ │ ├── VersionQueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ ├── EventsCreatedSubscriptionResolver.java.txt │ │ │ │ └── CreateEventMutationResolver.java.txt │ │ │ ├── input-wrapper │ │ │ │ └── MyEnum.java.txt │ │ │ ├── EventsByIdsQueryResolver.java.txt │ │ │ ├── CreateEventMutationResolver.java.txt │ │ │ ├── defaults │ │ │ │ ├── MyEnum.java.txt │ │ │ │ ├── MyEnumTO.java.txt │ │ │ │ └── MyEnumDTO.java.txt │ │ │ ├── unknown-fields │ │ │ │ └── MyEnum.java.txt │ │ │ ├── default-custom-types │ │ │ │ └── MyEnum.java.txt │ │ │ ├── annotation │ │ │ │ ├── NullableListReturnTypeWithMandatoryElementsQueryResolver.java.txt │ │ │ │ ├── MutationResolver.java.txt │ │ │ │ └── CreateEventMutationResolver.java.txt │ │ │ ├── EventsByCategoryAndStatusQueryResolver.java.txt │ │ │ └── response │ │ │ │ └── VersionQueryResponse_int.java.txt │ │ └── template │ │ │ └── record_type.ftl │ └── java │ │ └── com │ │ └── kobylynskyi │ │ └── graphql │ │ └── codegen │ │ └── model │ │ └── graphql │ │ └── data │ │ └── Status.java └── main │ ├── java │ └── com │ │ └── kobylynskyi │ │ └── graphql │ │ └── codegen │ │ ├── model │ │ ├── graphql │ │ │ ├── GraphQLOperation.java │ │ │ ├── GraphQLParametrizedInput.java │ │ │ ├── GraphQLErrorType.java │ │ │ ├── UnableToBuildJsonQueryException.java │ │ │ └── GraphQLResponse.java │ │ ├── Combinable.java │ │ ├── exception │ │ │ ├── UnableToCreateFileException.java │ │ │ ├── SchemaValidationException.java │ │ │ ├── UnableToDeleteDirectoryException.java │ │ │ ├── UnableToLoadFreeMarkerTemplateException.java │ │ │ ├── UnableToCreateDirectoryException.java │ │ │ └── LanguageNotSupportedException.java │ │ ├── ApiInterfaceStrategy.java │ │ ├── definitions │ │ │ └── ExtendedScalarTypeDefinition.java │ │ └── GeneratedLanguage.java │ │ ├── generators │ │ ├── FilesGenerator.java │ │ └── FreeMarkerTemplateType.java │ │ ├── supplier │ │ └── MappingConfigSupplier.java │ │ └── mapper │ │ └── MapperFactory.java │ └── resources │ └── templates │ ├── java-lang │ └── union.ftl │ ├── kotlin-lang │ └── union.ftl │ └── scala-lang │ └── union.ftl ├── plugins ├── gradle │ ├── example-server │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── kobylynskyi │ │ │ │ └── product │ │ │ │ ├── model │ │ │ │ ├── StockStatus.java │ │ │ │ ├── ProductNotFoundException.java │ │ │ │ └── Product.java │ │ │ │ ├── Application.java │ │ │ │ └── repository │ │ │ │ └── ProductRepository.java │ │ └── settings.gradle │ ├── example-client │ │ ├── settings.gradle │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── kobylynskyi │ │ │ │ └── order │ │ │ │ ├── model │ │ │ │ ├── StockStatus.java │ │ │ │ ├── OrderNotFoundException.java │ │ │ │ ├── UnableToCreateProductException.java │ │ │ │ ├── Product.java │ │ │ │ ├── UnableToRetrieveProductException.java │ │ │ │ ├── Item.java │ │ │ │ ├── UnableToRetrieveProductsException.java │ │ │ │ └── Order.java │ │ │ │ ├── repository │ │ │ │ └── OrderRepository.java │ │ │ │ ├── Application.java │ │ │ │ ├── external │ │ │ │ ├── product │ │ │ │ │ ├── ExternalProductMapper.java │ │ │ │ │ └── ProductInput.java │ │ │ │ └── config │ │ │ │ │ └── RestClientsConfiguration.java │ │ │ │ └── graphql │ │ │ │ └── mappers │ │ │ │ └── OrderMapper.java │ │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── external │ │ │ └── schema-starwars-service.graphqls │ │ │ └── schema.graphqls │ ├── example-client-kotlin │ │ └── settings.gradle │ └── graphql-java-codegen-gradle-plugin │ │ └── settings.gradle ├── maven │ ├── example-server │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── kobylynskyi │ │ │ └── product │ │ │ ├── model │ │ │ ├── StockStatus.java │ │ │ ├── ProductNotFoundException.java │ │ │ └── Product.java │ │ │ ├── Application.java │ │ │ └── repository │ │ │ └── ProductRepository.java │ └── example-client │ │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── kobylynskyi │ │ │ └── order │ │ │ ├── model │ │ │ ├── StockStatus.java │ │ │ ├── OrderNotFoundException.java │ │ │ ├── UnableToCreateProductException.java │ │ │ ├── Product.java │ │ │ ├── UnableToRetrieveProductException.java │ │ │ ├── Item.java │ │ │ ├── UnableToRetrieveProductsException.java │ │ │ └── Order.java │ │ │ ├── repository │ │ │ └── OrderRepository.java │ │ │ ├── Application.java │ │ │ ├── external │ │ │ ├── product │ │ │ │ ├── ExternalProductMapper.java │ │ │ │ └── ProductInput.java │ │ │ └── config │ │ │ │ └── RestClientsConfiguration.java │ │ │ └── graphql │ │ │ └── mappers │ │ │ └── OrderMapper.java │ │ └── resources │ │ ├── application.yml │ │ ├── external │ │ └── schema-starwars-service.graphqls │ │ └── schema.graphqls └── sbt │ └── graphql-java-codegen-sbt-plugin │ ├── project │ ├── build.properties │ ├── plugins.sbt │ └── Commands.scala │ ├── version.sbt │ ├── src │ ├── sbt-test │ │ └── graphql-codegen-sbt-plugin │ │ │ ├── simple │ │ │ ├── project │ │ │ │ ├── build.properties │ │ │ │ └── plugins.sbt │ │ │ ├── version.sbt │ │ │ └── test │ │ │ ├── example-client │ │ │ ├── project │ │ │ │ ├── build.properties │ │ │ │ └── plugins.sbt │ │ │ ├── version.sbt │ │ │ ├── test │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── log4j2.xml │ │ │ └── example-client-scala │ │ │ ├── project │ │ │ ├── build.properties │ │ │ └── plugins.sbt │ │ │ ├── version.sbt │ │ │ ├── test │ │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── log4j2.xml │ ├── test │ │ └── scala │ │ │ └── test │ │ │ └── Test.scala │ └── main │ │ └── scala │ │ └── io │ │ └── github │ │ └── dreamylost │ │ └── graphql │ │ └── codegen │ │ ├── ParentInterfacesConfig.scala │ │ └── SchemaFinderConfig.scala │ └── .scalafmt.conf ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── .gitignore └── scripts └── update-release-version-in-readme.sh /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://send.monobank.ua/jar/2bpWyBqBp3'] 2 | -------------------------------------------------------------------------------- /src/test/resources/json/mappingconfig3.json: -------------------------------------------------------------------------------- 1 | { 2 | "generateToString": false 3 | } -------------------------------------------------------------------------------- /plugins/gradle/example-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 -------------------------------------------------------------------------------- /plugins/maven/example-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.9.0 -------------------------------------------------------------------------------- /src/test/resources/json/mappingconfig4.conf: -------------------------------------------------------------------------------- 1 | generateToString = true 2 | generateApis = true 3 | -------------------------------------------------------------------------------- /src/test/resources/json/mappingconfig5.conf: -------------------------------------------------------------------------------- 1 | generateToString = false 2 | generateApis = false 3 | -------------------------------------------------------------------------------- /src/test/resources/schemas/multi2.graphqls: -------------------------------------------------------------------------------- 1 | type UnionMember2 { 2 | someField: String 3 | } 4 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt: -------------------------------------------------------------------------------- 1 | ThisBuild / version := "5.10.1-SNAPSHOT" 2 | -------------------------------------------------------------------------------- /src/test/resources/schemas/empty.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | mutation: Mutation 4 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/primitive-query-response-type.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | version: Int! 3 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/sub-proj_1/sub-schema1.graphqls: -------------------------------------------------------------------------------- 1 | extend type Query { 2 | ping: String! 3 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/sub-proj_2/sub-schema2.graphqls: -------------------------------------------------------------------------------- 1 | extend type Query { 2 | pong: String! 3 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.4.7 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kobylynskyi/graphql-java-codegen/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.4.7 -------------------------------------------------------------------------------- /src/test/resources/schemas/multi1.graphqls: -------------------------------------------------------------------------------- 1 | type UnionMember1 { 2 | someField: Int 3 | } 4 | 5 | union MyUnion = UnionMember1 | UnionMember2 -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.4.7 -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt: -------------------------------------------------------------------------------- 1 | version in ThisBuild := "5.10.1-SNAPSHOT" 2 | -------------------------------------------------------------------------------- /src/test/resources/schemas/kt/default.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | friends(num: Int!): [Friend] 3 | } 4 | 5 | type Friend { 6 | name: String 7 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt: -------------------------------------------------------------------------------- 1 | version in ThisBuild := "5.10.1-SNAPSHOT" 2 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt: -------------------------------------------------------------------------------- 1 | version in ThisBuild := "5.10.1-SNAPSHOT" 2 | -------------------------------------------------------------------------------- /src/test/resources/schemas/kt/suspend.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | friends(num: Int!): [Friend!]! 3 | } 4 | 5 | type Friend { 6 | name: String! 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/schemas/kt/nullable-custom-type-with-api-return-type.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | nullable: ZonedDateTime 3 | mandatory: ZonedDateTime! 4 | } 5 | -------------------------------------------------------------------------------- /src/test/java/com/kobylynskyi/graphql/codegen/model/graphql/data/Status.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.graphql.data; 2 | 3 | public enum Status { 4 | OPEN 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/schemas/union-with-enum.graphqls: -------------------------------------------------------------------------------- 1 | enum EnumMember1 { 2 | VALUE 3 | } 4 | 5 | enum EnumMember2 { 6 | OTHER_VALUE 7 | } 8 | 9 | union EnumUnion = EnumMember1 | EnumMember2 -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #signing.keyId=keyId 2 | #signing.password=password 3 | #signing.secretKeyRingFile=secretKeyRingFile 4 | 5 | sonatypeUsername=sonartypeUsername 6 | sonatypePassword=sonartypePassword -------------------------------------------------------------------------------- /plugins/gradle/example-client/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = "example-client" -------------------------------------------------------------------------------- /plugins/gradle/example-server/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = "example-server" -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.10.1-SNAPSHOT") 2 | -------------------------------------------------------------------------------- /plugins/gradle/example-client-kotlin/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | rootProject.name = 'example-client-kotlin' 8 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.10.1-SNAPSHOT") 2 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/Event.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | open class Event() -------------------------------------------------------------------------------- /src/test/resources/json/mappingconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "generateApis": true, 3 | "packageName": "com.kobylynskyi.graphql.testconfigjson", 4 | "customTypesMapping": { 5 | "Price.amount": "java.math.BigDecimal" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/optional-vs-mandatory-types.graphqls: -------------------------------------------------------------------------------- 1 | type TypeWithMandatoryField implements InterfaceWithOptionalField { 2 | test: Int! 3 | } 4 | 5 | interface InterfaceWithOptionalField { 6 | test: Int 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/Node.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface Node { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/empty/Node.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface Node { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/EventInput.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | open class EventInput() -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/Node.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait Node { 6 | 7 | } -------------------------------------------------------------------------------- /plugins/gradle/graphql-java-codegen-gradle-plugin/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = "graphql-java-codegen-gradle-plugin" -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/PinnableItem.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface PinnableItem { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/empty/PinnableItem.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface PinnableItem { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/PinnableItem.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface PinnableItem { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/QueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface QueryResolver { 6 | 7 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") 2 | addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") 3 | addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") 4 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/EmptyQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface QueryResolver { 7 | 8 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/empty/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface QueryResolver { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/MutationResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface MutationResolver { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/PinnableItem.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait PinnableItem { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait QueryResolver { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/json/mappingconfig2.json: -------------------------------------------------------------------------------- 1 | { 2 | "generateApis": true, 3 | "packageName": "com.kobylynskyi.graphql.testconfigjson", 4 | "customTypesMapping": { 5 | "Price.amount": "java.math.BigDecimal" 6 | }, 7 | "generateToString": true 8 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/empty/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface MutationResolver { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/empty/Status.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | enum class Status(val graphqlName: String) { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/MutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait MutationResolver { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/PinnableItem.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait PinnableItem { 7 | 8 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/EmptyMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface MutationResolver { 7 | 8 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/PinnableItem.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface PinnableItem { 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/relay/Organization.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | data class Organization( 6 | val id: String 7 | ) { 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/input.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | repro(input: ReproInput!): ReproOutput 7 | } 8 | 9 | input ReproInput { 10 | reproField: [String!]! 11 | } 12 | 13 | type ReproOutput { 14 | id: ID! 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/suspend/Friend.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | data class Friend( 6 | val name: String 7 | ) { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/schemas/invalid.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | # The query root. 4 | query: Query 5 | 6 | # The mutation root. 7 | mutation: Mutation 8 | } 9 | 10 | type Query 1 { 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/type-interface-duplicate-fields.graphqls: -------------------------------------------------------------------------------- 1 | interface NamedEntity { 2 | # an awesome name! 3 | name: String @deprecated 4 | } 5 | 6 | type Person implements NamedEntity { 7 | name: String 8 | 9 | # age in years 10 | age: Int 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/relay/User.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | data class User( 6 | val id: String, 7 | val name: String? 8 | ) { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/type-interface-duplicate-fields1.graphqls: -------------------------------------------------------------------------------- 1 | interface NamedEntity { 2 | name: String @shouldnotbehere 3 | } 4 | 5 | type Person implements NamedEntity { 6 | # an awesome name! 7 | name: String @deprecated 8 | 9 | # age in years 10 | age: Int 11 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLOperation.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.graphql; 2 | 3 | /** 4 | * GraphQL operations 5 | */ 6 | public enum GraphQLOperation { 7 | 8 | QUERY, 9 | MUTATION, 10 | SUBSCRIPTION 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/PinnableItem.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface PinnableItem { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/optional/InterfaceWithOptionalField.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface InterfaceWithOptionalField { 6 | 7 | val test: Int? 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/queries-same-name.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | mutation: Mutation 4 | } 5 | 6 | type Query { 7 | products(categoryId: ID!, status: String!): [Product] 8 | products(ids: [ID!]!): [Product] 9 | } 10 | 11 | type Product { 12 | id: ID 13 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/union-resolver.graphqls: -------------------------------------------------------------------------------- 1 | interface ResultObject { 2 | list: [UnionToResolve!] 3 | } 4 | 5 | type UnionMemberA { 6 | someField: Int 7 | } 8 | 9 | type UnionMemberB { 10 | someField: String 11 | } 12 | 13 | union UnionToResolve = UnionMemberA | UnionMemberB -------------------------------------------------------------------------------- /src/test/resources/expected-classes/MyUnion.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.multifiles; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface MyUnion { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/enum-union/EnumUnion.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface EnumUnion { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/restricted-words/Char.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface Char { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/PinnableItem.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait PinnableItem { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/Event.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class Event( 8 | ) { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/optional/InterfaceWithOptionalField.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait InterfaceWithOptionalField { 6 | 7 | val test: Int 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/no-queries.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | # The query root. 4 | query: Query 5 | 6 | # The mutation root. 7 | mutation: Mutation 8 | } 9 | 10 | type Query { 11 | } 12 | 13 | type Mutation { 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/enum-union/EnumUnion.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface EnumUnion { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/optional/InterfaceWithOptionalField.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface InterfaceWithOptionalField { 6 | 7 | Integer getTest(); 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/resolvers/A.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface A { 9 | 10 | String getFoo(); 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/Char.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Char { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/PinnableItem.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface PinnableItem { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces-extends-interface/Node.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface Node { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/EventInput.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class EventInput( 8 | ) { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/enum-union/EnumUnion.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait EnumUnion { 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/kt/customTypesMapping-directive.graphqls: -------------------------------------------------------------------------------- 1 | directive @NotNull(message : String, groups: ValidationGroup) on INPUT_FIELD_DEFINITION 2 | 3 | schema { 4 | query: Query 5 | } 6 | 7 | input TrustAccountInput 8 | { 9 | accountId: String! @NotNull(message: "test", groups: CAMS) 10 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/StockStatus.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public enum StockStatus { 4 | 5 | IN_STOCK, 6 | SPECIAL_ORDER, 7 | BACK_ORDERED, 8 | COMING_SOON, 9 | SOLD_OUT, 10 | DISCONTINUED 11 | 12 | } 13 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/StockStatus.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public enum StockStatus { 4 | 5 | IN_STOCK, 6 | SPECIAL_ORDER, 7 | BACK_ORDERED, 8 | COMING_SOON, 9 | SOLD_OUT, 10 | DISCONTINUED 11 | 12 | } 13 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/test/scala/test/Test.scala: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | /** @author 4 | * 梦境迷离 5 | * @version 1.0,2020/7/15 6 | */ 7 | object Test { 8 | 9 | import io.github.dreamylost.graphql.codegen.GraphQLCodegenPlugin 10 | 11 | val s = GraphQLCodegenPlugin 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces-extends-interface/Node.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait Node { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces-extends-interface/Node.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Node { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ### Description 4 | 5 | Related to #ISSUE_NUMBER 6 | 7 | --- 8 | 9 | Changes were made to: 10 | - [ ] Codegen library - Java 11 | - [ ] Codegen library - Kotlin 12 | - [ ] Codegen library - Scala 13 | - [ ] Maven plugin 14 | - [ ] Gradle plugin 15 | - [ ] SBT plugin 16 | -------------------------------------------------------------------------------- /plugins/gradle/example-server/src/main/java/io/github/kobylynskyi/product/model/StockStatus.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.model; 2 | 3 | public enum StockStatus { 4 | 5 | IN_STOCK, 6 | SPECIAL_ORDER, 7 | BACK_ORDERED, 8 | COMING_SOON, 9 | SOLD_OUT, 10 | DISCONTINUED 11 | 12 | } 13 | -------------------------------------------------------------------------------- /plugins/maven/example-server/src/main/java/io/github/kobylynskyi/product/model/StockStatus.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.model; 2 | 3 | public enum StockStatus { 4 | 5 | IN_STOCK, 6 | SPECIAL_ORDER, 7 | BACK_ORDERED, 8 | COMING_SOON, 9 | SOLD_OUT, 10 | DISCONTINUED 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/AssetsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface AssetsQueryResolver { 6 | 7 | java.util.List assets() throws Exception; 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/EventsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface EventsQueryResolver { 6 | 7 | java.util.List events() throws Exception; 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/interfaces/Bar.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface Bar { 9 | 10 | val id: String 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/Node.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface Node { 6 | 7 | @javax.validation.constraints.NotNull 8 | String getId(); 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/AssetsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface AssetsQueryResolver { 6 | 7 | java.util.List assets() throws Exception; 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/EventsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface EventsQueryResolver { 6 | 7 | java.util.List events() throws Exception; 8 | 9 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | 4 | external: 5 | service: 6 | product: 7 | url: http://localhost:8081/graphql 8 | starwars: 9 | url: http://localhost:8081/star-wars/graphql 10 | 11 | graphql: 12 | tools: 13 | schemaLocationPattern: '**/schema.graphqls' -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | 4 | external: 5 | service: 6 | product: 7 | url: http://localhost:8081/graphql 8 | starwars: 9 | url: http://localhost:8081/star-wars/graphql 10 | 11 | graphql: 12 | tools: 13 | schemaLocationPattern: '**/schema.graphqls' -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/interfaces/BarBar.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface BarBar : Bar { 9 | 10 | override val id: String 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/nullable/Null1QueryQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface Null1QueryQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun null1Query(): Int? 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/nullable/Null4QueryQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface Null4QueryQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun null4Query(): List 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/AssetsQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait AssetsQueryResolver { 7 | 8 | @throws[Exception] 9 | def assets(): scala.Seq[Asset] 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/EventsQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait EventsQueryResolver { 7 | 8 | @throws[Exception] 9 | def events(): scala.Seq[Event] 10 | 11 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/test: -------------------------------------------------------------------------------- 1 | # check if the file gets created 2 | > graphqlCodegen 3 | > graphqlSchemaValidate src/main/resources/schema.graphql 4 | > graphqlCodegenValidate 5 | > compile 6 | $ exists target/scala-2.13/src_managed_graphql/io/github/kobylynskyi/graphql/test/model/User.java 7 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/Node.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface Node { 6 | 7 | @javax.validation.constraints.NotNull 8 | String getId(); 9 | 10 | String getCreatedBy(); 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/interfaces/Bar1.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class Bar1( 9 | override 10 | val id: String 11 | ) : Bar { 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/nullable/Null2QueryQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface Null2QueryQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun null2Query(): List? 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/nullable/Null3QueryQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface Null3QueryQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun null3Query(): List? 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/nullable/Null5QueryQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface Null5QueryQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun null5Query(): List 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/suspend/QueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface QueryResolver { 6 | 7 | @Throws(Exception::class) 8 | suspend fun friends(num: Int): List 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/schemas/empty-types.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | query: Query 4 | mutation: Mutation 5 | } 6 | 7 | type Query 8 | 9 | type Mutation 10 | 11 | type Event 12 | 13 | input EventInput 14 | 15 | enum Status 16 | 17 | interface Node 18 | 19 | union PinnableItem -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/test: -------------------------------------------------------------------------------- 1 | # check if the file gets created 2 | > graphqlCodegen 3 | > graphqlSchemaValidate src/main/resources/schema.graphqls 4 | > graphqlCodegenValidate 5 | > compile 6 | $ exists target/scala-2.12/src_managed_graphql_my_folder/io/github/dreamylost/model/CharacterDO.java -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/without-model-package/MyUnionMemberASuffix.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | data class MyUnionMemberASuffix( 6 | val someField: Int? 7 | ) : MyUnionToResolveSuffix { 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/without-model-package/MyUnionMemberBSuffix.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | data class MyUnionMemberBSuffix( 6 | val someField: String? 7 | ) : MyUnionToResolveSuffix { 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/Node.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait Node { 7 | 8 | @javax.validation.constraints.NotNull 9 | val id: String 10 | 11 | val createdBy: String 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullreturn/SimplesQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait SimplesQueryResolver { 6 | 7 | @throws[Exception] 8 | def simples(): scala.Option[Event] 9 | 10 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/test: -------------------------------------------------------------------------------- 1 | # check if the file gets created 2 | > graphqlCodegen 3 | > graphqlSchemaValidate src/main/resources/schema.graphqls 4 | > graphqlCodegenValidate 5 | > compile 6 | $ exists target/scala-2.12/src_managed_graphql_scala/io/github/dreamylost/model/CharacterDO.scala -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/generators/FilesGenerator.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.generators; 2 | 3 | import java.io.File; 4 | import java.util.List; 5 | 6 | /** 7 | * Represents files generator 8 | */ 9 | @FunctionalInterface 10 | public interface FilesGenerator { 11 | 12 | List generate(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/enum-union/EnumMember1.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion 2 | 3 | @javax.annotation.Generated( 4 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | enum class EnumMember1(val graphqlName: String) : EnumUnion { 8 | 9 | VALUE("VALUE") 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/interfaces/Foo.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface Foo { 9 | 10 | val id: String 11 | 12 | val bars: List? 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/suspend/FriendsQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface FriendsQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | suspend fun friends(num: Int): List 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces/Order.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface Order { 9 | 10 | val number: String 11 | 12 | val price: String 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces/User.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface User { 9 | 10 | val username: String 11 | 12 | val email: String 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/schemas/interfaces.graphqls: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | id: ID! 3 | bars: [Bar] 4 | } 5 | 6 | interface Bar { 7 | id: ID! 8 | } 9 | 10 | type Foo1 implements Foo { 11 | id: ID! 12 | bars: [Bar1] 13 | } 14 | 15 | type Bar1 implements Bar { 16 | id: ID! 17 | } 18 | 19 | interface BarBar implements Bar { 20 | id: ID! 21 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/repository/OrderRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.repository; 2 | 3 | import io.github.kobylynskyi.order.model.Order; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | 6 | public interface OrderRepository extends MongoRepository { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/OrderNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public class OrderNotFoundException extends Exception { 4 | 5 | public OrderNotFoundException(String id) { 6 | super(String.format("Order with id '%s' does not exist", id)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/repository/OrderRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.repository; 2 | 3 | import io.github.kobylynskyi.order.model.Order; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | 6 | public interface OrderRepository extends MongoRepository { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLParametrizedInput.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.graphql; 2 | 3 | /** 4 | * The implementation class should contain the input values of the field definition. 5 | */ 6 | public interface GraphQLParametrizedInput { 7 | 8 | GraphQLParametrizedInput deepCopy(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/Node.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface Node { 9 | 10 | @Deprecated(message = "test deprecated with msg") 11 | val id: String 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullable/Null3QueryQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait Null3QueryQueryResolver { 7 | 8 | @throws[Exception] 9 | def null3Query(): scala.Seq[Int] 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullreturn/SimplesQueryResolver_without_option.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait SimplesQueryResolver { 7 | 8 | @throws[Exception] 9 | def simples(): Event 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/resolver/SimpleEventCountQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait SimpleEventCountQueryResolver { 6 | 7 | @throws[Exception] 8 | def simpleEventCount(): Int 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface QueryResolver { 9 | 10 | User userCurrent() throws Exception; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/schemas/relay.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | users(first: Int!, after: String): UserConnection @connection(for: "User") 3 | organizations(first: Int, after: String): OrganizationConnection @connection(for: "Organization") 4 | } 5 | 6 | type User { 7 | id: ID! 8 | name: String 9 | } 10 | 11 | type Organization { 12 | id: ID! 13 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/OrderNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public class OrderNotFoundException extends Exception { 4 | 5 | public OrderNotFoundException(String id) { 6 | super(String.format("Order with id '%s' does not exist", id)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/NodeResolver.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Resolver for Node 3 | */ 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface NodeResolver { 9 | 10 | String createdBy(Node node) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/optional/MetaQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface MetaQueryResolver { 7 | 8 | @javax.validation.constraints.NotNull 9 | GitHubMetadata meta() throws Exception; 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullable/Null1QueryQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait Null1QueryQueryResolver { 7 | 8 | @throws[Exception] 9 | def null1Query(): scala.Option[Int] 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/external-type-extend.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | external(name: String!): External! 7 | } 8 | 9 | # This is expected to be defined elsewhere and configured via a custom type mapping 10 | # type External { 11 | # name: String! 12 | # } 13 | 14 | extend type External { 15 | age: Int! 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/interfaces/Bar.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Bar { 9 | 10 | @javax.validation.constraints.NotNull 11 | String getId(); 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/enum-union/EnumMember2.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion 2 | 3 | @javax.annotation.Generated( 4 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | enum class EnumMember2(val graphqlName: String) : EnumUnion { 8 | 9 | OTHER_VALUE("OTHER_VALUE") 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/restricted-words/TestEnum.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot 2 | 3 | @javax.annotation.Generated( 4 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | enum class TestEnum(val graphqlName: String) { 8 | 9 | long("long"), 10 | short("short") 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/NativeQueryAPI.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface NativeQueryAPI { 9 | 10 | String Native() throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullreturn/SimpleEventCountQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait SimpleEventCountQueryResolver { 7 | 8 | @throws[Exception] 9 | def simpleEventCount(): Int 10 | 11 | } -------------------------------------------------------------------------------- /plugins/gradle/example-server/src/main/java/io/github/kobylynskyi/product/model/ProductNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.model; 2 | 3 | public class ProductNotFoundException extends Exception { 4 | 5 | public ProductNotFoundException(String id) { 6 | super(String.format("Product with id '%s' does not exist", id)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /plugins/maven/example-server/src/main/java/io/github/kobylynskyi/product/model/ProductNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.model; 2 | 3 | public class ProductNotFoundException extends Exception { 4 | 5 | public ProductNotFoundException(String id) { 6 | super(String.format("Product with id '%s' does not exist", id)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/UnionMemberA.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class UnionMemberA( 9 | val someField: Int? 10 | ) : UnionToResolve { 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/UnionMemberB.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class UnionMemberB( 9 | val someField: String? 10 | ) : UnionToResolve { 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/optional/NodeQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface NodeQueryResolver { 7 | 8 | java.util.Optional node(@javax.validation.constraints.NotNull String id) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/AssetInput.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class AssetInput( 8 | @javax.validation.constraints.NotNull 9 | name: String 10 | ) { 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullable/Null2QueryQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait Null2QueryQueryResolver { 7 | 8 | @throws[Exception] 9 | def null2Query(): scala.Seq[scala.Option[Int]] 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/scala/null-extend3.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | events: [Event!] 7 | event: Event 8 | null1Query: Int 9 | null2Query: [Int] 10 | null3Query: [Int!] 11 | } 12 | 13 | type Event implements Node { 14 | nullableStatus: [Int] 15 | nonullStatus: [Int!] 16 | nullablePrimitive: Int 17 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/EventInput.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class EventInput( 9 | @Deprecated(message = "test deprecated with msg") 10 | val status: Status 11 | ) { 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces-extends-interface/Profile.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class Profile( 9 | val firstName: String, 10 | val lastName: String 11 | ) { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces/QueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface QueryResolver { 9 | 10 | @Throws(Exception::class) 11 | fun userCurrent(): User? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/resolver/SimpleEventCountsQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait SimpleEventCountsQueryResolver { 6 | 7 | @throws[Exception] 8 | def simpleEventCounts(): scala.Option[Int] 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/relay/Organization.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class Organization( 8 | @javax.validation.constraints.NotNull 9 | id: String 10 | ) { 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait QueryResolver { 9 | 10 | @throws[Exception] 11 | def userCurrent(): User 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces-extends-interface/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface QueryResolver { 9 | 10 | User userCurrent() throws Exception; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/Node.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Node { 9 | 10 | @Deprecated 11 | @javax.validation.constraints.NotNull 12 | String getId(); 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/interfaces/BarBar.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface BarBar extends Bar{ 9 | 10 | @javax.validation.constraints.NotNull 11 | String getId(); 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullreturn/SimpleEventCountsQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait SimpleEventCountsQueryResolver { 7 | 8 | @throws[Exception] 9 | def simpleEventCounts(): scala.Option[Int] 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/relay/User.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class User( 8 | @javax.validation.constraints.NotNull 9 | id: String, 10 | name: String 11 | ) { 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces/UserCurrentQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface UserCurrentQueryResolver { 9 | 10 | User userCurrent() throws Exception; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/UnableToCreateProductException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public class UnableToCreateProductException extends Exception { 4 | 5 | public UnableToCreateProductException(String message) { 6 | super(String.format("Unable to create product: %s", message)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/UnableToCreateProductException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public class UnableToCreateProductException extends Exception { 4 | 5 | public UnableToCreateProductException(String message) { 6 | super(String.format("Unable to create product: %s", message)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface QueryResolver { 9 | 10 | @Deprecated 11 | java.util.List events() throws Exception; 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/CaseQueryAPI.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface CaseQueryAPI { 9 | 10 | String Case(java.util.List Final) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/only-extend-queries.graphqls: -------------------------------------------------------------------------------- 1 | extend type Query { 2 | user(userId: ID!): User 3 | } 4 | 5 | extend type Mutation { 6 | createUser(input: UserInput!): User 7 | } 8 | 9 | extend type Subscription { 10 | usersCreated: [User] 11 | } 12 | 13 | type User { 14 | id: ID! 15 | name: String! 16 | } 17 | 18 | input UserInput { 19 | name: String! 20 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/types-as-interfaces-parametrized.graphqls: -------------------------------------------------------------------------------- 1 | """ 2 | used with typesAsInterfaces config 3 | """ 4 | directive @asInterface on OBJECT 5 | 6 | """ 7 | used with fieldsWithResolvers config 8 | """ 9 | directive @noResolver on FIELD_DEFINITION 10 | 11 | type Foo @asInterface { 12 | simpleField: String! 13 | parameterizedField(count: Int!): String! @noResolver 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/apis/CodeOfConductQueryResolver_withoutThrowsException.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface CodeOfConductQueryResolver { 7 | 8 | CodeOfConduct codeOfConduct(@javax.validation.constraints.NotNull String key); 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/interfaces/Foo1.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class Foo1( 9 | override 10 | val id: String, 11 | override 12 | val bars: List? 13 | ) : Foo { 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces-extends-interface/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait QueryResolver { 9 | 10 | @throws[Exception] 11 | def userCurrent(): User 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/CodesOfConductQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface CodesOfConductQueryResolver { 9 | 10 | @Throws(Exception::class) 11 | fun codesOfConduct(): List? 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces-extends-interface/QueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface QueryResolver { 9 | 10 | @Throws(Exception::class) 11 | fun userCurrent(): User? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces/UserCurrentQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface UserCurrentQueryResolver { 9 | 10 | @Throws(Exception::class) 11 | fun userCurrent(): User? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/relay/UsersQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface UsersQueryResolver { 7 | 8 | graphql.relay.Connection users(int first, String after, graphql.schema.DataFetchingEnvironment env) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces/UserCurrentQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait UserCurrentQueryResolver { 9 | 10 | @throws[Exception] 11 | def userCurrent(): User 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces-extends-interface/UserCurrentQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface UserCurrentQueryResolver { 9 | 10 | User userCurrent() throws Exception; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/EventsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface EventsQueryResolver { 9 | 10 | @Deprecated 11 | java.util.List events() throws Exception; 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/from-introspection-result/ProductsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface ProductsQueryResolver { 9 | 10 | java.util.List products() throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/restricted-words/WhenQueryAPI.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface WhenQueryAPI { 9 | 10 | @Throws(Exception::class) 11 | fun `when`(final: List?): String? 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/CodesOfConductQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait CodesOfConductQueryResolver { 9 | 10 | @throws[Exception] 11 | def codesOfConduct(): scala.Seq[CodeOfConduct] 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/optional/NodeQueryResolver_mono.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface NodeQueryResolver { 7 | 8 | reactor.core.publisher.Mono> node(@javax.validation.constraints.NotNull String id) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/Product.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Data 9 | public class Product { 10 | 11 | @Id 12 | private String id; 13 | private String title; 14 | private BigDecimal price; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/Product.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Data 9 | public class Product { 10 | 11 | @Id 12 | private String id; 13 | private String title; 14 | private BigDecimal price; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/relay/UsersQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface UsersQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun users(first: Int, after: String?, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/PrivateQueryAPI.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface PrivateQueryAPI { 9 | 10 | Synchronized Private(Integer Int, String New, TestEnum Enum) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/Node.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait Node { 9 | 10 | @deprecated(message = "test deprecated with msg") 11 | @javax.validation.constraints.NotNull 12 | val id: String 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/CreateAssetMutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait CreateAssetMutationResolver { 7 | 8 | @javax.validation.constraints.NotNull 9 | @throws[Exception] 10 | def createAsset(input: AssetInput): Asset 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/CreateEventMutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait CreateEventMutationResolver { 7 | 8 | @javax.validation.constraints.NotNull 9 | @throws[Exception] 10 | def createEvent(input: EventInput): Event 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/relay/UsersQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait UsersQueryResolver { 6 | 7 | @throws[Exception] 8 | def users(first: Int, after: String, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection[User] 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/GithubActorTO.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface GithubActorTO { 9 | 10 | var avatarUrl: String 11 | 12 | var login: String? 13 | 14 | var resourcePath: String 15 | 16 | var url: String 17 | 18 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/QueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface QueryResolver { 9 | 10 | @Deprecated(message = "No longer supported") 11 | @Throws(Exception::class) 12 | fun events(): List? 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/Status.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | @javax.annotation.Generated( 4 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | enum class Status(val graphqlName: String) { 8 | 9 | @Deprecated(message = "test deprecated with msg") 10 | CREATED("CREATED"), 11 | IN_PROGRESS("IN_PROGRESS") 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces-extends-interface/User.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface User : Node { 9 | 10 | val username: String 11 | 12 | val email: String 13 | 14 | val profile: Profile? 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces-extends-interface/UserCurrentQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface UserCurrentQueryResolver { 9 | 10 | @Throws(Exception::class) 11 | fun userCurrent(): User? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces-extends-interface/UserCurrentQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait UserCurrentQueryResolver { 9 | 10 | @throws[Exception] 11 | def userCurrent(): User 12 | 13 | } 14 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/UnableToRetrieveProductException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public class UnableToRetrieveProductException extends Exception { 4 | 5 | public UnableToRetrieveProductException(String id, String message) { 6 | super(String.format("Unable to retrieve product with id '%s': %s", id, message)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/interfaces/Foo.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Foo { 9 | 10 | @javax.validation.constraints.NotNull 11 | String getId(); 12 | 13 | java.util.List getBars(); 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/resolvers/EventResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | /** 5 | * Resolver for Event 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface EventResolver { 12 | 13 | java.util.List properties(Event event) throws Exception; 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait QueryResolver { 9 | 10 | @deprecated(message = "No longer supported") 11 | @throws[Exception] 12 | def events(): scala.Seq[Event] 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/enum-union/EnumMember1.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | object EnumMember1 extends Enumeration with EnumUnion { 8 | 9 | type EnumMember1 = Value 10 | 11 | val VALUE: Value = Value("VALUE") 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/without-model-package/MyUnionMemberBSuffix.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class MyUnionMemberBSuffix( 8 | someField: String 9 | ) extends MyUnionToResolveSuffix { 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/union-projection.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | vehicleById(vehicleId: ID!): UnionToResolve 7 | } 8 | 9 | interface ResultObject { 10 | list: [UnionToResolve!] 11 | } 12 | 13 | type UnionMemberA { 14 | someField: Int 15 | } 16 | 17 | type UnionMemberB { 18 | someField: String 19 | } 20 | 21 | union UnionToResolve = UnionMemberA | UnionMemberB -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/UnableToRetrieveProductException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | public class UnableToRetrieveProductException extends Exception { 4 | 5 | public UnableToRetrieveProductException(String id, String message) { 6 | super(String.format("Unable to retrieve product with id '%s': %s", id, message)); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/CreateAssetMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface CreateAssetMutationResolver { 6 | 7 | @javax.validation.constraints.NotNull 8 | Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/CreateEventMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface CreateEventMutationResolver { 6 | 7 | @javax.validation.constraints.NotNull 8 | Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/empty/Status.scala.txt: -------------------------------------------------------------------------------- 1 | import com.fasterxml.jackson.core.`type`.TypeReference 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | object Status extends Enumeration { 8 | 9 | type Status = Value 10 | 11 | 12 | } 13 | 14 | class StatusTypeRefer extends TypeReference[Status.type] -------------------------------------------------------------------------------- /src/test/resources/expected-classes/custom-type/ExternalResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Resolver for External 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface ExternalResolver { 12 | 13 | int age(com.example.External external) throws Exception; 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/EventsQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface EventsQueryResolver { 9 | 10 | @Deprecated(message = "No longer supported") 11 | @Throws(Exception::class) 12 | fun events(): List? 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/types-as-interfaces/UserResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | /** 5 | * Resolver for User 6 | */ 7 | @javax.annotation.Generated( 8 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | interface UserResolver { 12 | 13 | @Throws(Exception::class) 14 | fun orders(user: User): List 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/optional/NodesQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface NodesQueryResolver { 7 | 8 | @javax.validation.constraints.NotNull 9 | java.util.List nodes(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/relay/OrganizationsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface OrganizationsQueryResolver { 7 | 8 | graphql.relay.Connection organizations(Integer first, String after, graphql.schema.DataFetchingEnvironment env) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/EventsQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait EventsQueryResolver { 9 | 10 | @deprecated(message = "No longer supported") 11 | @throws[Exception] 12 | def events(): scala.Seq[Event] 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/UnionMemberB.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | import scala.collection.JavaConverters._ 4 | 5 | @javax.annotation.Generated( 6 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | case class UnionMemberB( 10 | someField: String 11 | ) extends UnionToResolve { 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/without-model-package/MyUnionMemberASuffix.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | case class MyUnionMemberASuffix( 8 | someField: scala.Option[Int] 9 | ) extends MyUnionToResolveSuffix { 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/from-introspection-result/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface MutationResolver { 9 | 10 | Product create(@javax.validation.constraints.NotNull ProductInput productInput) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/relay/UsersQueryResolver_reactive.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface UsersQueryResolver { 7 | 8 | reactor.core.publisher.Mono> users(int first, String after, graphql.schema.DataFetchingEnvironment env) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/enum-union/EnumMember2.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | object EnumMember2 extends Enumeration with EnumUnion { 8 | 9 | type EnumMember2 = Value 10 | 11 | val OTHER_VALUE: Value = Value("OTHER_VALUE") 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/EventInput.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | import Status._ 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | case class EventInput( 9 | @javax.validation.constraints.NotNull 10 | status: Status, 11 | assets: scala.Seq[AssetInput] 12 | ) { 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/date-scalar.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | queryINeed( 3 | input: ZonedDateTime! 4 | ): [ResponseContainingDate] 5 | otherQueryUsedAsExample( 6 | input: InputContainingDate! 7 | ): String 8 | } 9 | 10 | type ResponseContainingDate{ 11 | a: ZonedDateTime 12 | } 13 | 14 | input InputContainingDate{ 15 | a: ZonedDateTime 16 | } 17 | 18 | # ZonedDateTime Scalar 19 | scalar ZonedDateTime -------------------------------------------------------------------------------- /src/test/resources/schemas/restricted-words.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | native: String 7 | private(int: Int, new: String, enum: TestEnum = long): Synchronized 8 | case(final: [char]): ID 9 | } 10 | 11 | type Synchronized { 12 | void: String 13 | wait: char 14 | class: String 15 | } 16 | 17 | enum TestEnum { 18 | long, 19 | short 20 | } 21 | 22 | interface char { 23 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/main/scala/io/github/dreamylost/graphql/codegen/ParentInterfacesConfig.scala: -------------------------------------------------------------------------------- 1 | package io.github.dreamylost.graphql.codegen 2 | 3 | /** @author 4 | * 梦境迷离 5 | * @version 1.0,2020/7/15 6 | */ 7 | final case class ParentInterfacesConfig( 8 | queryResolver: String = null, 9 | mutationResolver: String = null, 10 | subscriptionResolver: String = null, 11 | resolver: String = null 12 | ) 13 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/Combinable.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model; 2 | 3 | /** 4 | * The interface Combinable. 5 | * 6 | * @param the type parameter 7 | * @author valinha 8 | */ 9 | @FunctionalInterface 10 | public interface Combinable { 11 | /** 12 | * Combine with source. 13 | * 14 | * @param source the source 15 | */ 16 | void combine(T source); 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/CreateAssetMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface CreateAssetMutationResolver { 6 | 7 | @javax.validation.constraints.NotNull 8 | Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/CreateEventMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface CreateEventMutationResolver { 6 | 7 | @javax.validation.constraints.NotNull 8 | Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/EventResolver.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Resolver for Event 3 | */ 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface EventResolver { 9 | 10 | /** 11 | * Optional list of assets 12 | */ 13 | java.util.List assets(Event event) throws Exception; 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/from-introspection-result/ProductByIdQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface ProductByIdQueryResolver { 9 | 10 | Product productById(@javax.validation.constraints.NotNull String id) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/MutationResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface MutationResolver { 9 | 10 | @Deprecated(message = "test deprecated with msg") 11 | @Throws(Exception::class) 12 | fun createEvent(input: EventInput): Event 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/UnionMemberA.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | import scala.collection.JavaConverters._ 4 | 5 | @javax.annotation.Generated( 6 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | case class UnionMemberA( 10 | someField: scala.Option[Int] 11 | ) extends UnionToResolve { 12 | 13 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/Application.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/Application.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/from-introspection-result/CreateMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface CreateMutationResolver { 9 | 10 | Product create(@javax.validation.constraints.NotNull ProductInput productInput) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/relay/OrganizationsQueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface OrganizationsQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun organizations(first: Int?, after: String?, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection 9 | 10 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | build 3 | .idea 4 | .gradle 5 | *.iml 6 | modules.xml 7 | .idea/misc.xml 8 | *.ipr 9 | bin/ 10 | .classpath 11 | .project 12 | .settings/ 13 | 14 | ### Maven ### 15 | target/ 16 | pom.xml.tag 17 | pom.xml.releaseBackup 18 | pom.xml.versionsBackup 19 | pom.xml.next 20 | release.properties 21 | dependency-reduced-pom.xml 22 | buildNumber.properties 23 | .mvn/timing.properties 24 | .mvn/wrapper/maven-wrapper.jar 25 | .flattened-pom.xml 26 | -------------------------------------------------------------------------------- /plugins/maven/example-server/src/main/java/io/github/kobylynskyi/product/Application.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | sys.props.get("plugin.version").orElse(Some("5.10.1-SNAPSHOT")) match { 2 | case Some(x) => addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % x) 3 | case _ => sys.error("""|The system property 'plugin.version' is not defined. 4 | |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLErrorType.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.graphql; 2 | 3 | /** 4 | * Possible types of GraphQL errors 5 | * Copied from graphql-java library 6 | */ 7 | @SuppressWarnings({"java:S115"}) 8 | public enum GraphQLErrorType { 9 | InvalidSyntax, 10 | ValidationError, 11 | DataFetchingException, 12 | OperationNotSupported, 13 | ExecutionAborted 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/UnableToBuildJsonQueryException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.graphql; 2 | 3 | /** 4 | * Exception is thrown when it is unable to serialize GraphQL request to a string 5 | */ 6 | public class UnableToBuildJsonQueryException extends IllegalArgumentException { 7 | 8 | public UnableToBuildJsonQueryException(Exception e) { 9 | super(e); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/supplier/MappingConfigSupplier.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.supplier; 2 | 3 | import com.kobylynskyi.graphql.codegen.model.MappingConfig; 4 | 5 | import java.util.function.Supplier; 6 | 7 | /** 8 | * The interface Mapping config supplier. 9 | * 10 | * @author valinha 11 | */ 12 | public interface MappingConfigSupplier extends Supplier { 13 | //mark interface 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/ProductsByIdsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface ProductsByIdsQueryResolver { 9 | 10 | java.util.List products(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/relay/UsersQueryResolver_reactive.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface UsersQueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun users(first: Int, after: String?, env: graphql.schema.DataFetchingEnvironment): reactor.core.publisher.Mono> 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/relay/UsersQueryResolver_reactive.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait UsersQueryResolver { 6 | 7 | @throws[Exception] 8 | def users(first: Int, after: String, env: graphql.schema.DataFetchingEnvironment): reactor.core.publisher.Mono[graphql.relay.Connection[User]] 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces/Order.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait Order { 9 | 10 | @javax.validation.constraints.NotNull 11 | val number: String 12 | 13 | @javax.validation.constraints.NotNull 14 | val price: String 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces/User.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait User { 9 | 10 | @javax.validation.constraints.NotNull 11 | val username: String 12 | 13 | @javax.validation.constraints.NotNull 14 | val email: String 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces/Order.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Order { 9 | 10 | @javax.validation.constraints.NotNull 11 | String getNumber(); 12 | 13 | @javax.validation.constraints.NotNull 14 | String getPrice(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces/User.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface User { 9 | 10 | @javax.validation.constraints.NotNull 11 | String getUsername(); 12 | 13 | @javax.validation.constraints.NotNull 14 | String getEmail(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/schemas/nullable-list-type-with-nullable-sub-types.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | # NonNull validation annotation should not be present here 3 | nullableListReturnTypeWithMandatoryElements: [TypeWithNullableListType!] 4 | } 5 | 6 | type TypeWithNullableListType { 7 | # NonNull validation annotation should not be present here 8 | nullableListFieldWithMandatoryElements: [Type2!] 9 | } 10 | 11 | type Type2 { 12 | id: ID! 13 | } -------------------------------------------------------------------------------- /plugins/gradle/example-server/src/main/java/io/github/kobylynskyi/product/Application.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(Application.class, args); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Queries related to events 3 | * Queries related to assets 4 | */ 5 | @javax.annotation.Generated( 6 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | public interface QueryResolver { 10 | 11 | java.util.List events() throws Exception; 12 | 13 | java.util.List assets() throws Exception; 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/relay/OrganizationsQueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait OrganizationsQueryResolver { 6 | 7 | @throws[Exception] 8 | def organizations(first: scala.Option[Int], after: String, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection[Organization] 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/AddLabelsToLabelableMutationResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface AddLabelsToLabelableMutationResolver { 9 | 10 | @Throws(Exception::class) 11 | fun addLabelsToLabelable(input: AddLabelsToLabelableInput): AddLabelsToLabelablePayload? 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/AddLabelsToLabelableMutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait AddLabelsToLabelableMutationResolver { 9 | 10 | @throws[Exception] 11 | def addLabelsToLabelable(input: AddLabelsToLabelableInput): AddLabelsToLabelablePayload 12 | 13 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/external/product/ExternalProductMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.external.product; 2 | 3 | import io.github.kobylynskyi.order.model.Product; 4 | import io.github.kobylynskyi.product.graphql.model.ProductTO; 5 | import org.mapstruct.Mapper; 6 | 7 | @Mapper(componentModel = "spring") 8 | public interface ExternalProductMapper { 9 | 10 | Product map(ProductTO from); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/external/product/ExternalProductMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.external.product; 2 | 3 | import io.github.kobylynskyi.order.model.Product; 4 | import io.github.kobylynskyi.product.graphql.model.ProductTO; 5 | import org.mapstruct.Mapper; 6 | 7 | @Mapper(componentModel = "spring") 8 | public interface ExternalProductMapper { 9 | 10 | Product map(ProductTO from); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/generators/FreeMarkerTemplateType.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.generators; 2 | 3 | /** 4 | * Type of the FreeMarker template 5 | */ 6 | public enum FreeMarkerTemplateType { 7 | 8 | TYPE, 9 | ENUM, 10 | UNION, 11 | REQUEST, 12 | RESPONSE, 13 | INTERFACE, 14 | OPERATIONS, 15 | PARAMETRIZED_INPUT, 16 | RESPONSE_PROJECTION, 17 | JACKSON_TYPE_ID_RESOLVER 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/exception/UnableToCreateFileException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.exception; 2 | 3 | /** 4 | * Exception that indicates error while creating a file 5 | * 6 | * @author kobylynskyi 7 | */ 8 | public class UnableToCreateFileException extends RuntimeException { 9 | 10 | public UnableToCreateFileException(Exception e) { 11 | super("Unable to create file", e); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/CreateEventMutationResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface CreateEventMutationResolver { 9 | 10 | @Deprecated(message = "test deprecated with msg") 11 | @Throws(Exception::class) 12 | fun createEvent(input: EventInput): Event 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces/UserResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | /** 5 | * Resolver for User 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface UserResolver { 12 | 13 | @javax.validation.constraints.NotNull 14 | java.util.List orders(User user) throws Exception; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/exception/SchemaValidationException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.exception; 2 | 3 | /** 4 | * Exception that indicates invalid GraphQL schema 5 | * 6 | * @author kobylynskyi 7 | */ 8 | public class SchemaValidationException extends RuntimeException { 9 | 10 | public SchemaValidationException(String message) { 11 | super("GraphQL schema is invalid: " + message); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Queries related to events 3 | * Queries related to assets 4 | */ 5 | @javax.annotation.Generated( 6 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | public interface QueryResolver { 10 | 11 | java.util.List events() throws Exception; 12 | 13 | java.util.List assets() throws Exception; 14 | 15 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/Item.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class Item { 13 | 14 | private String productId; 15 | private int quantity; 16 | private BigDecimal total; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/Item.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class Item { 13 | 14 | private String productId; 15 | private int quantity; 16 | private BigDecimal total; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/nullable/NullableCustomTypeWithApiReturnType.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface QueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun nullable(): reactor.core.publisher.Mono 9 | 10 | @Throws(Exception::class) 11 | fun mandatory(): reactor.core.publisher.Mono 12 | 13 | } 14 | -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/UnableToRetrieveProductsException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import java.util.Collection; 4 | 5 | public class UnableToRetrieveProductsException extends Exception { 6 | 7 | public UnableToRetrieveProductsException(Collection ids, String message) { 8 | super(String.format("Unable to retrieve products with ids '%s': %s", ids, message)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/UnableToRetrieveProductsException.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import java.util.Collection; 4 | 5 | public class UnableToRetrieveProductsException extends Exception { 6 | 7 | public UnableToRetrieveProductsException(Collection ids, String message) { 8 | super(String.format("Unable to retrieve products with ids '%s': %s", ids, message)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/SubscriptionResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface SubscriptionResolver { 9 | 10 | /** 11 | * Subscribe to events 12 | */ 13 | @javax.validation.constraints.NotNull 14 | java.util.List eventsCreated() throws Exception; 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface MutationResolver { 9 | 10 | @Deprecated 11 | @javax.validation.constraints.NotNull 12 | Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/from-introspection-result/ProductsByIdsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface ProductsByIdsQueryResolver { 9 | 10 | java.util.List productsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces/UserResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | /** 5 | * Resolver for User 6 | */ 7 | @javax.annotation.Generated( 8 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | trait UserResolver { 12 | 13 | @javax.validation.constraints.NotNull 14 | @throws[Exception] 15 | def orders(user: User): scala.Seq[Order] 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces-parametrized/Foo.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface Foo { 9 | 10 | @javax.validation.constraints.NotNull 11 | String getSimpleField(); 12 | 13 | @javax.validation.constraints.NotNull 14 | String getParameterizedField(int count); 15 | 16 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/mapper/MapperFactory.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.mapper; 2 | 3 | /** 4 | * Factory for creating JVM-language-specific mappers 5 | * 6 | * @author kobylynskyi 7 | */ 8 | public interface MapperFactory { 9 | 10 | DataModelMapper getDataModelMapper(); 11 | 12 | GraphQLTypeMapper getGraphQLTypeMapper(); 13 | 14 | AnnotationsMapper getAnnotationsMapper(); 15 | 16 | ValueMapper getValueMapper(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Queries related to events 4 | * Queries related to assets 5 | */ 6 | @javax.annotation.Generated( 7 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 8 | date = "2020-12-31T23:59:59-0500" 9 | ) 10 | trait QueryResolver { 11 | 12 | @throws[Exception] 13 | def events(): scala.Seq[Event] 14 | 15 | @throws[Exception] 16 | def assets(): scala.Seq[Asset] 17 | 18 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/exception/UnableToDeleteDirectoryException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.exception; 2 | 3 | /** 4 | * Exception that indicates error while deleting directory 5 | * 6 | * @author kobylynskyi 7 | */ 8 | public class UnableToDeleteDirectoryException extends RuntimeException { 9 | 10 | public UnableToDeleteDirectoryException(Exception e) { 11 | super("Unable to delete directory", e); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/MutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait MutationResolver { 9 | 10 | @deprecated(message = "test deprecated with msg") 11 | @javax.validation.constraints.NotNull 12 | @throws[Exception] 13 | def createEvent(input: EventInput): Event 14 | 15 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/resources/external/schema-starwars-service.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | heroes(episode: Episode): [Character] 3 | } 4 | 5 | interface Character { 6 | id: String! 7 | name: String 8 | appearsIn: [Episode] 9 | } 10 | 11 | type Droid implements Character { 12 | primaryFunction: String 13 | } 14 | 15 | type Human implements Character { 16 | homePlanet: String 17 | } 18 | 19 | enum Episode { 20 | NEWHOPE 21 | EMPIRE 22 | JEDI 23 | } -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/resources/external/schema-starwars-service.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | heroes(episode: Episode): [Character] 3 | } 4 | 5 | interface Character { 6 | id: String! 7 | name: String 8 | appearsIn: [Episode] 9 | } 10 | 11 | type Droid implements Character { 12 | primaryFunction: String 13 | } 14 | 15 | type Human implements Character { 16 | homePlanet: String 17 | } 18 | 19 | enum Episode { 20 | NEWHOPE 21 | EMPIRE 22 | JEDI 23 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/empty/Status.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public enum Status { 6 | 7 | 8 | private final String graphqlName; 9 | 10 | private Status(String graphqlName) { 11 | this.graphqlName = graphqlName; 12 | } 13 | 14 | @Override 15 | public String toString() { 16 | return this.graphqlName; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/EventInput.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | import scala.collection.JavaConverters._ 4 | import Status._ 5 | 6 | @javax.annotation.Generated( 7 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 8 | date = "2020-12-31T23:59:59-0500" 9 | ) 10 | case class EventInput( 11 | @deprecated(message = "test deprecated with msg") 12 | @javax.validation.constraints.NotNull 13 | status: Status 14 | ) { 15 | 16 | } -------------------------------------------------------------------------------- /plugins/maven/example-server/src/main/java/io/github/kobylynskyi/product/repository/ProductRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.repository; 2 | 3 | import io.github.kobylynskyi.product.model.Product; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | 6 | import java.util.Collection; 7 | 8 | public interface ProductRepository extends MongoRepository { 9 | 10 | @Override 11 | Collection findAllById(Iterable ids); 12 | } 13 | -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/external/product/ProductInput.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.external.product; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class ProductInput { 13 | 14 | private String title; 15 | private String sku; 16 | private BigDecimal price; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /plugins/gradle/example-server/src/main/java/io/github/kobylynskyi/product/repository/ProductRepository.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.repository; 2 | 3 | import io.github.kobylynskyi.product.model.Product; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | 6 | import java.util.Collection; 7 | 8 | public interface ProductRepository extends MongoRepository { 9 | 10 | @Override 11 | Collection findAllById(Iterable ids); 12 | } 13 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/external/product/ProductInput.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.external.product; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class ProductInput { 13 | 14 | private String title; 15 | private String sku; 16 | private BigDecimal price; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/CreateEventMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface CreateEventMutationResolver { 9 | 10 | @Deprecated 11 | @javax.validation.constraints.NotNull 12 | Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; 13 | 14 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/CreateEventMutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait CreateEventMutationResolver { 9 | 10 | @deprecated(message = "test deprecated with msg") 11 | @javax.validation.constraints.NotNull 12 | @throws[Exception] 13 | def createEvent(input: EventInput): Event 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/ApiInterfaceStrategy.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model; 2 | 3 | /** 4 | * Strategy for creating API interface calsses 5 | */ 6 | public enum ApiInterfaceStrategy { 7 | 8 | /** 9 | * Generate separate interface classes for each GraphQL operation. 10 | */ 11 | INTERFACE_PER_OPERATION, 12 | 13 | /** 14 | * Do not generate separate interfaces classes for GraphQL operation. 15 | */ 16 | DO_NOT_GENERATE 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/VersionQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Version of the application. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface VersionQueryResolver { 12 | 13 | /** 14 | * Version of the application. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | String version() throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/QueryAPI.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface QueryAPI { 9 | 10 | String Native() throws Exception; 11 | 12 | Synchronized Private(Integer Int, String New, TestEnum Enum) throws Exception; 13 | 14 | String Case(java.util.List Final) throws Exception; 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/MutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait MutationResolver { 7 | 8 | @javax.validation.constraints.NotNull 9 | @throws[Exception] 10 | def createEvent(input: EventInput): Event 11 | 12 | @javax.validation.constraints.NotNull 13 | @throws[Exception] 14 | def createAsset(input: AssetInput): Asset 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces-extends-interface/User.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait User extends Node { 9 | 10 | @javax.validation.constraints.NotNull 11 | val username: String 12 | 13 | @javax.validation.constraints.NotNull 14 | val email: String 15 | 16 | val profile: Profile 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/types-as-interfaces-extends-interface/User.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface User extends Node{ 9 | 10 | @javax.validation.constraints.NotNull 11 | String getUsername(); 12 | 13 | @javax.validation.constraints.NotNull 14 | String getEmail(); 15 | 16 | Profile getProfile(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/definitions/ExtendedScalarTypeDefinition.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.definitions; 2 | 3 | import graphql.language.ScalarTypeDefinition; 4 | import graphql.language.ScalarTypeExtensionDefinition; 5 | 6 | /** 7 | * Extended definition of GraphQL scalar type: based definition + its extensions 8 | */ 9 | public class ExtendedScalarTypeDefinition 10 | extends ExtendedDefinition { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface MutationResolver { 9 | 10 | /** 11 | * Create a new event. 12 | */ 13 | @javax.validation.constraints.NotNull 14 | Event createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/ProductsByCategoryIdAndStatusQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface ProductsByCategoryIdAndStatusQueryResolver { 9 | 10 | java.util.List products(@javax.validation.constraints.NotNull String categoryId, @javax.validation.constraints.NotNull String status) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/without-model-package/MyUnionToResolveSuffix.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 6 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(GraphqlJacksonTypeIdResolver::class) 7 | interface MyUnionToResolveSuffix { 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | 4 | /** 5 | * Resolver for Query 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface QueryResolver { 12 | 13 | Synchronized Private(Integer Int, String New, TestEnum Enum) throws Exception; 14 | 15 | String Case(java.util.List Final) throws Exception; 16 | 17 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/types-as-interfaces-extends-interface/Profile.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | import scala.collection.JavaConverters._ 4 | 5 | @javax.annotation.Generated( 6 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | case class Profile( 10 | @javax.validation.constraints.NotNull 11 | firstName: String, 12 | @javax.validation.constraints.NotNull 13 | lastName: String 14 | ) { 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/project/Commands.scala: -------------------------------------------------------------------------------- 1 | import sbt.Command 2 | 3 | /** @author 4 | * 梦境迷离 5 | * @since 2022/1/15 6 | * @version 1.0 7 | */ 8 | object Commands { 9 | 10 | val FmtSbtCommand = Command.command("fmt")(state => "scalafmtSbt" :: "scalafmtAll" :: state) 11 | 12 | val FmtSbtCheckCommand = 13 | Command.command("check")(state => "scalafmtSbtCheck" :: "scalafmtCheckAll" :: state) 14 | 15 | val value = Seq( 16 | FmtSbtCommand, 17 | FmtSbtCheckCommand 18 | ) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/exception/UnableToLoadFreeMarkerTemplateException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.exception; 2 | 3 | /** 4 | * Exception that indicates error while loading Apache FreeMarker template 5 | * 6 | * @author kobylynskyi 7 | */ 8 | public class UnableToLoadFreeMarkerTemplateException extends RuntimeException { 9 | 10 | public UnableToLoadFreeMarkerTemplateException(Throwable e) { 11 | super("Unable to load FreeMarker templates", e); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/without-model-package/MyUnionToResolveSuffix.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 6 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(classOf[GraphqlJacksonTypeIdResolver]) 7 | trait MyUnionToResolveSuffix { 8 | 9 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/exception/UnableToCreateDirectoryException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.exception; 2 | 3 | /** 4 | * Exception that indicates error while creating directory 5 | * 6 | * @author kobylynskyi 7 | */ 8 | public class UnableToCreateDirectoryException extends RuntimeException { 9 | 10 | public UnableToCreateDirectoryException(String directoryPath, Exception e) { 11 | super("Unable to create directory by path: " + directoryPath, e); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/annotation/User.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1 2 | 3 | import scala.collection.JavaConverters._ 4 | 5 | /** 6 | * type with directive using enum value 7 | */ 8 | @javax.annotation.Generated( 9 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 10 | date = "2020-12-31T23:59:59-0500" 11 | ) 12 | case class User( 13 | name: String, 14 | @com.example.Relationship(type = "FRIEND_WITH", direction = OUT) 15 | friends: scala.Seq[User] 16 | ) { 17 | 18 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/jackson-resolver-union/without-model-package/MyUnionToResolveSuffix.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 6 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(GraphqlJacksonTypeIdResolver.class) 7 | public interface MyUnionToResolveSuffix { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/relay/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | public interface QueryResolver { 7 | 8 | graphql.relay.Connection users(int first, String after, graphql.schema.DataFetchingEnvironment env) throws Exception; 9 | 10 | graphql.relay.Connection organizations(Integer first, String after, graphql.schema.DataFetchingEnvironment env) throws Exception; 11 | 12 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/main/scala/io/github/dreamylost/graphql/codegen/SchemaFinderConfig.scala: -------------------------------------------------------------------------------- 1 | package io.github.dreamylost.graphql.codegen 2 | 3 | import com.kobylynskyi.graphql.codegen.supplier.SchemaFinder 4 | 5 | /** @author 6 | * 梦境迷离 7 | * @version 1.0,2020/7/15 8 | */ 9 | final case class SchemaFinderConfig( 10 | rootDir: String, 11 | recursive: Boolean = SchemaFinder.DEFAULT_RECURSIVE, 12 | includePattern: String = SchemaFinder.DEFAULT_INCLUDE_PATTERN, 13 | excludedFiles: Set[String] = Set.empty 14 | ) 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/EventsCreatedSubscriptionResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Subscribe to events 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface EventsCreatedSubscriptionResolver { 12 | 13 | /** 14 | * Subscribe to events 15 | */ 16 | @javax.validation.constraints.NotNull 17 | java.util.List eventsCreated() throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/parametrized-input-client.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | product( 3 | companyId: ID! 4 | ): Product! 5 | 6 | clients: [Client!]! 7 | } 8 | 9 | interface Product { 10 | linkCode( 11 | pid: ID! 12 | ): LinkCode 13 | } 14 | 15 | type LinkCode { 16 | html: String 17 | } 18 | 19 | type Client { 20 | data(ID: Int!): Data! 21 | } 22 | 23 | enum Data { A B C } 24 | 25 | interface A { 26 | foo(arg: String): String 27 | } 28 | 29 | type B implements A { 30 | foo(arg: String): String 31 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/types-as-interfaces.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | # The query root. 4 | query: Query 5 | } 6 | 7 | type Query { 8 | userCurrent: User 9 | } 10 | 11 | type User @asInterface { 12 | username: String! 13 | email: String! 14 | orders: [Order!]! @customResolver 15 | } 16 | 17 | type Order { 18 | number: String! 19 | price: String! 20 | } 21 | 22 | directive @customResolver on FIELD_DEFINITION 23 | directive @asInterface on OBJECT 24 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/EventByIdQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Single event by ID. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface EventByIdQueryResolver { 12 | 13 | /** 14 | * Single event by ID. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | Event eventById(@javax.validation.constraints.NotNull String id) throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface MutationResolver { 6 | 7 | @javax.validation.constraints.NotNull 8 | Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; 9 | 10 | @javax.validation.constraints.NotNull 11 | Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/parent-interfaces/SubscriptionResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface SubscriptionResolver extends graphql.kickstart.tools.GraphQLSubscriptionResolver { 9 | 10 | /** 11 | * Subscribe to events 12 | */ 13 | @javax.validation.constraints.NotNull 14 | java.util.List eventsCreated() throws Exception; 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/resolvers/AcceptTopicSuggestionPayloadResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | 4 | /** 5 | * Resolver for AcceptTopicSuggestionPayload 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface AcceptTopicSuggestionPayloadResolver { 12 | 13 | GithubTopicTO topic(GithubAcceptTopicSuggestionPayloadTO acceptTopicSuggestionPayload, graphql.schema.DataFetchingEnvironment env) throws Exception; 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public interface MutationResolver { 6 | 7 | @javax.validation.constraints.NotNull 8 | Event createEvent(@javax.validation.constraints.NotNull EventInput input) throws Exception; 9 | 10 | @javax.validation.constraints.NotNull 11 | Asset createAsset(@javax.validation.constraints.NotNull AssetInput input) throws Exception; 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/input-wrapper/MyEnum.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public enum MyEnum { 6 | 7 | ONE("ONE"), 8 | TWO("TWO"), 9 | THREE("THREE"); 10 | 11 | private final String graphqlName; 12 | 13 | private MyEnum(String graphqlName) { 14 | this.graphqlName = graphqlName; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return this.graphqlName; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLResponse.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.graphql; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Generic class having content of GraphQL response 7 | */ 8 | public class GraphQLResponse extends GraphQLResult> { 9 | 10 | public GraphQLResponse() { 11 | super(); 12 | } 13 | 14 | public Object getData(String name) { 15 | Map data = getData(); 16 | return data != null ? data.get(name) : null; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/field-resolver/AcceptTopicSuggestionMutationWithAnnotation.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface AcceptTopicSuggestionMutationWithAnnotation { 9 | 10 | @Throws(Exception::class) 11 | fun acceptTopicSuggestion(@some.Annotation input: GithubAcceptTopicSuggestionInputTO, env: graphql.schema.DataFetchingEnvironment): GithubAcceptTopicSuggestionPayloadTO? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/Status.scala.txt: -------------------------------------------------------------------------------- 1 | import com.fasterxml.jackson.core.`type`.TypeReference 2 | 3 | @javax.annotation.Generated( 4 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | object Status extends Enumeration { 8 | 9 | type Status = Value 10 | 11 | val CREATED: Value = Value("CREATED") 12 | val IN_PROGRESS: Value = Value("IN_PROGRESS") 13 | val ASSIGNED: Value = Value("ASSIGNED") 14 | 15 | } 16 | 17 | class StatusTypeRefer extends TypeReference[Status.type] -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/graphql/mappers/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.graphql.mappers; 2 | 3 | import io.github.kobylynskyi.order.graphql.model.ItemTO; 4 | import io.github.kobylynskyi.order.graphql.model.OrderTO; 5 | import io.github.kobylynskyi.order.model.Item; 6 | import io.github.kobylynskyi.order.model.Order; 7 | import org.mapstruct.Mapper; 8 | 9 | @Mapper(componentModel = "spring") 10 | public interface OrderMapper { 11 | 12 | OrderTO map(Order from); 13 | 14 | ItemTO map(Item from); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/graphql/mappers/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.graphql.mappers; 2 | 3 | import io.github.kobylynskyi.order.graphql.model.ItemTO; 4 | import io.github.kobylynskyi.order.graphql.model.OrderTO; 5 | import io.github.kobylynskyi.order.model.Item; 6 | import io.github.kobylynskyi.order.model.Order; 7 | import org.mapstruct.Mapper; 8 | 9 | @Mapper(componentModel = "spring") 10 | public interface OrderMapper { 11 | 12 | OrderTO map(Order from); 13 | 14 | ItemTO map(Item from); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/EventsByIdsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Events by IDs. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface EventsByIdsQueryResolver { 12 | 13 | /** 14 | * Events by IDs. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | java.util.List eventsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/deprecated/Event.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | data class Event( 9 | @Deprecated(message = "test deprecated with msg") 10 | val status: Status, 11 | @Deprecated(message = "test deprecated with msg") 12 | val createdDateTime: String, 13 | @Deprecated(message = "test deprecated with msg") 14 | override 15 | val id: String 16 | ) : PinnableItem, Node { 17 | 18 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/relay/QueryResolver.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | interface QueryResolver { 6 | 7 | @Throws(Exception::class) 8 | fun users(first: Int, after: String?, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection 9 | 10 | @Throws(Exception::class) 11 | fun organizations(first: Int?, after: String?, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/relay/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | trait QueryResolver { 6 | 7 | @throws[Exception] 8 | def users(first: Int, after: String, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection[User] 9 | 10 | @throws[Exception] 11 | def organizations(first: scala.Option[Int], after: String, env: graphql.schema.DataFetchingEnvironment): graphql.relay.Connection[Organization] 12 | 13 | } -------------------------------------------------------------------------------- /plugins/gradle/example-server/src/main/java/io/github/kobylynskyi/product/model/Product.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.Date; 8 | 9 | @Data 10 | public class Product { 11 | 12 | @Id 13 | private String id; 14 | private String title; 15 | private String description; 16 | private BigDecimal price; 17 | private String sku; 18 | private StockStatus stockStatus; 19 | private Date addedDateTime; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /plugins/maven/example-server/src/main/java/io/github/kobylynskyi/product/model/Product.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.product.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.Date; 8 | 9 | @Data 10 | public class Product { 11 | 12 | @Id 13 | private String id; 14 | private String title; 15 | private String description; 16 | private BigDecimal price; 17 | private String sku; 18 | private StockStatus stockStatus; 19 | private Date addedDateTime; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend/Status.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public enum Status { 6 | 7 | CREATED("CREATED"), 8 | IN_PROGRESS("IN_PROGRESS"), 9 | ASSIGNED("ASSIGNED"); 10 | 11 | private final String graphqlName; 12 | 13 | private Status(String graphqlName) { 14 | this.graphqlName = graphqlName; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return this.graphqlName; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/field-resolver/AcceptTopicSuggestionPayloadResolver.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | /** 5 | * Resolver for AcceptTopicSuggestionPayload 6 | */ 7 | @javax.annotation.Generated( 8 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | interface AcceptTopicSuggestionPayloadResolver { 12 | 13 | @Throws(Exception::class) 14 | fun topic(acceptTopicSuggestionPayload: GithubAcceptTopicSuggestionPayloadTO, env: graphql.schema.DataFetchingEnvironment): GithubTopicTO? 15 | 16 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/resources/schema.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | mutation: Mutation 4 | } 5 | 6 | type Query { 7 | orders: [Order] 8 | orderById(id: ID!): Order 9 | } 10 | 11 | type Mutation { 12 | create: Order 13 | addProductToOrder(orderId: ID!, productId: ID!, quantity: Int = 0): Order 14 | } 15 | 16 | type Order { 17 | id: ID! 18 | items: [Item!]! 19 | total: BigDecimal! 20 | } 21 | 22 | type Item { 23 | quantity: Int! 24 | productId: ID! 25 | total: BigDecimal! 26 | } 27 | 28 | scalar DateTime 29 | scalar BigDecimal -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/resources/schema.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | mutation: Mutation 4 | } 5 | 6 | type Query { 7 | orders: [Order] 8 | orderById(id: ID!): Order 9 | } 10 | 11 | type Mutation { 12 | create: Order 13 | addProductToOrder(orderId: ID!, productId: ID!, quantity: Int = 0): Order 14 | } 15 | 16 | type Order { 17 | id: ID! 18 | items: [Item!]! 19 | total: BigDecimal! 20 | } 21 | 22 | type Item { 23 | quantity: Int! 24 | productId: ID! 25 | total: BigDecimal! 26 | } 27 | 28 | scalar DateTime 29 | scalar BigDecimal -------------------------------------------------------------------------------- /src/test/resources/expected-classes/CreateEventMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Create a new event. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface CreateEventMutationResolver { 12 | 13 | /** 14 | * Create a new event. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | Event createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/field-resolver/AcceptTopicSuggestionMutationWithAnnotations.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | interface AcceptTopicSuggestionMutationWithAnnotations { 9 | 10 | @Throws(Exception::class) 11 | fun acceptTopicSuggestion(@another.Annotation @some.Annotation input: GithubAcceptTopicSuggestionInputTO, env: graphql.schema.DataFetchingEnvironment): GithubAcceptTopicSuggestionPayloadTO? 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/without-model-package/MyResultObjectSuffix.kt.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 6 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(GraphqlJacksonTypeIdResolver::class) 7 | interface MyResultObjectSuffix { 8 | 9 | val list: List? 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/parent-interfaces/VersionQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | /** 5 | * Version of the application. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface VersionQueryResolver extends graphql.kickstart.tools.GraphQLQueryResolver { 12 | 13 | /** 14 | * Version of the application. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | String version() throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/exception/LanguageNotSupportedException.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model.exception; 2 | 3 | import com.kobylynskyi.graphql.codegen.model.GeneratedLanguage; 4 | 5 | /** 6 | * Eception is thrown when specified language is not supportted by GraphQL Code generator 7 | */ 8 | public class LanguageNotSupportedException extends IllegalArgumentException { 9 | 10 | public LanguageNotSupportedException(GeneratedLanguage generatedLanguage) { 11 | super("Language is not supported: " + generatedLanguage.name()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/UnionToResolve.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 9 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(com.kobylynskyi.graphql.unionresolver.GraphqlJacksonTypeIdResolver::class) 10 | interface UnionToResolve { 11 | 12 | } -------------------------------------------------------------------------------- /src/main/java/com/kobylynskyi/graphql/codegen/model/GeneratedLanguage.java: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.model; 2 | 3 | /** 4 | * Enum containing all supported langugages for code generation 5 | */ 6 | public enum GeneratedLanguage { 7 | 8 | JAVA(".java"), 9 | 10 | SCALA(".scala"), 11 | 12 | KOTLIN(".kt"); 13 | 14 | private final String fileExtension; 15 | 16 | GeneratedLanguage(String fileExtension) { 17 | this.fileExtension = fileExtension; 18 | } 19 | 20 | public String getFileExtension() { 21 | return fileExtension; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/extend-with-resolvers/Status.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | public enum Status { 6 | 7 | CREATED("CREATED"), 8 | IN_PROGRESS("IN_PROGRESS"), 9 | ASSIGNED("ASSIGNED"); 10 | 11 | private final String graphqlName; 12 | 13 | private Status(String graphqlName) { 14 | this.graphqlName = graphqlName; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return this.graphqlName; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/UnionToResolve.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 9 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(classOf[com.kobylynskyi.graphql.unionresolver.GraphqlJacksonTypeIdResolver]) 10 | trait UnionToResolve { 11 | 12 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/jackson-resolver-union/UnionToResolve.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 9 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(com.kobylynskyi.graphql.unionresolver.GraphqlJacksonTypeIdResolver.class) 10 | public interface UnionToResolve { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/parent-interfaces/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface MutationResolver extends graphql.kickstart.tools.GraphQLMutationResolver { 9 | 10 | /** 11 | * Create a new event. 12 | */ 13 | @javax.validation.constraints.NotNull 14 | EventTO createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/without-model-package/MyResultObjectSuffix.scala.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 6 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(classOf[GraphqlJacksonTypeIdResolver]) 7 | trait MyResultObjectSuffix { 8 | 9 | val list: scala.Seq[_ <: MyUnionToResolveSuffix] 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/schemas/types-as-interfaces-extends-interface.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | # The query root. 4 | query: Query 5 | } 6 | 7 | type Query { 8 | userCurrent: User 9 | } 10 | 11 | type User implements Node @asInterface { 12 | username: String! 13 | email: String! 14 | profile: Profile 15 | } 16 | 17 | type Profile { 18 | firstName: String! 19 | lastName: String! 20 | } 21 | 22 | interface Node { 23 | } 24 | 25 | directive @customResolver on FIELD_DEFINITION 26 | directive @asInterface on OBJECT 27 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/enum-union/EnumMember1.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum EnumMember1 implements EnumUnion { 8 | 9 | VALUE("VALUE"); 10 | 11 | private final String graphqlName; 12 | 13 | private EnumMember1(String graphqlName) { 14 | this.graphqlName = graphqlName; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return this.graphqlName; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/jackson-resolver-union/without-model-package/MyResultObjectSuffix.java.txt: -------------------------------------------------------------------------------- 1 | @javax.annotation.Generated( 2 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 3 | date = "2020-12-31T23:59:59-0500" 4 | ) 5 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 6 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(GraphqlJacksonTypeIdResolver.class) 7 | public interface MyResultObjectSuffix { 8 | 9 | java.util.List getList(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/TestEnum.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum TestEnum { 8 | 9 | Long("long"), 10 | Short("short"); 11 | 12 | private final String graphqlName; 13 | 14 | private TestEnum(String graphqlName) { 15 | this.graphqlName = graphqlName; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return this.graphqlName; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/main/resources/templates/java-lang/union.ftl: -------------------------------------------------------------------------------- 1 | <#if package?has_content> 2 | package ${package}; 3 | 4 | 5 | 6 | <#if javaDoc?has_content> 7 | /** 8 | <#list javaDoc as javaDocLine> 9 | * ${javaDocLine} 10 | 11 | */ 12 | 13 | <#if generatedAnnotation && generatedInfo.getGeneratedType()?has_content> 14 | @${generatedInfo.getGeneratedType()}( 15 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 16 | date = "${generatedInfo.getDateTime()}" 17 | ) 18 | 19 | <#list annotations as annotation> 20 | @${annotation} 21 | 22 | public interface ${className} { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/defaults/MyEnum.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.testdefaults; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum MyEnum { 8 | 9 | ONE("ONE"), 10 | TWO("TWO"), 11 | THREE("THREE"); 12 | 13 | private final String graphqlName; 14 | 15 | private MyEnum(String graphqlName) { 16 | this.graphqlName = graphqlName; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return this.graphqlName; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/defaults/MyEnumTO.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.testdefaults; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum MyEnumTO { 8 | 9 | ONE("ONE"), 10 | TWO("TWO"), 11 | THREE("THREE"); 12 | 13 | private final String graphqlName; 14 | 15 | private MyEnumTO(String graphqlName) { 16 | this.graphqlName = graphqlName; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return this.graphqlName; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/enum-union/EnumMember2.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.enumunion; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum EnumMember2 implements EnumUnion { 8 | 9 | OTHER_VALUE("OTHER_VALUE"); 10 | 11 | private final String graphqlName; 12 | 13 | private EnumMember2(String graphqlName) { 14 | this.graphqlName = graphqlName; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return this.graphqlName; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/from-introspection-result/QueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface QueryResolver { 9 | 10 | java.util.List products() throws Exception; 11 | 12 | Product productById(@javax.validation.constraints.NotNull String id) throws Exception; 13 | 14 | java.util.List productsByIds(@javax.validation.constraints.NotNull java.util.List ids) throws Exception; 15 | 16 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/unknown-fields/MyEnum.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.testdefaults; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum MyEnum { 8 | 9 | ONE("ONE"), 10 | TWO("TWO"), 11 | THREE("THREE"); 12 | 13 | private final String graphqlName; 14 | 15 | private MyEnum(String graphqlName) { 16 | this.graphqlName = graphqlName; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return this.graphqlName; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/kt/nullable-extend.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | events: [Event!] 7 | event: Event 8 | events1: [Event!]! 9 | events2: [Event]! 10 | events3: [Event] 11 | events4: [[Event]!] 12 | events5: [[Event]!]! 13 | events6: [[Event!]!]! 14 | events7: [[Event]]! 15 | null1Query: Int 16 | null2Query: [Int] 17 | null3Query: [Int!] 18 | null4Query: [Int!]! 19 | null5Query: [Int]! 20 | } 21 | 22 | type Event implements Node { 23 | nullableStatus: [Int] 24 | nonullStatus: [Int!] 25 | nullablePrimitive: Int 26 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/default-custom-types/MyEnum.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum MyEnum { 8 | 9 | ONE("ONE"), 10 | TWO("TWO"), 11 | THREE("THREE"); 12 | 13 | private final String graphqlName; 14 | 15 | private MyEnum(String graphqlName) { 16 | this.graphqlName = graphqlName; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return this.graphqlName; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/defaults/MyEnumDTO.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.testdefaults; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum MyEnumDTO { 8 | 9 | ONE("ONE"), 10 | TWO("TWO"), 11 | THREE("THREE"); 12 | 13 | private final String graphqlName; 14 | 15 | private MyEnumDTO(String graphqlName) { 16 | this.graphqlName = graphqlName; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return this.graphqlName; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/deprecated/Status.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | import com.fasterxml.jackson.core.`type`.TypeReference 4 | 5 | @javax.annotation.Generated( 6 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | object Status extends Enumeration { 10 | 11 | type Status = Value 12 | 13 | @deprecated(message = "test deprecated with msg") 14 | val CREATED: Value = Value("CREATED") 15 | val IN_PROGRESS: Value = Value("IN_PROGRESS") 16 | 17 | } 18 | 19 | class StatusTypeRefer extends TypeReference[Status.type] -------------------------------------------------------------------------------- /src/test/resources/expected-classes/deprecated/Status.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | @javax.annotation.Generated( 4 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 5 | date = "2020-12-31T23:59:59-0500" 6 | ) 7 | public enum Status { 8 | 9 | @Deprecated 10 | CREATED("CREATED"), 11 | IN_PROGRESS("IN_PROGRESS"); 12 | 13 | private final String graphqlName; 14 | 15 | private Status(String graphqlName) { 16 | this.graphqlName = graphqlName; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return this.graphqlName; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/parent-interfaces/EventsCreatedSubscriptionResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | /** 5 | * Subscribe to events 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface EventsCreatedSubscriptionResolver extends graphql.kickstart.tools.GraphQLSubscriptionResolver { 12 | 13 | /** 14 | * Subscribe to events 15 | */ 16 | @javax.validation.constraints.NotNull 17 | java.util.List eventsCreated() throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/kt/restricted-words.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | open: String 7 | private(int: Int, new: String, enum: TestEnum = long, createdAfter: DateTime): super 8 | when(final: [char]): ID 9 | fun(final: Int): char 10 | super: String 11 | this: String 12 | } 13 | 14 | type super { 15 | is: String @deprecated(reason : "We have decided that this is not canon") 16 | in: char 17 | Int: super 18 | date: DateTime 19 | } 20 | 21 | enum TestEnum { 22 | long, 23 | short 24 | } 25 | 26 | interface char { 27 | } 28 | 29 | scalar DateTime 30 | -------------------------------------------------------------------------------- /src/test/resources/schemas/projection-interfaces.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | } 4 | 5 | type Query { 6 | vehicleById(vehicleId: ID!): Vehicle 7 | } 8 | 9 | interface Location { 10 | id: ID! 11 | locationType: String! 12 | } 13 | 14 | type CustomerLocation implements Location { 15 | id: ID! 16 | locationType: String! 17 | postCode: String! 18 | } 19 | 20 | type DealerLocation implements Location { 21 | id: ID! 22 | locationType: String! 23 | dealerCode: String! 24 | } 25 | 26 | type Vehicle { 27 | vehicleId: ID! 28 | registrationNumber: String! 29 | location: Location! 30 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/jackson-resolver-union/ResultObject.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 9 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(com.kobylynskyi.graphql.unionresolver.GraphqlJacksonTypeIdResolver::class) 10 | interface ResultObject { 11 | 12 | val list: List? 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/template/record_type.ftl: -------------------------------------------------------------------------------- 1 | <#assign MapperUtil=statics["com.kobylynskyi.graphql.codegen.java.JavaGraphQLTypeMapper"]> 2 | <#if package?has_content> 3 | package ${package}; 4 | 5 | 6 | public record ${className} ( 7 | <#if fields?has_content> 8 | <#list fields as field> 9 | ${field.type} ${field.name}<#if field.defaultValue?has_content> = ${field.defaultValue}<#if field?has_next>, 10 | 11 | 12 | ) 13 | { 14 | 15 | public ${className}() { 16 | <#list fields as field><#if field.defaultValue?has_content> ${field.name} = ${field.defaultValue}; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullable/QueryResolver.scala.txt: -------------------------------------------------------------------------------- 1 | 2 | @javax.annotation.Generated( 3 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 4 | date = "2020-12-31T23:59:59-0500" 5 | ) 6 | trait QueryResolver { 7 | 8 | @throws[Exception] 9 | def events(): scala.Seq[Event] 10 | 11 | @throws[Exception] 12 | def event(): scala.Option[Event] 13 | 14 | @throws[Exception] 15 | def null1Query(): scala.Option[Int] 16 | 17 | @throws[Exception] 18 | def null2Query(): scala.Seq[scala.Option[Int]] 19 | 20 | @throws[Exception] 21 | def null3Query(): scala.Seq[Int] 22 | 23 | } -------------------------------------------------------------------------------- /src/main/resources/templates/kotlin-lang/union.ftl: -------------------------------------------------------------------------------- 1 | <#if package?has_content> 2 | package ${package} 3 | 4 | 5 | 6 | <#if javaDoc?has_content> 7 | /** 8 | <#list javaDoc as javaDocLine> 9 | * ${javaDocLine} 10 | 11 | */ 12 | 13 | <#if generatedAnnotation && generatedInfo.getGeneratedType()?has_content> 14 | @${generatedInfo.getGeneratedType()}( 15 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 16 | date = "${generatedInfo.getDateTime()}" 17 | ) 18 | 19 | <#list annotations as annotation> 20 | @${annotation} 21 | 22 | <#if generateSealedInterfaces>sealed interface ${className} { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/templates/scala-lang/union.ftl: -------------------------------------------------------------------------------- 1 | <#if package?has_content> 2 | package ${package} 3 | 4 | 5 | 6 | <#if javaDoc?has_content> 7 | /** 8 | <#list javaDoc as javaDocLine> 9 | * ${javaDocLine} 10 | 11 | */ 12 | 13 | <#if generatedAnnotation && generatedInfo.getGeneratedType()?has_content> 14 | @${generatedInfo.getGeneratedType()}( 15 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 16 | date = "${generatedInfo.getDateTime()}" 17 | ) 18 | 19 | <#list annotations as annotation> 20 | @${annotation} 21 | 22 | <#if generateSealedInterfaces>sealed trait ${className} { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/model/Order.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @Data 11 | public class Order { 12 | 13 | @Id 14 | private String id; 15 | 16 | private List items = new ArrayList<>(); 17 | 18 | public BigDecimal getTotal() { 19 | return getItems().stream() 20 | .map(Item::getTotal) 21 | .reduce(BigDecimal.ZERO, BigDecimal::add); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/model/Order.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @Data 11 | public class Order { 12 | 13 | @Id 14 | private String id; 15 | 16 | private List items = new ArrayList<>(); 17 | 18 | public BigDecimal getTotal() { 19 | return getItems().stream() 20 | .map(Item::getTotal) 21 | .reduce(BigDecimal.ZERO, BigDecimal::add); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /scripts/update-release-version-in-readme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RELEASE_VERSION=$1 4 | RELEASE_VERSION_ESCAPED=${RELEASE_VERSION//./\\.} 5 | 6 | set_version_in_file() { 7 | sed -i '' "s/$2[A-Z0-9.\-]*/$2$RELEASE_VERSION_ESCAPED/gw /tmp/sed.done" "$1" 8 | echo "Updated version in $1" 9 | grep --color -e "" /tmp/sed.done 10 | } 11 | 12 | set_version_in_file "plugins/gradle/README.md" "id \"io.github.kobylynskyi.graphql.codegen\" version \"" 13 | set_version_in_file "plugins/gradle/README.md" "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:" 14 | set_version_in_file "plugins/maven/README.md" "" 15 | 16 | # Exit clean 17 | exit 0 18 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/VersionQueryResponse_int.kt.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult 4 | 5 | @javax.annotation.Generated( 6 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | open class VersionQueryResponse : GraphQLResult>() { 10 | 11 | companion object { 12 | const val OPERATION_NAME: String = "version" 13 | } 14 | 15 | fun version(): Int { 16 | val data: MutableMap = super.getData() 17 | return data.getValue(OPERATION_NAME) 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/jackson-resolver-union/ResultObject.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 9 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(classOf[com.kobylynskyi.graphql.unionresolver.GraphqlJacksonTypeIdResolver]) 10 | trait ResultObject { 11 | 12 | val list: scala.Seq[_ <: UnionToResolve] 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/schemas/defaults.graphqls: -------------------------------------------------------------------------------- 1 | # This input has all possible types 2 | input InputWithDefaults { 3 | floatVal: Float = 1.23 4 | booleanVal: Boolean = false 5 | intVal: Int = 42 6 | stringVal: String = "my-default" 7 | enumVal: MyEnum = ONE 8 | nonNullEnumVal: MyEnum! = TWO 9 | objectWithNullDefault: SomeObject = null 10 | objectWithNonNullDefault: SomeObject = { name: "Bob" } 11 | intList: [Int] = [1, 2, 3] 12 | intListEmptyDefault: [Int] = [] 13 | objectListEmptyDefault: [SomeObject]! = [] 14 | } 15 | 16 | input SomeObject { 17 | name: String! 18 | } 19 | 20 | enum MyEnum { 21 | ONE, TWO, THREE 22 | } -------------------------------------------------------------------------------- /plugins/gradle/example-client/src/main/java/io/github/kobylynskyi/order/external/config/RestClientsConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.external.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @Configuration 9 | public class RestClientsConfiguration { 10 | 11 | @Bean 12 | public RestTemplate restTemplate() { 13 | return new RestTemplate(new HttpComponentsClientHttpRequestFactory()); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /plugins/maven/example-client/src/main/java/io/github/kobylynskyi/order/external/config/RestClientsConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.github.kobylynskyi.order.external.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @Configuration 9 | public class RestClientsConfiguration { 10 | 11 | @Bean 12 | public RestTemplate restTemplate() { 13 | return new RestTemplate(new HttpComponentsClientHttpRequestFactory()); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/jackson-resolver-union/ResultObject.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.unionresolver; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | @com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = "__typename") 9 | @com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(com.kobylynskyi.graphql.unionresolver.GraphqlJacksonTypeIdResolver.class) 10 | public interface ResultObject { 11 | 12 | java.util.List getList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/parent-interfaces/CreateEventMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.interfaces; 2 | 3 | 4 | /** 5 | * Create a new event. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface CreateEventMutationResolver extends graphql.kickstart.tools.GraphQLMutationResolver { 12 | 13 | /** 14 | * Create a new event. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | EventTO createEvent(@javax.validation.constraints.NotNull String categoryId, String createdBy) throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/kt/restricted-words/FunQueryResponse.kt.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot 2 | 3 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult 4 | 5 | @javax.annotation.Generated( 6 | value = ["com.kobylynskyi.graphql.codegen.GraphQLCodegen"], 7 | date = "2020-12-31T23:59:59-0500" 8 | ) 9 | open class FunQueryResponse : GraphQLResult>() { 10 | 11 | companion object { 12 | const val OPERATION_NAME: String = "fun" 13 | } 14 | 15 | fun `fun`(): Char? { 16 | val data: MutableMap = super.getData() 17 | return data[OPERATION_NAME] 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/fields-with-data-fetcher-result.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | # The query root. 4 | query: Query 5 | } 6 | 7 | type Query { 8 | userCurrent: User 9 | } 10 | 11 | type User { 12 | username: String! 13 | email: String! 14 | orders: [Order!]! @dataFetcherResult 15 | cart: Cart! @dataFetcherResult 16 | } 17 | 18 | type Order { 19 | number: String! 20 | price: String! 21 | } 22 | 23 | type Cart { 24 | id: Long! 25 | items: [Item!]! 26 | } 27 | 28 | type Item { 29 | id: String 30 | } 31 | 32 | directive @dataFetcherResult on FIELD_DEFINITION 33 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/annotation/NullableListReturnTypeWithMandatoryElementsQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * NonNull validation annotation should not be present here 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface NullableListReturnTypeWithMandatoryElementsQueryResolver { 12 | 13 | /** 14 | * NonNull validation annotation should not be present here 15 | */ 16 | java.util.List nullableListReturnTypeWithMandatoryElements() throws Exception; 17 | 18 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/.scalafmt.conf: -------------------------------------------------------------------------------- 1 | version = "3.6.1" 2 | runner.dialect = scala213 3 | maxColumn = 120 4 | align.preset = more 5 | lineEndings = preserve 6 | align.stripMargin = false 7 | docstrings.style = AsteriskSpace 8 | docstrings.oneline = keep 9 | continuationIndent.defnSite = 2 10 | danglingParentheses.preset = true 11 | spaces { 12 | inImportCurlyBraces = true 13 | } 14 | indentOperator.exemptScope = aloneArgOrBody 15 | includeCurlyBraceInSelectChains = false 16 | align.openParenDefnSite = false 17 | optIn.annotationNewlines = true 18 | rewrite.rules = [SortImports, RedundantBraces] 19 | rewriteTokens = { 20 | "⇒": "=>" 21 | "→": "->" 22 | "←": "<-" 23 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/EventsByCategoryAndStatusQueryResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * List of events of a specified category. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface EventsByCategoryAndStatusQueryResolver { 12 | 13 | /** 14 | * List of events of a specified category. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | java.util.List eventsByCategoryAndStatus(@javax.validation.constraints.NotNull String categoryId, EventStatus status) throws Exception; 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/annotation/MutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | trait MutationResolver { 9 | 10 | /** 11 | * Create a new event. 12 | */ 13 | @javax.validation.constraints.NotNull 14 | @com.example.CustomAnnotation(roles=scala.Array("admin", "moderator"), boo=scala.Array(true, false, true), float=scala.Array("12.0", "null"), int=42, n="null") 15 | @throws[Exception] 16 | def createEvent(categoryId: String, createdBy: String): Event 17 | 18 | } -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/resources/schemas/extend1.graphqls: -------------------------------------------------------------------------------- 1 | # A GraphQL schema provides a root type for each kind of operation. 2 | schema { 3 | query: Query 4 | mutation: Mutation 5 | } 6 | 7 | # Queries related to events 8 | type Query { 9 | events: [Event!] 10 | } 11 | 12 | type Mutation { 13 | createEvent(input: EventInput!): Event! 14 | } 15 | 16 | type Event implements Node { 17 | status: Status! 18 | createdDateTime: DateTime! 19 | } 20 | 21 | input EventInput { 22 | status: Status! 23 | } 24 | 25 | enum Status { 26 | CREATED 27 | IN_PROGRESS 28 | } 29 | 30 | interface Node { 31 | id: ID! 32 | } 33 | 34 | union PinnableItem = Event 35 | 36 | scalar DateTime 37 | -------------------------------------------------------------------------------- /plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/annotation/MutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | @javax.annotation.Generated( 5 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | public interface MutationResolver { 9 | 10 | /** 11 | * Create a new event. 12 | */ 13 | @javax.validation.constraints.NotNull 14 | @com.example.CustomAnnotation(roles={"admin", "moderator"}, boo={true, false, true}, float={"12.0", "null"}, int=42, n="null") 15 | Event createEvent(@javax.validation.constraints.NotNull @javax.validation.Valid String categoryId, String createdBy) throws Exception; 16 | 17 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/Asset.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | import Status._ 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | case class Asset( 9 | @javax.validation.constraints.NotNull 10 | name: String, 11 | @javax.validation.constraints.NotNull 12 | @com.fasterxml.jackson.module.scala.JsonScalaEnumeration(classOf[StatusTypeRefer]) 13 | status: Status, 14 | @javax.validation.constraints.NotNull 15 | override val id: String, 16 | override val createdBy: String 17 | ) extends PinnableItem with Node { 18 | 19 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/input-wrapper.graphqls: -------------------------------------------------------------------------------- 1 | # This input has all possible types 2 | input InputWithDefaults { 3 | floatVal: Float = 1.23 4 | booleanVal: Boolean = false 5 | intVal: Int = 42 6 | stringVal: String = "my-default" 7 | enumVal: MyEnum = ONE 8 | nonNullEnumVal: MyEnum! = TWO 9 | objectWithNullDefault: SomeObject = null 10 | objectWithNonNullDefault: SomeObject = { name: "Bob" } 11 | intList: [Int] = [1, 2, 3] 12 | intListEmptyDefault: [Int] = [] 13 | objectListEmptyDefault: [SomeObject]! = [] 14 | } 15 | 16 | input SomeObject { 17 | name: String! 18 | description: String 19 | } 20 | 21 | enum MyEnum { 22 | ONE, TWO, THREE 23 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/custom-type/ResponseContainingDate.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1 2 | 3 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLRequestSerializer 4 | import scala.collection.JavaConverters._ 5 | 6 | @javax.annotation.Generated( 7 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 8 | date = "2020-12-31T23:59:59-0500" 9 | ) 10 | case class ResponseContainingDate( 11 | a: java.time.ZonedDateTime 12 | ) { 13 | 14 | override def toString(): String = { 15 | scala.Seq( 16 | if (a != null) "a: " + GraphQLRequestSerializer.getEntry(a) else "" 17 | ).filter(_ != "").mkString("{", ",", "}") 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/VersionQueryResponse_int.scala.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql 2 | 3 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult 4 | import java.util.{ Map => JMap } 5 | 6 | @javax.annotation.Generated( 7 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 8 | date = "2020-12-31T23:59:59-0500" 9 | ) 10 | class VersionQueryResponse extends GraphQLResult[JMap[String, Int]] { 11 | 12 | def version(): Int = { 13 | val data: JMap[String, Int] = getData 14 | data.get(VersionQueryResponse.OPERATION_NAME) 15 | } 16 | 17 | } 18 | 19 | object VersionQueryResponse { 20 | 21 | private final val OPERATION_NAME: String = "version" 22 | 23 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullreturn/SimplesQueryResponse.scala.txt: -------------------------------------------------------------------------------- 1 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult 2 | import java.util.{ Map => JMap } 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | class SimplesQueryResponse extends GraphQLResult[JMap[String, Event]] { 9 | 10 | def simples(): Event = { 11 | val data: JMap[String, Event] = getData 12 | if (data != null) data.get(SimplesQueryResponse.OPERATION_NAME) else null 13 | } 14 | 15 | } 16 | 17 | object SimplesQueryResponse { 18 | 19 | private final val OPERATION_NAME: String = "simples" 20 | 21 | } -------------------------------------------------------------------------------- /src/test/resources/schemas/defaults-with-Long.graphqls: -------------------------------------------------------------------------------- 1 | # This input has all possible types 2 | input InputWithDefaults { 3 | floatVal: Float = 1.23 4 | booleanVal: Boolean = false 5 | intVal: Int = 42 6 | stringVal: String = "my-default" 7 | enumVal: MyEnum = ONE 8 | nonNullEnumVal: MyEnum! = TWO 9 | objectWithNullDefault: SomeObject = null 10 | objectWithNonNullDefault: SomeObject = { name: "Bob" } 11 | intList: [Int!] = [1, 2, 3] 12 | intListEmptyDefault: [Int] = [] 13 | objectListEmptyDefault: [SomeObject]! = [] 14 | longValue: Long = 123456 15 | } 16 | 17 | input SomeObject { 18 | name: String! 19 | } 20 | 21 | enum MyEnum { 22 | ONE, TWO, THREE 23 | } 24 | 25 | 26 | scalar Long -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/Event.scala.txt: -------------------------------------------------------------------------------- 1 | import scala.collection.JavaConverters._ 2 | import Status._ 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | case class Event( 9 | @javax.validation.constraints.NotNull 10 | @com.fasterxml.jackson.module.scala.JsonScalaEnumeration(classOf[StatusTypeRefer]) 11 | status: Status, 12 | @javax.validation.constraints.NotNull 13 | createdDateTime: String, 14 | assets: scala.Seq[Asset], 15 | @javax.validation.constraints.NotNull 16 | override val id: String, 17 | override val createdBy: String 18 | ) extends PinnableItem with Node { 19 | 20 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/response/VersionQueryResponse_int.java.txt: -------------------------------------------------------------------------------- 1 | package com.github.graphql; 2 | 3 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult; 4 | import java.util.Map; 5 | 6 | @javax.annotation.Generated( 7 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 8 | date = "2020-12-31T23:59:59-0500" 9 | ) 10 | public class VersionQueryResponse extends GraphQLResult> { 11 | 12 | private static final String OPERATION_NAME = "version"; 13 | 14 | public VersionQueryResponse() { 15 | } 16 | 17 | public Integer version() { 18 | Map data = getData(); 19 | return data != null ? data.get(OPERATION_NAME) : null; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/annotation/CreateEventMutationResolver.scala.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1 2 | 3 | 4 | /** 5 | * Create a new event. 6 | */ 7 | @javax.annotation.Generated( 8 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | trait CreateEventMutationResolver { 12 | 13 | /** 14 | * Create a new event. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | @com.example.CustomAnnotation(roles=scala.Array("admin", "moderator"), boo=scala.Array(true, false, true), float=scala.Array("12.0", "null"), int=42, n="null") 18 | @throws[Exception] 19 | def createEvent(categoryId: String, createdBy: String): Event 20 | 21 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/restricted-words/CaseQueryResponse.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.codegen.prot; 2 | 3 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult; 4 | import java.util.Map; 5 | 6 | @javax.annotation.Generated( 7 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 8 | date = "2020-12-31T23:59:59-0500" 9 | ) 10 | public class CaseQueryResponse extends GraphQLResult> { 11 | 12 | private static final String OPERATION_NAME = "case"; 13 | 14 | public CaseQueryResponse() { 15 | } 16 | 17 | public String Case() { 18 | Map data = getData(); 19 | return data != null ? data.get(OPERATION_NAME) : null; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/nullreturn/SimplesQueryResponse_without_option.scala.txt: -------------------------------------------------------------------------------- 1 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult 2 | import java.util.{ Map => JMap } 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | class SimplesQueryResponse extends GraphQLResult[JMap[String, Event]] { 9 | 10 | def simples(): Event = { 11 | val data: JMap[String, Event] = getData 12 | if (data != null) data.get(SimplesQueryResponse.OPERATION_NAME) else null 13 | } 14 | 15 | } 16 | 17 | object SimplesQueryResponse { 18 | 19 | private final val OPERATION_NAME: String = "simples" 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/expected-classes/scala/extend/resolver/SimpleEventCountQueryResponse.scala.txt: -------------------------------------------------------------------------------- 1 | import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLResult 2 | import java.util.{ Map => JMap } 3 | 4 | @javax.annotation.Generated( 5 | value = Array("com.kobylynskyi.graphql.codegen.GraphQLCodegen"), 6 | date = "2020-12-31T23:59:59-0500" 7 | ) 8 | class SimpleEventCountQueryResponse extends GraphQLResult[JMap[String, Int]] { 9 | 10 | def simpleEventCount(): Int = { 11 | val data: JMap[String, Int] = getData 12 | data.get(SimpleEventCountQueryResponse.OPERATION_NAME) 13 | } 14 | 15 | } 16 | 17 | object SimpleEventCountQueryResponse { 18 | 19 | private final val OPERATION_NAME: String = "simpleEventCount" 20 | 21 | } -------------------------------------------------------------------------------- /src/test/resources/expected-classes/annotation/CreateEventMutationResolver.java.txt: -------------------------------------------------------------------------------- 1 | package com.kobylynskyi.graphql.test1; 2 | 3 | 4 | /** 5 | * Create a new event. 6 | */ 7 | @javax.annotation.Generated( 8 | value = "com.kobylynskyi.graphql.codegen.GraphQLCodegen", 9 | date = "2020-12-31T23:59:59-0500" 10 | ) 11 | public interface CreateEventMutationResolver { 12 | 13 | /** 14 | * Create a new event. 15 | */ 16 | @javax.validation.constraints.NotNull 17 | @com.example.CustomAnnotation(roles={"admin", "moderator"}, boo={true, false, true}, float={"12.0", "null"}, int=42, n="null") 18 | Event createEvent(@javax.validation.constraints.NotNull @javax.validation.Valid String categoryId, String createdBy) throws Exception; 19 | 20 | } --------------------------------------------------------------------------------