Skip to content

Cannot use "Properties" as Input Member #121

@tobidotYD

Description

@tobidotYD

Describe the bug

An graphql argument named 'properties' is colliding with the protected member of the Base class "ObjectLike".
It will result in resetting all arguments coming before 'properties' resulting in an invalid state of that object.

Expected behavior/Solution

"properties" should be a possible as an argument for a graphql input type.

Currently i am bypassing the issue by building the Object manually instead of using the 'make'.

$input = new CreateItemInput();
$input->foo = 'a';
$input->properties = [ 'hello' ];
$input->bar = 'b';

Maybe this could be handled like a php keyword and prefixed with an '_'?

Steps to reproduce

  1. Have a input type with a member named 'properties'
input CreateItem {
   foo: String!
   properties: [String]!
   bar: String!
}
  1. Run vendor/bin/sailor to generate the PhpClasses
  2. Instantiate the object with the properties member set
$input = CreateItemInput::make(
   foo: 'a',
   properties: [
     'hello'
   ],
   bar : 'b'
);
  1. Unfolding the object now yields an error even with correct input
    $input->toStdClass()

Output/Logs

Argument #1 ($foo) must be of type string, int given, called in vendor/spawnia/sailor/src/ObjectLike.php on line 74.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error within Sailor

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions