You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable or Disable Multiple Create operation based on feature flag value (#2116)
## Why make this change?
- Closes#1951
- PR #1983,
#2103 add CLI options to
enable or disable multiple mutation/multiple create operation through
CLI. With the changes introduced in the mentioned PRs, the configuration
properties successfully gets written to the config file. Also, during
deserialization, the properties are read and the
`MultipleMutationOptions`, `MultipleCreateOptions`,
`GraphQLRuntimeOptions` objects are created accordingly.
- The above-mentioned PRs do not introduce any change in DAB engine
behavior depending on the configuration property values.
- This PR introduces changes to read these fields and enable/disable
multiple create operation depending on whether the feature is
enabled/disabled through the config file. This is achieved by
introducing behavior changes in the schema generation.
## What is this change?
- This PR builds on top of a) Schema generation PR
#1902 b) Rename
nested-create to multiple create PR
#2103
- When multiple create operation is disabled,
> i) Fields belonging to the related entities are not created in the
input object type are not created.
> ii) Many type multiple create mutation nodes (ex: `createbooks`,
`createpeople_multiple` ) are not created.
> iii) ReferencingField directive is not applied on relationship fields,
so they continue to remain required fields for the create mutation
operation.
> iv) Entities for linking objects are not created as they are relevant
only in the context of multiple create operations.
## How was this tested?
- [x] Unit Tests and Integration Tests
- [x] Manual Tests
**Note:** At the moment, multiple create operation is disabled in the
config file generated for integration tests. This is because of the plan
to merge in the Schema generation, AuthZ/N branches separately to the
main branch. With just these 2 PRs, a multiple create operation will
fail, hence, the disabling multiple create operation. At the moment,
tests that perform validations specific to multiple create feature
enable it by i) updating the runtime object (or) ii) creating a custom
config in which the operation is enabled.
## Sample Request(s)
### When Multiple Create operation is enabled - MsSQL
#### Related entity fields are created in the input object type

#### Multiple type create operation is created in addition to point
create operation

#### Querying related entities continue to work successfully

### When Multiple Create operation is disabled - MsSQL
#### Only fields belonging to the given entity are created in the input
object type

#### Multiple type create operation is not created
### When Multiple Create operation is enabled - Other relational
database types
#### Only fields belonging to the given entity are created in the input
object type

#### Multiple type create operation is not created
---------
Co-authored-by: Ayush Agarwal <[email protected]>
// ReferencingFieldDirective is added to eventually mark the referencing fields in the input object types as optional. When multiple create operations are disabled
239
+
// the referencing fields should be required fields. Hence, ReferencingFieldDirective is added only when the multiple create operations are enabled.
240
+
if(_isMultipleCreateOperationEnabled)
241
+
{
242
+
// For all the fields in the object which hold a foreign key reference to any referenced entity, add a foreign key directive.
// However, ObjectTypeDefinitionNode for linking entities are need only for multiple create operation. So, creating these only when multiple create operations are
// Populating metadata for linking object is only required when multiple create operation is enabled and those database types that support multiple create operation.
0 commit comments