Skip to content

Fixes the bug #1680 that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name.#1706

Merged
Aniruddh25 merged 6 commits intorelease/0.8from
dev/neeraj-sharma2592/fixNameDirectiveInvalidArgException
Sep 14, 2023
Merged

Fixes the bug #1680 that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name.#1706
Aniruddh25 merged 6 commits intorelease/0.8from
dev/neeraj-sharma2592/fixNameDirectiveInvalidArgException

Conversation

@neeraj-sharma2592
Copy link
Copy Markdown
Contributor

@neeraj-sharma2592 neeraj-sharma2592 commented Sep 11, 2023

Why make this change?

   string typeName = GraphQLUtils.TryExtractGraphQLFieldModelName(underlyingType.Directives, out string? modelName) ?
                    modelName :
                    underlyingType.Name;

What is this change?

Checking Directive "name" exists before accessing its value. 

How was this tested?

 Tested locally for now. Will be checking Test cases for it.
  • Integration Tests
  • Unit Tests

Copy link
Copy Markdown
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing and looks good so far. Looking forward to seeing a test before merging.

Comment thread src/Service.GraphQLBuilder/GraphQLUtils.cs Outdated
Comment thread src/Service.GraphQLBuilder/GraphQLUtils.cs
@neeraj-sharma2592 neeraj-sharma2592 changed the title Dev/neeraj sharma2592/fix name directive invalid arg exception Fixes the bug that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name. Sep 12, 2023
@neeraj-sharma2592 neeraj-sharma2592 changed the title Fixes the bug that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name. Fixes the bug#1680 that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name. Sep 12, 2023
@neeraj-sharma2592 neeraj-sharma2592 changed the title Fixes the bug#1680 that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name. Fixes the bug #1680 that necessitated adding the 'name' parameter to the @model directive, regardless of the name of the GraphQL object type's name. Sep 12, 2023
Neeraj Sharma added 2 commits September 13, 2023 16:02
…where the 'name' attribute is not explicitly added in the schema
@neeraj-sharma2592
Copy link
Copy Markdown
Contributor Author

Thanks for addressing and looks good so far. Looking forward to seeing a test before merging.

I have modified the schema to test this scenario. We had a 'name' attribute for each model, and we couldn't identify this regression through our integration tests. Please let me know if this seems correct.

Copy link
Copy Markdown
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks alot for the quick fix and the test!!

Copy link
Copy Markdown
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a test and pushing this fix.

@Aniruddh25 Aniruddh25 merged commit 9b0304e into release/0.8 Sep 14, 2023
@Aniruddh25 Aniruddh25 deleted the dev/neeraj-sharma2592/fixNameDirectiveInvalidArgException branch September 14, 2023 00:52
@neeraj-sharma2592 neeraj-sharma2592 restored the dev/neeraj-sharma2592/fixNameDirectiveInvalidArgException branch September 14, 2023 07:16
@neeraj-sharma2592 neeraj-sharma2592 deleted the dev/neeraj-sharma2592/fixNameDirectiveInvalidArgException branch September 14, 2023 07:19
neeraj-sharma2592 added a commit that referenced this pull request Sep 14, 2023
…the @model directive, regardless of the name of the GraphQL object type's name. (#1706)

## Why make this change?
- Closes #1680 
- Regression introduced in 0.8.49 caused required explicitly adding
"name" directive for all the model/entity irrespective of whether we are
using a different name than the one it originally has.
- Regression introduced in #1402 when we started using
TryExtractGraphQLName as follows:
```
   string typeName = GraphQLUtils.TryExtractGraphQLFieldModelName(underlyingType.Directives, out string? modelName) ?
                    modelName :
                    underlyingType.Name;
```
      
## What is this change?
    Checking Directive "name" exists before accessing its value. 

## How was this tested?
     Tested locally for now. Will be checking Test cases for it.
- [x] Integration Tests
- [ ] Unit Tests

---------

Co-authored-by: Neeraj Sharma <[email protected]>
neeraj-sharma2592 added a commit that referenced this pull request Sep 18, 2023
…the @model directive, regardless of the name of the GraphQL object type's name. (#1706)

## Why make this change?
- Closes #1680 
- Regression introduced in 0.8.49 caused required explicitly adding
"name" directive for all the model/entity irrespective of whether we are
using a different name than the one it originally has.
- Regression introduced in #1402 when we started using
TryExtractGraphQLName as follows:
```
   string typeName = GraphQLUtils.TryExtractGraphQLFieldModelName(underlyingType.Directives, out string? modelName) ?
                    modelName :
                    underlyingType.Name;
```
      
## What is this change?
    Checking Directive "name" exists before accessing its value. 

## How was this tested?
     Tested locally for now. Will be checking Test cases for it.
- [x] Integration Tests
- [ ] Unit Tests

---------

Co-authored-by: Neeraj Sharma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants