Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-8116

Graphql generator creates invalid type.yaml when field identifier same name as resolver

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 4.6.0
    • None
    • eZ Platform, Ibexa Open Source

    Description

      If you create a content type with a ezstring field that an identifier that has the same name listed in [location, content]

      https://github.com/ibexa/graphql/blame/920fff0778521bc88f41460dac98126405661e4d/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/ResolverVariables.php#L53

      blindly changes it to value.getLocation(), value.getContent(), this is the wrong behavior and breaks

      Should check if this is the case before substituting or reserve these identifiers from being used

      expected output

                  location: 
                      type: String
                      resolve: '@=resolver("ItemFieldValue", [value, "location", args])'
                      args: 
                          language: { type: RepositoryLanguage }
      

      actual output

                  location: 
                      type: String
                      resolve: '@=resolver("ItemFieldValue", [value, "value.getLocation()", args])'
                      args: 
                          language: { type: RepositoryLanguage }
      

      Perhaps using a regex to avoid if the identifier is in quotes?

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              feb52ca2-9206-4fa9-818f-2c4dcf3f42b0@accounts.ibexa.co Douglas Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: