Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
268 commits
Select commit Hold shift + click to select a range
a0c7cb5
updating logic
ayush3797 Jan 4, 2024
4b91cc2
Solving bug for M:N relationship schema gen
ayush3797 Jan 13, 2024
191e257
nits
ayush3797 Jan 13, 2024
f50e491
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Jan 13, 2024
61acb0e
Adding summaries
ayush3797 Jan 13, 2024
5f002ec
update branch
ayush3797 Jan 13, 2024
c530949
update branch
ayush3797 Jan 13, 2024
f4adfff
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' of https://g…
ayush3797 Jan 13, 2024
797db23
Moving role extraction logic to authz resolver
ayush3797 Jan 14, 2024
02fdfdc
Adding comments/examples
ayush3797 Jan 14, 2024
f225e10
updating comments
ayush3797 Jan 14, 2024
5dca094
using tryadd
ayush3797 Jan 14, 2024
887dd79
format fix
ayush3797 Jan 14, 2024
82b0c7f
Fixing failures due to tests
ayush3797 Jan 15, 2024
33fca99
fixing format
ayush3797 Jan 15, 2024
2073c48
Moving linking entity logic to sqlmetadataprovider
ayush3797 Jan 15, 2024
2c96a8b
fixing typo
ayush3797 Jan 15, 2024
fe05132
Moving linking entity logic to sqlmdpvdr
ayush3797 Jan 16, 2024
11bb3d4
fixing format
ayush3797 Jan 16, 2024
d6f6949
fixing failures
ayush3797 Jan 16, 2024
1c0ce60
Preventing serialisation/deserialization of islinkingentity property
ayush3797 Jan 17, 2024
cba8072
Fixing dwsql
ayush3797 Jan 17, 2024
162f2de
god please fix this formatting error
ayush3797 Jan 17, 2024
e9d8b8e
fixing tests
ayush3797 Jan 17, 2024
c58f3ea
Refining logic to create linking objects
ayush3797 Jan 17, 2024
613f386
refining code
ayush3797 Jan 17, 2024
6757208
refactor schema converter for clear code
ayush3797 Jan 17, 2024
9e4b732
adding/removing comments
ayush3797 Jan 17, 2024
c53f4ce
nits
ayush3797 Jan 24, 2024
ff3e952
Merge with main
ayush3797 Jan 29, 2024
450da35
update branch
ayush3797 Jan 29, 2024
879a740
Removing redundant relationship
ayush3797 Jan 31, 2024
0918e46
resolving conflicts
ayush3797 Jan 31, 2024
fb475cd
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Jan 31, 2024
08e9d31
Initial progress
ayush3797 Jan 31, 2024
7a503d6
Addressing review
ayush3797 Feb 1, 2024
27a45c1
addressing review
ayush3797 Feb 1, 2024
baa0bb8
adding param name
ayush3797 Feb 2, 2024
f5237fe
Logic to find names of src/target entities from linking entity name
ayush3797 Feb 2, 2024
e963d40
update comment
ayush3797 Feb 2, 2024
8cef1b9
Initial progress
ayush3797 Feb 4, 2024
80a7e79
addressing comments
ayush3797 Feb 4, 2024
e1efb79
updating branch
ayush3797 Feb 4, 2024
a96523c
initial progress
ayush3797 Feb 4, 2024
f38a633
Initial progress
ayush3797 Feb 4, 2024
fbeb2bf
Determining order for custom relationships
ayush3797 Feb 5, 2024
5fb007a
Adding logic for inifinite referencing->referenced entity nesting
ayush3797 Feb 5, 2024
a9babd4
adding comments/renaming variables
ayush3797 Feb 6, 2024
af60e25
updating branch
ayush3797 Feb 6, 2024
2007b3e
updating branch
ayush3797 Feb 6, 2024
c8e9b0d
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Feb 6, 2024
72c81df
fixing bug
ayush3797 Feb 6, 2024
09055ab
fixing bug
ayush3797 Feb 6, 2024
9262b36
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 6, 2024
d5894b4
adding detailed comments
ayush3797 Feb 6, 2024
f7981b6
adding more comments
ayush3797 Feb 6, 2024
81621df
adding comment
ayush3797 Feb 6, 2024
e850ead
Adding validation to disallow multiple relationships between same sou…
ayush3797 Feb 9, 2024
3b824d6
adding summary/reusing existing methods
ayush3797 Feb 12, 2024
29c2a1a
Initial progress
ayush3797 Feb 14, 2024
422630d
initial prgress
ayush3797 Feb 14, 2024
47def99
saving progress for fk directive
ayush3797 Feb 14, 2024
783464c
Logic to add FK directive for custom relationships
ayush3797 Feb 15, 2024
9cb61d6
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
d68d311
separating naming logic for mutations
ayush3797 Feb 15, 2024
68b780c
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
be7831f
making rel fields nullable
ayush3797 Feb 15, 2024
daeae37
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
4142fd9
Merge branch 'main' into dev/NestedMutations
severussundar Feb 15, 2024
a5f3654
adding tests
ayush3797 Feb 15, 2024
b63aed6
nit
ayush3797 Feb 15, 2024
8583106
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
5089f90
Adding test summaries
ayush3797 Feb 15, 2024
97e6878
refactoring test
ayush3797 Feb 15, 2024
d345a5f
updating comment
ayush3797 Feb 15, 2024
2e03f43
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
9625095
rearranging code
ayush3797 Feb 15, 2024
8d17119
updating branch
ayush3797 Feb 15, 2024
f4743de
updating branch
ayush3797 Feb 15, 2024
4c7cb74
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
fbd9001
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
ce0c49f
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Feb 15, 2024
baa0956
starting tests
ayush3797 Feb 15, 2024
ce8cc98
Adding test
ayush3797 Feb 15, 2024
adcdeab
reverting exception throwing on multiple relationships between same e…
ayush3797 Feb 16, 2024
6453ed5
addressing review
ayush3797 Feb 19, 2024
c44dda9
addressing review
ayush3797 Feb 19, 2024
7820551
Merge branch 'dev/agarwalayush/schemaGenerationTests' into dev/agarwa…
ayush3797 Feb 20, 2024
6b2f055
reverting conn string change
ayush3797 Feb 20, 2024
a9bb393
addressing review
ayush3797 Feb 22, 2024
be28782
addressing review
ayush3797 Feb 22, 2024
60ae0af
adding comment
ayush3797 Feb 22, 2024
55912f4
adding comment
ayush3797 Feb 22, 2024
ee30cdb
Order helper class for nested insertions
ayush3797 Feb 22, 2024
ad0d0f7
resolving conflicts
ayush3797 Feb 22, 2024
6827c9f
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Feb 22, 2024
7eff2ba
preventing unreachable code
ayush3797 Feb 22, 2024
63191db
resolving conflicts
ayush3797 Feb 22, 2024
c0fb32e
updating logic
ayush3797 Feb 22, 2024
0b7e455
saving progress
ayush3797 Feb 23, 2024
8e35c5b
Merge branch 'main' into dev/NestedMutations
severussundar Feb 23, 2024
0691554
correcting logic for inferring fk
ayush3797 Feb 27, 2024
effc380
addressing comments
ayush3797 Feb 27, 2024
adfcab9
updating mton function logic
ayush3797 Feb 27, 2024
9e377c3
refining logic
ayush3797 Feb 27, 2024
8db211c
addressing review
ayush3797 Feb 28, 2024
5ca4171
addressing review
ayush3797 Feb 28, 2024
a6ae8aa
Adding test asserting absence of ref field directive on non-ref columns
ayush3797 Feb 28, 2024
02c79bc
renaming set
ayush3797 Feb 29, 2024
7624675
formatting fix
ayush3797 Feb 29, 2024
559025f
formatting fix
ayush3797 Feb 29, 2024
78c8f7b
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Feb 29, 2024
96c4a36
formatting fix
ayush3797 Feb 29, 2024
0c4fc3d
Refactoring cosmos create input generation into a different methof
ayush3797 Feb 29, 2024
fa9bcab
fixing test setup
ayush3797 Feb 29, 2024
e0a2b92
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 29, 2024
69cc7ce
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Feb 29, 2024
24ef922
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Feb 29, 2024
207d114
Addressing review
ayush3797 Feb 29, 2024
957058a
nit
ayush3797 Feb 29, 2024
328e8ee
Adding test class
ayush3797 Feb 29, 2024
c308d50
starting tests
ayush3797 Feb 29, 2024
694fead
adding test IP
ayush3797 Feb 29, 2024
2d2fc79
Adding unit tests for referencing entity determination based on metadata
ayush3797 Feb 29, 2024
449908f
Adding similar tests to Pg/MySql
ayush3797 Feb 29, 2024
8e269a9
Identifying more invalid cases
ayush3797 Feb 29, 2024
95ff1b1
nits
ayush3797 Feb 29, 2024
f462005
updating branch
ayush3797 Feb 29, 2024
f008c24
addressing review/adding comments
ayush3797 Mar 5, 2024
fac35d3
adding example
ayush3797 Mar 5, 2024
5763a11
Addressing review
ayush3797 Mar 5, 2024
d94c265
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 5, 2024
7d95cab
fixing bug
ayush3797 Mar 5, 2024
12007cc
Renaming class
ayush3797 Mar 5, 2024
35e895a
Adding test for determining order in custom relationships
ayush3797 Mar 5, 2024
f0f01f5
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 5, 2024
9e441c7
Merge branch 'main' into dev/NestedMutations
severussundar Mar 6, 2024
04fbfae
Merge branch 'main' into dev/NestedMutations
severussundar Mar 11, 2024
c9c033f
updating relationship name
ayush3797 Mar 11, 2024
f7bc95d
Feature Flag for Nested Mutations: CLI changes (#1983)
severussundar Mar 12, 2024
db967d5
Merge branch 'main' into dev/NestedMutations
severussundar Mar 13, 2024
b34c9f1
Addressing review
ayush3797 Mar 13, 2024
cb7d185
removing stale logic code
ayush3797 Mar 13, 2024
6eea6b0
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 13, 2024
2ef2ac6
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Mar 13, 2024
70ce608
Adding tests
ayush3797 Mar 13, 2024
2d7355e
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 13, 2024
e1a2880
Adding summaries
ayush3797 Mar 14, 2024
fd5758d
Adding summaries
ayush3797 Mar 14, 2024
27c6a23
updating exception msgs
ayush3797 Mar 18, 2024
403cfac
logic for tracking source of fields - entity, parent entity, child en…
ayush3797 Mar 18, 2024
52f28bb
Updating tests
ayush3797 Mar 18, 2024
c9f1d7c
updating config
ayush3797 Mar 18, 2024
eddd377
merge with parent
ayush3797 Mar 18, 2024
c17abe2
updating config
ayush3797 Mar 18, 2024
641f47b
Adding method to prevent one field referencing multiple fields
ayush3797 Mar 19, 2024
bc48882
Fixing bug
ayush3797 Mar 19, 2024
e9758da
adding tests
ayush3797 Mar 19, 2024
8a796dd
Adding tests
ayush3797 Mar 19, 2024
3827377
adding comment
ayush3797 Mar 19, 2024
76b851b
updating mssql config generator
ayush3797 Mar 19, 2024
89522f0
Adding tests to pgsql
ayush3797 Mar 19, 2024
c3615d1
tests for mysql
ayush3797 Mar 19, 2024
b44463c
updating verfied config for mysql
ayush3797 Mar 19, 2024
58ae7c6
updating test category
ayush3797 Mar 19, 2024
de9d6ea
Adding tests
ayush3797 Mar 19, 2024
e622a7e
Adding tests
ayush3797 Mar 19, 2024
f9c30f6
Updating config
ayush3797 Mar 19, 2024
b1d5aca
Rename nested-mutations and nested-create to multiple-mutations and m…
severussundar Mar 20, 2024
ad40fb2
format
seantleonard Mar 20, 2024
0fde781
addressing review
ayush3797 Mar 21, 2024
a055c3c
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 21, 2024
12acb29
Merge branch 'main' into dev/NestedMutations
ayush3797 Mar 21, 2024
09b8d98
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Mar 21, 2024
32e6fe9
Merge branch 'dev/NestedMutations' of https://github.com/Azure/data-a…
ayush3797 Mar 21, 2024
75534f1
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Mar 21, 2024
0ca28f1
updating branch
ayush3797 Mar 21, 2024
cecc1de
Removing duplicate entities
ayush3797 Mar 21, 2024
3eb8e5c
updating branch
ayush3797 Mar 21, 2024
d0801b7
updating used entities
ayush3797 Mar 21, 2024
549f427
updating mysql entities
ayush3797 Mar 21, 2024
a104573
updating for pg
ayush3797 Mar 21, 2024
7b28340
updating for pg
ayush3797 Mar 21, 2024
71aa072
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 21, 2024
437639c
Adding test for repeated referencing column
ayush3797 Mar 21, 2024
104248b
fixing failures
ayush3797 Mar 21, 2024
eb3238b
cleaning up test
ayush3797 Mar 21, 2024
658b22f
Fixing dwsql failure
ayush3797 Mar 21, 2024
b8872a7
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 21, 2024
0ad5561
formatting fix
ayush3797 Mar 21, 2024
e2f9418
Multiple-create: Schema generation (#1902)
ayush3797 Mar 21, 2024
e34cf14
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Mar 21, 2024
be3c31b
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 21, 2024
147043b
Moving failing negative unit tests to integration testss
ayush3797 Mar 21, 2024
a7d36a0
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Mar 21, 2024
0a3b3aa
Formatting fix
ayush3797 Mar 21, 2024
7a6b6b1
Formatting fix
ayush3797 Mar 21, 2024
4b6e4ac
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 21, 2024
ce54deb
formatting fix
ayush3797 Mar 21, 2024
dddac47
formatting fix
ayush3797 Mar 21, 2024
e777c8a
fixing test
ayush3797 Mar 21, 2024
d2c9821
nit
ayush3797 Mar 21, 2024
d82e73b
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 21, 2024
7b0e082
fixing tests
ayush3797 Mar 21, 2024
de1eb78
only do validation for create mutations
ayush3797 Mar 21, 2024
033a82b
Merge branch 'main' into dev/NestedMutations
ayush3797 Mar 21, 2024
e6018d7
Adding test for one referencing column referencing multiple reference…
ayush3797 Mar 21, 2024
191ac6a
test for one column referencing columns from different entities
ayush3797 Mar 21, 2024
9a8e805
Added more tests
ayush3797 Mar 21, 2024
0e9eb1e
updating config gen
ayush3797 Mar 21, 2024
f3efbf0
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Mar 21, 2024
9233c41
Multiple-create: Authorization (#1943)
ayush3797 Mar 21, 2024
6451db8
Merge branch 'dev/NestedMutations' into dev/agarwalayush/nestedInsert…
ayush3797 Mar 21, 2024
f1b19ba
Removing duplicate roles
ayush3797 Mar 21, 2024
68839c9
update branch
ayush3797 Mar 21, 2024
4246354
add debugger displaynames to objects in DatabaseObject.cs classes to …
seantleonard Mar 25, 2024
9a90ca1
Enable or Disable Multiple Create operation based on feature flag val…
severussundar Mar 26, 2024
d08001c
merge latest changes from main
severussundar Mar 26, 2024
75b06c0
adds logic to throw exp when source is null; got missed during merge …
severussundar Mar 26, 2024
9a54f5d
Merge branch 'main' into dev/NestedMutations
severussundar Mar 27, 2024
b866883
Addressing review
ayush3797 Mar 27, 2024
1f7c443
updating branch
ayush3797 Mar 27, 2024
0de3e1a
updating cmt
ayush3797 Mar 27, 2024
64dab85
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Mar 27, 2024
d311e09
updating branch
ayush3797 Mar 28, 2024
46342e2
updating branch
ayush3797 Mar 28, 2024
11f13f0
resolving merge conflicts from main
severussundar Apr 2, 2024
a9c780d
addressing review comments
severussundar Apr 2, 2024
e0fbd36
Addressing review
ayush3797 Apr 9, 2024
d6de41c
Merge branch 'main' into dev/agarwalayush/nestedInsertionOrderHelper
ayush3797 Apr 9, 2024
c18911e
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Apr 9, 2024
2d1a3ac
Addressing review
ayush3797 Apr 20, 2024
1f78d3c
Merge branch 'main' into dev/agarwalayush/nestedInsertionOrderHelper
ayush3797 Apr 20, 2024
91fde8c
nit
ayush3797 Apr 20, 2024
6ae9d37
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Apr 20, 2024
d5205b4
nit
ayush3797 Apr 20, 2024
5afa7dd
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Apr 20, 2024
992c808
addressing review
ayush3797 Apr 21, 2024
a7ac48c
fixing format
ayush3797 Apr 21, 2024
bfe0a2e
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/a…
ayush3797 Apr 21, 2024
949ec22
Addressing reviews
ayush3797 Apr 23, 2024
e996237
Adding new class, updating error messages
ayush3797 Apr 24, 2024
762e749
Instantiating input validator per request
ayush3797 Apr 24, 2024
9683561
updating multiple insertion test to contain >1 item
ayush3797 Apr 24, 2024
a4f80af
updating with main
ayush3797 Apr 24, 2024
208212d
adding comments
ayush3797 Apr 25, 2024
275c055
formatting fix
ayush3797 Apr 25, 2024
fecc20d
Merge branch 'main' into dev/agarwalayush/requestValidationForNestedI…
ayush3797 Apr 25, 2024
6df855d
fixing config generator
ayush3797 Apr 25, 2024
9ae0a8c
updating expected error message in test
ayush3797 Apr 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config-generators/mssql-commands.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
init --config "dab-config.MsSql.json" --database-type mssql --set-session-context true --connection-string "Server=tcp:127.0.0.1,1433;Persist Security Info=False;User ID=sa;Password=REPLACEME;MultipleActiveResultSets=False;Connection Timeout=5;" --host-mode Development --cors-origin "http://localhost:5000"
init --config "dab-config.MsSql.json" --database-type mssql --set-session-context true --connection-string "Server=tcp:127.0.0.1,1433;Persist Security Info=False;User ID=sa;Password=REPLACEME;MultipleActiveResultSets=False;Connection Timeout=5;" --host-mode Development --cors-origin "http://localhost:5000" --graphql.multiple-create.enabled true
add Publisher --config "dab-config.MsSql.json" --source publishers --permissions "anonymous:read"
add Stock --config "dab-config.MsSql.json" --source stocks --permissions "anonymous:create,read,update,delete"
add Book --config "dab-config.MsSql.json" --source books --permissions "anonymous:create,read,update,delete" --graphql "book:books"
Expand Down Expand Up @@ -33,6 +33,8 @@ add User_NonAutogenRelationshipColumn --config "dab-config.MsSql.json" --source
add UserProfile --config "dab-config.MsSql.json" --source "user_profiles" --permissions "anonymous:*" --rest true --graphql true
add User_AutogenRelationshipColumn --config "dab-config.MsSql.json" --source "users" --permissions "anonymous:*" --rest true --graphql true
add User_AutogenToNonAutogenRelationshipColumn --config "dab-config.MsSql.json" --source "users" --permissions "anonymous:*" --rest true --graphql true
add User_RepeatedReferencingColumnToOneEntity --config "dab-config.MsSql.json" --source "users" --permissions "anonymous:*" --rest true --graphql true
add UserProfile_RepeatedReferencingColumnToTwoEntities --config "dab-config.MsSql.json" --source "user_profiles" --permissions "anonymous:*" --rest true --graphql true
add GetBooks --config "dab-config.MsSql.json" --source "get_books" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true
add GetBook --config "dab-config.MsSql.json" --source "get_book_by_id" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql false
add GetPublisher --config "dab-config.MsSql.json" --source "get_publisher_by_id" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true --graphql.operation "query"
Expand Down Expand Up @@ -145,6 +147,9 @@ update ArtOfWar --config "dab-config.MsSql.json" --permissions "authenticated:*"
update User_NonAutogenRelationshipColumn --config "dab-config.MsSql.json" --relationship UserProfile_NonAutogenRelationshipColumn --target.entity UserProfile --cardinality one --relationship.fields "username:username"
update User_AutogenRelationshipColumn --config "dab-config.MsSql.json" --relationship UserProfile_AutogenRelationshipColumn --target.entity UserProfile --cardinality one --relationship.fields "userid:profileid"
update User_AutogenToNonAutogenRelationshipColumn --config "dab-config.MsSql.json" --relationship UserProfile_AutogenToNonAutogenRelationshipColumn --target.entity UserProfile --cardinality one --relationship.fields "userid,username:userid,username"
update User_RepeatedReferencingColumnToOneEntity --config "dab-config.MsSql.json" --relationship UserProfile --target.entity UserProfile --cardinality one --relationship.fields "username,username:profilepictureurl,username"
update UserProfile_RepeatedReferencingColumnToTwoEntities --config "dab-config.MsSql.json" --relationship book --target.entity Book --cardinality one --relationship.fields "userid:id"
update UserProfile_RepeatedReferencingColumnToTwoEntities --config "dab-config.MsSql.json" --relationship publisher --target.entity Publisher --cardinality one --relationship.fields "userid:id"
update GetBook --config "dab-config.MsSql.json" --permissions "authenticated:execute" --rest.methods "Get"
update GetPublisher --config "dab-config.MsSql.json" --permissions "authenticated:execute"
update GetBooks --config "dab-config.MsSql.json" --permissions "authenticated:execute" --graphql.operation "Query" --rest.methods "Get"
Expand Down
4 changes: 4 additions & 0 deletions src/Config/DataApiBuilderException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public enum SubStatusCodes
/// </summary>
EntityNotFound,
/// <summary>
/// The relationship for a pair of source/target entities does not exist.
/// </summary>
RelationshipNotFound,
/// <summary>
/// Request failed authentication. i.e. No/Invalid JWT token
/// </summary>
AuthenticationChallenge,
Expand Down
48 changes: 48 additions & 0 deletions src/Core/Models/MultipleMutationEntityInputValidationContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Azure.DataApiBuilder.Core.Models
{
/// <summary>
/// Class to represent input for an entity in a multiple-create request.
/// </summary>
public class MultipleMutationEntityInputValidationContext
{
/// <summary>
/// Current entity name.
/// </summary>
public string EntityName { get; }

/// <summary>
/// Parent entity name. For the topmost entity, this will be set as an empty string.
/// </summary>
public string ParentEntityName { get; }

/// <summary>
/// Set of columns in the current entity whose values are derived from insertion in the parent entity
/// (i.e. parent entity would have been the referenced entity).
/// For the topmost entity, this will be an empty set.</param>
/// </summary>
public HashSet<string> ColumnsDerivedFromParentEntity { get; }

/// <summary>
/// Set of columns in the current entity whose values are to be derived from insertion in the entity or its subsequent
/// referenced entities and returned to the parent entity so as to provide values for the corresponding referencing fields
/// (i.e. parent entity would have been the referencing entity)
/// For the topmost entity, this will be an empty set.
/// </summary>
public HashSet<string> ColumnsToBeDerivedFromEntity { get; }

public MultipleMutationEntityInputValidationContext(
string entityName,
string parentEntityName,
HashSet<string> columnsDerivedFromParentEntity,
HashSet<string> columnsToBeDerivedFromEntity)
{
EntityName = entityName;
ParentEntityName = parentEntityName;
ColumnsDerivedFromParentEntity = columnsDerivedFromParentEntity;
ColumnsToBeDerivedFromEntity = columnsToBeDerivedFromEntity;
}
}
}
25 changes: 22 additions & 3 deletions src/Core/Resolvers/SqlMutationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ public SqlMutationEngine(
// If authorization fails, an exception will be thrown and request execution halts.
AuthorizeMutation(context, parameters, entityName, mutationOperation);

// Multiple create mutation request is validated to ensure that the request is valid semantically.
string inputArgumentName = IsPointMutation(context) ? MutationBuilder.ITEM_INPUT_ARGUMENT_NAME : MutationBuilder.ARRAY_INPUT_ARGUMENT_NAME;
if (parameters.TryGetValue(inputArgumentName, out object? param) && mutationOperation is EntityActionOperation.Create)
{
IInputField schemaForArgument = context.Selection.Field.Arguments[inputArgumentName];
MultipleMutationEntityInputValidationContext multipleMutationEntityInputValidationContext = new(
entityName: entityName,
parentEntityName: string.Empty,
columnsDerivedFromParentEntity: new(),
columnsToBeDerivedFromEntity: new());
MultipleMutationInputValidator multipleMutationInputValidator = new(sqlMetadataProviderFactory: _sqlMetadataProviderFactory, runtimeConfigProvider: _runtimeConfigProvider);
multipleMutationInputValidator.ValidateGraphQLValueNode(
schema: schemaForArgument,
context: context,
parameters: param,
nestingLevel: 0,
multipleMutationEntityInputValidationContext: multipleMutationEntityInputValidationContext);
}

// The presence of READ permission is checked in the current role (with which the request is executed) as well as Anonymous role. This is because, for GraphQL requests,
// READ permission is inherited by other roles from Anonymous role when present.
bool isReadPermissionConfigured = _authorizationResolver.AreRoleAndOperationDefinedForEntity(entityName, roleName, EntityActionOperation.Read)
Expand Down Expand Up @@ -1225,7 +1244,7 @@ private void AuthorizeEntityAndFieldsForMutation(
/// title: "book #1",
/// reviews: [{ content: "Good book." }, { content: "Great book." }],
/// publishers: { name: "Macmillan publishers" },
/// authors: [{ birthdate: "1997-09-03", name: "Red house authors", author_name: "Dan Brown" }]
/// authors: [{ birthdate: "1997-09-03", name: "Red house authors", royal_percentage: 4.6 }]
/// })
/// {
/// id
Expand All @@ -1236,13 +1255,13 @@ private void AuthorizeEntityAndFieldsForMutation(
/// title: "book #1",
/// reviews: [{ content: "Good book." }, { content: "Great book." }],
/// publishers: { name: "Macmillan publishers" },
/// authors: [{ birthdate: "1997-09-03", name: "Red house authors", author_name: "Dan Brown" }]
/// authors: [{ birthdate: "1997-09-03", name: "Red house authors", royal_percentage: 4.9 }]
/// },
/// {
/// title: "book #2",
/// reviews: [{ content: "Awesome book." }, { content: "Average book." }],
/// publishers: { name: "Pearson Education" },
/// authors: [{ birthdate: "1990-11-04", name: "Penguin Random House", author_name: "William Shakespeare" }]
/// authors: [{ birthdate: "1990-11-04", name: "Penguin Random House", royal_percentage: 8.2 }]
/// }])
/// {
/// items{
Expand Down
25 changes: 25 additions & 0 deletions src/Core/Services/MetadataProviders/ISqlMetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,30 @@ public DatabaseObject GetDatabaseObjectForGraphQLType(string graphqlType)
void InitializeAsync(
Dictionary<string, DatabaseObject> entityToDatabaseObject,
Dictionary<string, string> graphQLStoredProcedureExposedNameToEntityNameMap);

/// <summary>
/// Helper method to get the Foreign Key definition in the object definition of the source entity which relates it
/// with the target entity. In the Foreign key definition, the table backing the referencing entity acts as the referencing table
/// and the table backing the referenced entity acts as the referenced table.
/// </summary>
/// <param name="sourceEntityName">Source entity name.</param>
/// <param name="targetEntityName">Target entity name.</param>
/// <param name="referencedEntityName">Referenced entity name.</param>
/// <param name="referencingEntityName">Referencing entity name.</param>
/// <param name="foreignKeyDefinition">Stores the required foreign key definition from the referencing to referenced entity.</param>
/// <returns>true when the foreign key definition is successfully determined.</returns>
/// <example>
/// For a 1:N relationship between Publisher: Book entity defined in Publisher entity's config:
/// sourceEntityName: Publisher (The entity in whose config the relationship is defined)
/// targetEntityName: Book (The target.entity in the relationship config)
/// referencingEntityName: Book (Entity holding foreign key reference)
/// referencedEntityName: Publisher (Entity being referenced by foreign key).
/// </example>
public bool TryGetFKDefinition(
string sourceEntityName,
string targetEntityName,
string referencingEntityName,
string referencedEntityName,
[NotNullWhen(true)] out ForeignKeyDefinition? foreignKeyDefinition) => throw new NotImplementedException();
}
}
32 changes: 32 additions & 0 deletions src/Core/Services/MetadataProviders/SqlMetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,38 @@ public bool IsDevelopmentMode()
{
return _runtimeConfigProvider.GetConfig().IsDevelopmentMode();
}

/// <inheritdoc/>
public bool TryGetFKDefinition(
string sourceEntityName,
string targetEntityName,
string referencingEntityName,
string referencedEntityName,
[NotNullWhen(true)] out ForeignKeyDefinition? foreignKeyDefinition)
{
if (GetEntityNamesAndDbObjects().TryGetValue(sourceEntityName, out DatabaseObject? sourceDbObject) &&
GetEntityNamesAndDbObjects().TryGetValue(referencingEntityName, out DatabaseObject? referencingDbObject) &&
GetEntityNamesAndDbObjects().TryGetValue(referencedEntityName, out DatabaseObject? referencedDbObject))
{
DatabaseTable referencingDbTable = (DatabaseTable)referencingDbObject;
DatabaseTable referencedDbTable = (DatabaseTable)referencedDbObject;
SourceDefinition sourceDefinition = sourceDbObject.SourceDefinition;
RelationShipPair referencingReferencedPair = new(referencingDbTable, referencedDbTable);
List<ForeignKeyDefinition> fKDefinitions = sourceDefinition.SourceEntityRelationshipMap[sourceEntityName].TargetEntityToFkDefinitionMap[targetEntityName];

// At this point, DAB guarantees that a valid foreign key definition exists between the the referencing entity
// and the referenced entity. That's because DAB validates that all foreign key metadata
// was inferred for each relationship during startup.
foreignKeyDefinition = fKDefinitions.FirstOrDefault(
fk => fk.Pair.Equals(referencingReferencedPair) &&
fk.ReferencingColumns.Count > 0
&& fk.ReferencedColumns.Count > 0)!;
return true;
}

foreignKeyDefinition = null;
return false;
}
}
}

Loading