Class RequestResponseDefinitionToDataModelMapper
java.lang.Object
io.github.besi97.graphql.codegen.mapper.RequestResponseDefinitionToDataModelMapper
Map request and response definition to a Freemarker data model
-
Constructor Summary
ConstructorsConstructorDescriptionRequestResponseDefinitionToDataModelMapper(MapperFactory mapperFactory, FieldDefinitionToParameterMapper fieldDefinitionToParameterMapper, InputValueDefinitionToParameterMapper inputValDefToParamMapper) -
Method Summary
Modifier and TypeMethodDescriptionmapParametrizedInput(MappingContext mappingContext, ExtendedFieldDefinition fieldDefinition, ExtendedDefinition<?, ?> parentTypeDefinition) Map field definition to a Freemarker data model of Parametrized Input.mapRequest(MappingContext mappingContext, ExtendedFieldDefinition operationDef, String objectTypeName, List<String> fieldNames) Map field definition to a Request Freemarker data model.mapResponse(MappingContext mappingContext, ExtendedFieldDefinition operationDef, String objectTypeName, List<String> fieldNames) Map field definition to a Response Freemarker data model.mapResponseProjection(MappingContext mappingContext, ExtendedDefinition<?, ?> definition) Map type definition to a Freemarker data model of Response Projection.
-
Constructor Details
-
RequestResponseDefinitionToDataModelMapper
public RequestResponseDefinitionToDataModelMapper(MapperFactory mapperFactory, FieldDefinitionToParameterMapper fieldDefinitionToParameterMapper, InputValueDefinitionToParameterMapper inputValDefToParamMapper)
-
-
Method Details
-
mapResponseProjection
public Map<String,Object> mapResponseProjection(MappingContext mappingContext, ExtendedDefinition<?, ?> definition) Map type definition to a Freemarker data model of Response Projection.- Parameters:
mappingContext- Global mapping contextdefinition- GraphQL definition (type or union)- Returns:
- Freemarker data model of the GraphQL Response Projection
-
mapParametrizedInput
public Map<String,Object> mapParametrizedInput(MappingContext mappingContext, ExtendedFieldDefinition fieldDefinition, ExtendedDefinition<?, ?> parentTypeDefinition) Map field definition to a Freemarker data model of Parametrized Input.- Parameters:
mappingContext- Global mapping contextfieldDefinition- GraphQL field definitionparentTypeDefinition- GraphQL parent type definition- Returns:
- Freemarker data model of the GraphQL Parametrized Input
-
mapResponse
public Map<String,Object> mapResponse(MappingContext mappingContext, ExtendedFieldDefinition operationDef, String objectTypeName, List<String> fieldNames) Map field definition to a Response Freemarker data model.- Parameters:
mappingContext- Global mapping contextoperationDef- GraphQL operation definitionobjectTypeName- Object type (e.g.: "Query", "Mutation" or "Subscription")fieldNames- Names of all fields inside the rootType. Used to detect duplicate- Returns:
- Freemarker data model of the GraphQL response
-
mapRequest
public Map<String,Object> mapRequest(MappingContext mappingContext, ExtendedFieldDefinition operationDef, String objectTypeName, List<String> fieldNames) Map field definition to a Request Freemarker data model.- Parameters:
mappingContext- Global mapping contextoperationDef- GraphQL operation definitionobjectTypeName- Object type (e.g.: "Query", "Mutation" or "Subscription")fieldNames- Names of all fields inside the rootType. Used to detect duplicate- Returns:
- Freemarker data model of the GraphQL request
-