GraphQLBundle icon indicating copy to clipboard operation
GraphQLBundle copied to clipboard

Added IsPublic support to InputObject

Open vladdnepr opened this issue 2 years ago • 11 comments

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Documented? yes
Fixed tickets
License MIT

Added IsPublic support to InputObject

Tested locally, works fine

vladdnepr avatar Mar 11 '23 16:03 vladdnepr

Hi @vladdnepr Can you elaborate on this? The Input Object describe objects used by the client to send a query or mutation. There is no access management of this. What are you trying to achieve?

Vincz avatar May 03 '23 07:05 Vincz

I did access control for admin area via public feature.

I need to control inputs, queries, mutations and types. Frontend received schema and can recognize what enabled and what not.

Queries, mutations and types supports IsPublic, but inputs not

vladdnepr avatar May 03 '23 10:05 vladdnepr

@vladdnepr Ok, I see the use case. Did you check if it's supported by the bundle and the filtering is properly called (PublicFieldsFilterConfigProcessor.php) We would also need a couple of tests for this. Thanks!

Vincz avatar May 03 '23 14:05 Vincz

I will check it soon....

vladdnepr avatar May 03 '23 14:05 vladdnepr

Did you check if it's supported by the bundle and the filtering is properly called (PublicFieldsFilterConfigProcessor.php)

Yes

Снимок экрана 2023-05-04 в 11 44 51 Снимок экрана 2023-05-04 в 11 45 03

vladdnepr avatar May 04 '23 08:05 vladdnepr

@vladdnepr Ok great! Can you add a bunch of tests? Thank again!

Vincz avatar May 04 '23 09:05 Vincz

I see some tests failed. Also failed in origin master.

Снимок экрана 2023-05-04 в 12 27 11

Снимок экрана 2023-05-04 в 12 27 16

vladdnepr avatar May 04 '23 09:05 vladdnepr

What tests are you expected?

src/Config/Parser/MetadataParser/MetadataParser.php

I did change in private method, which called with another private inputMetadataToGQLConfiguration, which called with private classMetadatasToGQLConfiguration, which called with processFile

image

src/Config/InputObjectTypeDefinition.php

I do not see any tests for this file

Снимок экрана 2023-05-04 в 12 35 44

vladdnepr avatar May 04 '23 09:05 vladdnepr

@Vincz up

vladdnepr avatar May 13 '23 07:05 vladdnepr

Hi @vladdnepr! The tests are now running and I updated your PR on the latest changes. The tests we are expecting should be added in tests/Functional/App/config/public. You just need to add an input object in the config and check that the public is correctly handled in Overblog\GraphQLBundle\Tests\Functional\Generator\TypeGeneratorTest (see the first two methods for inspiration).

Vincz avatar May 27 '23 07:05 Vincz

Sorry, but now I don't have free time for this issue, maybe later I will add tests.

Maybe we release this issue later in another release?

vladdnepr avatar Jul 07 '23 07:07 vladdnepr