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

IBX-869: Fixed loading of mutations schema #27

Merged
merged 3 commits into from
Nov 26, 2022
Merged

Conversation

bdunogier
Copy link
Collaborator

@bdunogier bdunogier commented Feb 22, 2022

Question Answer
JIRA issue https://issues.ibexa.co/browse/IBX-869
Type bugfix
Target Ibexa DXP version v4.2.x
BC breaks maybe (custom mutations may have to be updated in the same way)

The schema mutation type is set by detecting what files were generated. When ezsystems/ezplatform-graphql#90 was merged, DomainContentMutation.types.yaml was renamed to ItemMutation.types.yaml, but the YamlSchemaProvider that searches for the files was not updated.

In addition, in v0.14 of overblog/graphql-bundle, the mutation function, used to resolve mutations, has been changed. The arguments are not provided as an array anymore, but as regular function arguments. This is the reason for the error @mnocon found. The behaviour had been changed earlier (in v0.13 as far as I can see) but had a compatibility layer that was removed in v0.14.

Note that the query function, that replaces the resolve one, has undergone the same change, and we will need to update it as well.

@konradoboza konradoboza requested a review from a team February 22, 2022 11:05
@konradoboza konradoboza added Bug Something isn't working Ready for QA labels Feb 23, 2022
mnocon
mnocon previously requested changes Feb 23, 2022
Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

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

This one fails after #26 has been merged.

When I try to execute a mutation like:

mutation createFolder {
  createFolder(
    language: eng_GB
    parentLocationId: 2
    input: {
      name: "New Folder"
    }
  ) {
    id
  }
}

Then the server response looks like this:

{
  "errors": [
    {
      "debugMessage": "Too few arguments to function Ibexa\\GraphQL\\Resolver\\DomainContentMutationResolver::createDomainContent(), 1 passed in /Users/mareknocon/Desktop/Sites/v3_4/vendor/overblog/graphql-bundle/src/Resolver/AbstractProxyResolver.php on line 36 and exactly 4 expected",
      "message": "Internal server Error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createFolder"
      ],
      "trace": [
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/overblog/graphql-bundle/src/Resolver/AbstractProxyResolver.php",
          "line": 36,
          "call": "Ibexa\\GraphQL\\Resolver\\DomainContentMutationResolver::createDomainContent(array(4))"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/overblog/graphql-bundle/src/Definition/GraphQLServices.php",
          "line": 34,
          "call": "Overblog\\GraphQLBundle\\Resolver\\AbstractProxyResolver::resolve(array(2))"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/var/cache/behat/overblog/graphql-bundle/__definitions__/ItemMutationType.php",
          "line": 136,
          "call": "Overblog\\GraphQLBundle\\Definition\\GraphQLServices::mutation('CreateDomainContent', array(4))"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/overblog/graphql-bundle/src/Definition/ArgumentFactory.php",
          "line": 37,
          "call": "Overblog\\GraphQLBundle\\__DEFINITIONS__\\ItemMutationType::Overblog\\GraphQLBundle\\__DEFINITIONS__\\{closure}(null, instance of Overblog\\GraphQLBundle\\Definition\\Argument(3), instance of ArrayObject(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 623,
          "call": "Overblog\\GraphQLBundle\\Definition\\ArgumentFactory::Overblog\\GraphQLBundle\\Definition\\{closure}(null, array(3), instance of ArrayObject(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 550,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, null, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 474,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: ItemMutation, null, instance of ArrayObject(1), array(1))"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 857,
          "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'createFolder')"
        },
        {
          "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'createFolder')"
        },
        {
          "file": "/Users/mareknocon/Desktop/Sites/v3_4/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 859,
          "function": "array_reduce(array(1), instance of Closure, array(0))"
        },
(...)

@sonarcloud
Copy link

sonarcloud bot commented Jul 28, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Bertrand Dunogier added 2 commits November 15, 2022 16:37
In v0.14 of the overblog/graphql-bundle, the arguments for "@=mutation" have been changed from an array to a sequence of arguments.
@bdunogier bdunogier force-pushed the ibx-869-mutations_broken branch from ed6f2b3 to 444dec1 Compare November 15, 2022 15:40
@bdunogier bdunogier changed the base branch from main to 4.2 November 15, 2022 15:45
@adamwojs
Copy link
Member

@bdunogier Have you addressed @mnocon feedback ?

@bdunogier
Copy link
Collaborator Author

Yes @adamwojs, this is what the 2nd commit does.

@bdunogier bdunogier requested a review from mnocon November 16, 2022 08:32
@mnocon mnocon removed their request for review November 16, 2022 10:02
@mnocon
Copy link
Contributor

mnocon commented Nov 16, 2022

Thanks Bertrand, I've added it to our QA queue

@mnocon mnocon requested review from mnocon and removed request for mnocon November 16, 2022 11:50
@mnocon mnocon dismissed their stale review November 16, 2022 11:51

New fix available

@mnocon mnocon requested review from mnocon and removed request for mnocon November 16, 2022 11:51
@adamwojs adamwojs changed the title IBX-869: fixed loading of mutations schema IBX-869: Fixed loading of mutations schema Nov 20, 2022
@micszo
Copy link

micszo commented Nov 22, 2022

Current status.
Create & Update works.
Delete throws exception.

@sonarcloud
Copy link

sonarcloud bot commented Nov 24, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bdunogier
Copy link
Collaborator Author

Pushed an extra change that fixes the arguments for the few remaining mutations. I have only tested deleteContent, not the other ones (uploadFiles and createToken).

@micszo
Copy link

micszo commented Nov 24, 2022

Current status.

create content OK
update content OK
delete content OK
login / createToken OK
create image / file upload NOK

Exception:

"debugMessage": "Call to undefined method Ibexa\\Core\\Repository\\Values\\Content\\Content::getContentInfo()",
      "message": "Internal server Error",

@bdunogier
Copy link
Collaborator Author

bdunogier commented Nov 25, 2022

Note that I’m getting a different error (arguments exception) on uploadFiles.
If it matches the needs of the customer who reported this, I suggest that we include the fixes for mutations loading, createContent, updateContent and deleteContent and then take care of the upload related issues in another one.

Copy link

@micszo micszo left a comment

Choose a reason for hiding this comment

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

QA Approved on Ibexa Commerce 4.2.4-dev.

There's green light for handling file upload separately, ticket will be created shortly.

@micszo micszo removed their assignment Nov 25, 2022
@micszo
Copy link

micszo commented Nov 25, 2022

New ticket: https://issues.ibexa.co/browse/IBX-4415.

@adamwojs adamwojs merged commit 647bdbf into 4.2 Nov 26, 2022
@adamwojs adamwojs deleted the ibx-869-mutations_broken branch November 26, 2022 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working QA approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants