Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate engine workflow depending on whether nested mutations are on/off #1951

Closed
Tracked by #1576
ayush3797 opened this issue Jan 3, 2024 · 4 comments · Fixed by #2116
Closed
Tracked by #1576

Separate engine workflow depending on whether nested mutations are on/off #1951

ayush3797 opened this issue Jan 3, 2024 · 4 comments · Fixed by #2116
Assignees
Labels
engine issues that require change in engine code graphql Multiple mutations Fixes/enhancements related to nested mutations.
Milestone

Comments

@ayush3797
Copy link
Contributor

ayush3797 commented Jan 3, 2024

The purpose of the issue is to track the efforts needed for
a) Consuming the feature flag fields in the config file
b) Adding different code paths in the engine based on whether the feature flag is enabled or disabled

@ayush3797 ayush3797 added engine issues that require change in engine code Multiple mutations Fixes/enhancements related to nested mutations. labels Jan 3, 2024
@seantleonard seantleonard added this to the 0.11rc milestone Jan 10, 2024
@JerryNixon
Copy link
Contributor

The content of this issue has no grammatical errors! ;)

image

@JerryNixon
Copy link
Contributor

The reasoning around this issue includes giving the ability for developers to avoid any startup cost associated with nested mutations. Developers can already change read/write permissions of entities which can effectively disable mutations. The nuance here is that disabling them globally can mean the engine doesn't have to compute the schema at startup. Please refer to #1950

@severussundar
Copy link
Contributor

The reasoning around this issue includes giving the ability for developers to avoid any startup cost associated with nested mutations. Developers can already change read/write permissions of entities which can effectively disable mutations. The nuance here is that disabling them globally can mean the engine doesn't have to compute the schema at startup. Please refer to #1950

Thank you for adding this. Updated the description.

When the feature is disabled, the schema will be generated the way it is right now; thus avoiding additional computations, memory utilized etc.

@seantleonard
Copy link
Contributor

Follows up the work from #1950

severussundar added a commit that referenced this issue Mar 26, 2024
…ue (#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

![image](https://github.com/Azure/data-api-builder/assets/11196553/7a3a8bbe-2742-43e0-98d7-9412ed05db33)

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

![image](https://github.com/Azure/data-api-builder/assets/11196553/c6513d9a-5b49-44cc-8fcc-1ed1f44f5f58)


#### Querying related entities continue to work successfully

![image](https://github.com/Azure/data-api-builder/assets/11196553/4c1a61b8-0cbb-4a1e-afaa-1849d710be27)



### When Multiple Create operation is disabled - MsSQL

#### Only fields belonging to the given entity are created in the input
object type

![image](https://github.com/Azure/data-api-builder/assets/11196553/a3b6beb2-7245-4345-ba13-29d8905d859e)

#### 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

![image](https://github.com/Azure/data-api-builder/assets/11196553/b2a4f7f6-b121-410d-806d-8c5772253080)

#### Multiple type create operation is not created

---------

Co-authored-by: Ayush Agarwal <ayusha083@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine issues that require change in engine code graphql Multiple mutations Fixes/enhancements related to nested mutations.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants